2016-04-28 70 views
0

我正在写一个C++ Qt应用程序,占用整个屏幕的主窗口和包含模拟控件的子窗口。Qt5.6 RHEL全屏应用程序窗口和子窗口

我使用RHEL 7.2和Qt 5.6。问题在于子窗口虽然在任务列表中可见,但在显示屏上不可见。从模拟窗口

clsMainWin::clsMainWin(QRect rctScr, QWidget *parent) : QMainWindow(parent) 
                ,ui(new Ui::clsMainWin) { 
     ui->setupUi(this); 
    //Set-up window container background and size 
     setWindowFlags(Qt::Window | Qt::FramelessWindowHint); 
     setWindowIcon(QPixmap(1,1))); 
     setGeometry(rctScr); 
    //Display the window container 
     showFullScreen(); 
    #ifdef SIM_WINDOW 
     mpobjSimWin = NULL; 
    #endif 
    } 
    void clsMainWin::paintEvent(QPaintEvent* pEvt) { 
    //Prevent compiler warning! 
     pEvt = pEvt; 
    //Get painter context 
     QPainter objPainter(this); 
    //Fill the root area with the chosen colour 
     objPainter.fillRect(geometry(), 
      QColor(mpobjRoot->strGetAttr(mcszXMLattrColorBg))); 
    #ifdef SIM_WINDOW 
     if (mpobjSimWin == NULL) { 
      mpobjSimWin = new clsSimWin(this); 
      mpobjSimWin->setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); 
      mpobjSimWin->raise(); // for MacOS 
      mpobjSimWin->activateWindow(); // for Windows 
     } 
    #endif 
    } 

构造函数片段:

clsSimWin::clsSimWin(QWidget *parent) : QDialog(parent) 
            ,ui(new Ui::clsSimWin) { 
     assert(parent != NULL); 

     ui->setupUi(this); 
    //Set the window title 
     this->setStyleSheet("background-color: white;"); 
     setWindowTitle("Data simulator"); 
    //Set-up window 
     Qt::WindowFlags flags = (Qt::Window 
           | Qt::WindowTitleHint 
           | Qt::CustomizeWindowHint) 
           & ~Qt::WindowMaximizeButtonHint; 
     setWindowFlags(flags); 
     setFixedSize(mcintWindowWidth, mcintWindowHeight); 
    //Display the window 
     show(); 
    } 

这还不是全部的代码,但希望足以显示这个问题可能是我做了什么,在哪里?

回答

0

通过移动调用以显示构造函数之外的方法来修复。