Qt5.6 RHEL全屏应用程序窗口和子窗口
Qt5.6 RHEL Fullscreen application window and child window
我正在编写一个C++Qt应用程序,该应用程序具有占据整个屏幕的主窗口和包含模拟控件的子窗口。
我使用的是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();
}
这并不是所有的代码,但希望足以展示我所做的工作以及问题可能在哪里?
通过移动调用以显示构造函数之外的方法来修复此问题。
相关文章:
- 如何将一个窗口保留在另一个应用程序窗口的前面
- 如何从 Win32 C++ 应用程序输出到父控制台窗口?
- 从运行服务的应用程序代码中提取窗口句柄
- 没有运算符"="与这些操作数匹配,JUCE 窗口演示应用程序
- 如何使用C++确定应用程序是否已在窗口中启动?
- 是否可以从控制台应用程序使用 C++/WinRT 创建窗口?
- 用C++编写.Net窗口应用程序
- 如何将 QML 文件分配给主窗口/应用程序
- 将WM_CHANGEUISTATE发送到窗口应用程序后,当用鼠标访问菜单时,助记符不会显示在系统菜单上
- MSBuild 未在控制台窗口应用程序中使用 "system" 进行编译
- QT通过单击Menubar C 移动整个窗口/应用程序
- 从控制台应用程序启动窗口应用程序
- 如何在QML无窗口应用程序中设置拖放区域
- 如何覆盖其他窗口应用程序的元素?
- 使用MINGW在窗口应用程序中压制系统("command")控制台窗口
- 将二维数组 double[][] 传递给 c# 窗口应用程序
- OpenGL窗口应用程序检查事件更新的频率
- 使用C++窗口应用程序加载Linux格式的文本文件
- 是否可以编写一个windows应用程序,当在另一个窗口应用程序中选择文本时,该应用程序会收到通知
- 如何使用c++ /Qt5构建无窗口应用程序?