How to recognize a window open in qt

I created two main windows. How to find out if the 2nd window is open in QT?

QMainWindow *window1 = new QMainWindow();

QMainWindow *window2 = new QMainWindow();

Now I have to find that window2 is already open in my instance. How to know

+4
source share
2 answers

You can use the visible property :

if (window2->isVisible()) {
   ...
}
+3
source

use QWidget#visible: http://doc.qt.io/qt-4.8/qwidget.html#properties

if(window1-> isVisible()) {
  //...
}

Edited for comment below.

0
source

All Articles