Cancel closing QWidget after clicking close button

3.8k views Asked by At

Is it possible to keep a QWidget open after close button clicked? Suppose that widget is main widget. i.e. not child of another widget.

1

There are 1 answers

0
vahancho On BEST ANSWER

I would try to:

void Widget::closeEvent(QCloseEvent *event)
{
    [..]
    event->ignore();
}

As documentation say:

"For example, you can prevent the window from closing by calling ignore() on all events."