[SOLVED] Close button
-
I have a question to the window close button. How is it possible to complete relink this button? When I use the QWidget::closeEvent() it does whatever I want this event to do, but it still closes the window.
What I would need is to detach this button completely from its predefined behavior and give him a new behavior.
-
Could you show us some code please? Your window shouldn't close if you ignore the close event.
-
i think this can help
@
void MyWidget::closeEvent(QCloseEvent *ev){
ev->ignore(); // this ignores the close event
}
@ -
Well there isn't much code to show. At the moment I use this event handler just to detect when the event takes place.
@
void MyWindow::closeEvent(QCloseEvent *)
{
qDebug() << "closed";
}
@That works fine, but the problem is, that this is just an event that takes place when I close that window. It doesn't matte how I achieve this, e.g. by using the window close button or by closing the application.
The point is, when I click on the window close button (the one that is integrated in the frame) the window closes anyway. What I'm looking for is to detach this button from its behaviour. E.g. when I click on this button, something else happens (whatever I want) but it does not close the window.
Edit: Exactly what Neutron Stein wrote, thx!