thomaspu
20th February 2008, 22:55
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:
void
MainWindowDlg::resizeEvent ( QResizeEvent * pEvent )
{
if ( QApplication::mouseButtons() != Qt::NoButton)
{
printf("Resizing and mouse button is still down!\n");
return;
}
else
{
printf("Resizing stopped! Mouse button is released!\n");
return;
}
...
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:
void
MainWindowDlg::resizeEvent ( QResizeEvent * pEvent )
{
if ( QApplication::mouseButtons() != Qt::NoButton)
{
printf("Resizing and mouse button is still down!\n");
return;
}
else
{
printf("Resizing stopped! Mouse button is released!\n");
return;
}
...