iMath
iMath

Reputation: 2478

Stop QWidget::​leaveEvent() from happening when mouse cursor is hovering on the title bar

I tested on Win7 that when mouse cursor is hovering on the title bar of a window, then

QWidget::​leaveEvent(QEvent * event)

is triggered, while I don't want it to happen in this case. Is there any solution on stopping the event from happening when mouse cursor is hovering on the title bar of a window?

Upvotes: 0

Views: 292

Answers (1)

RazrFalcon
RazrFalcon

Reputation: 807

Title bar is not part of QWidget. It's part of system decoration. You don't have access to it from Qt.

You can do it only by using eventFilter() and calculating mouse position and title bar height. But there is no API in Qt to get it, so you need to use winapi, which mean you broke portability.

Also, some Linux DE does not have title bar at all.

Upvotes: 2

Related Questions