Ich schreibe eine C++ Qt-Anwendung mit dem Hauptfenster, das den gesamten Bildschirm einnimmt, und einem untergeordneten Fenster, das Simulationssteuerelemente enthält.Qt5.6 RHEL Vollbild-Anwendungsfenster und untergeordnetes Fenster
Ich benutze RHEL 7.2 mit Qt 5.6. Das Problem ist, dass das untergeordnete Fenster, obwohl es in der Aufgabenliste sichtbar ist, nicht auf dem Display sichtbar ist.
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
}
Constructor Ausschnitt aus Simulationsfenster:
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();
}
Dies ist nicht der gesamte Code, aber hoffentlich genug, um zu zeigen, was ich getan habe, und wo das Problem sein könnte?