Catch click/unclick event on QMainWindow border
Is there a way to find out if a mouse key is pressed or released on the border of a QMainWindow? I'm trying to accurately find out when the user has stopped resizing my mainwindow by using the mouse keys to figure out when the user "lets go" of the window.
I was trying to see if I could detect the mouse button state inside the resize event of my QMainWindow, but everytime I query the button state, its always printing the
"resizing stopped! Mouse button is released!"
message.
Any suggestions?
Paul
Here's what I was trying:
Code:
void
{
{
printf("Resizing and mouse button is still down!\n");
return;
}
else
{
printf("Resizing stopped! Mouse button is released!\n");
return;
}
...
Re: Catch click/unclick event on QMainWindow border
The window border and title bar are managed by the underlying window manager. So, as the docs say, the resizeEvent is triggered when the window has already been resized, that is why you always get the mouse released button.
Depending on how many platform you must do this, you should think about approaching this in a platform dependent manner.