[solved] How to catch mouse click event on titlebar area of QMainWindow?
Because the titlebar belongs to the OS,so I cant catch mouse click event on titlebar area of QMainWindow.
How to catch it?
10 replies
I don’t know with Qt framework, but on windows you can catch the WM_NCHITTEST [msdn.microsoft.com]).aspx message, and check if HTCAPTION is the return value of DefWindowProc.
In Qt Assistant:
The QDecoration class is a base class for window decorations in Qt for Embedded Linux
Note that this class is non-portable and only available in Qt for Embedded Linux.
Reimplement the regionClicked() and regionDoubleClicked() functions to respond to mouse clicks
it seemed like possible in Embedded linux only
Gerolf and cincirin, finally, As you suggested problems have been solved.@bool gwMainWindow::winEvent ( MSG * msg, long * result )
return false; }@
{ if (msg->message == WM_NCLBUTTONDOWN) { //here can catch the leftmousedown event on titlebar }
But, if you do some platform independant stuff, you need to do more :-)
With WM_NCLBUTTONDOWN notify message you’re not sure click on title bar. Indeed title bar is non client area, but a window, outside the titlebar has other non-client area.
@bool gwMainWindow::winEvent ( MSG * msg, long * result )
{ if (msg->message == WM_NCLBUTTONDOWN) { //here can catch the leftmousedown event on titlebar } return false; }@
You must log in to post a reply. Not a member yet? Register here!


