In this recipe, we will be learning to display the point where the mouse button is clicked on the form. Point here means a dot. That is, wherever the user presses the mouse, a dot will appear at that coordinate. You will also learn to define the size of the dot too.
Displaying a point where the mouse button is clicked
How to do it...
The mousePressEvent() method will be used in this recipe as it is the method that is automatically invoked when the mouse is pressed on the form. In the mousePressEvent() method, we will execute the command to display a dot or point of the desired size. Here are the steps to understand how you can display a point or dot on the form where the mouse button is clicked:
- Let's create an application based...