What just happened?

In the last exercise, we learned to use some properties and signals from MouseArea to make the button component more interactive. However, the element is much richer in features. In particular, if hover events are enabled, you can get the current mouse position in the item's local coordinate system through the mouseX and mouseY properties that return values. The cursor position can also be reported by handling the positionChanged signal. Speaking of signals, most MouseArea signals carry a MouseEvent object as their argument. This argument is called mouse and contains useful information about the current state of the mouse, including its position and buttons currently pressed. By default, MouseArea only reacts to the left ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.