Qt 窗口指針調用close()方法之後,,,,,,

Qt 窗口指針調用close()方法之後,還能使用指針嗎??

QWidget *w = new QWidget(this);
w->close();
那麼:w->isVisible()???是什麼結果呢?true or  false??? 還是crash??

先貼一段英語壯壯B格~~ 哈哈
Closes this widget. Returns true if the widget was closed; otherwise returns false.
First it sends the widget a QCloseEvent. The widget is hidden if it accepts the close event. If it ignores the event, nothing happens. The default implementation of QWidget::closeEvent() accepts the close event.
If the widget has the Qt::WA_DeleteOnClose flag, the widget is also deleted. A close events is delivered to the widget no matter if the widget is visible or not.
The QApplication::lastWindowClosed() signal is emitted when the last visible primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose attribute set is closed. By default this attribute is set for all widgets except transient windows such as splash screens, tool windows, and popup menus.

答案是:false,close()可以理解爲hide()

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章