clicked signal from QMainWindow
Hello!
I want to do something like this: clicking on 'lock' button should lock the screen (disable all objects), and clicking anywhere on QMainWindow should do some actions, and then unlock the window. Since there is not such a thing like clicked signal emitted from QMainWindow I'm wondering how can I check if the window was clicked while 'lock' state.
thanks in advance
best regards
Tomasz
Re: clicked signal from QMainWindow
Quote:
Since there is not such a thing like clicked signal emitted from QMainWindow I'm wondering how can I check if the window was clicked while 'lock' state.
see mousePressEvent().
Re: clicked signal from QMainWindow
Thanks! I've reimplemented this function:
Code:
{
if(event->button()==Qt::LeftButton)
{
out << "test" << endl;
}
}
And it works just fine. One more question. When I've reimplemented it, it will be working all the time that way. Can I make it work this way only in my 'lock' mode? I think I can use some variable to detect that mode, but is this the only way?
thanks in advance
best regards
Tomasz
Re: clicked signal from QMainWindow
I am not quite sure I understand your last question.
One way you could go about it, is just emit a signal in your mousePressEvent(), and in the slot you can have the logic for doing things depending on your mode, as you wanted in your original question.
But that is only a semantic difference.
You can just as well do that in the mousePressEVent().
P.S
Instead of using QTextStream for debug messages you can use qDebug().