QT QMainWindow 全屏几何图形,没有帧大小
QT QMainWindow fullscreen geometry without frame size
我正在使用MinGW为Windows 7构建QT应用程序。在我的代码中,我有一个从QMainWindow派生的类。此主窗口显示和关闭多次(在不同的屏幕上(。我使用以下代码显示窗口:
this->blockSignals(true);
this->close();
this->blockSignals(false);
this->showMaximized();
this->setGeometry(QApplication::desktop()->availableGeometry(mDisplayNumber));
仅在第一次执行此代码时,窗口才会按预期显示。下一次,窗口显示为最大化,但我在屏幕底部缺少几个像素。
执行代码时,我还在 QT 中收到警告:
setGeometryDp:无法在 QWidgetWindow/'CDisplayClassWindow' 上设置 geometry 1600x1172+0+0。生成的几何体:1600x1150+0+22(帧:8、30、8、8,自定义边距:0、0、0、0,最小尺寸:780x539,最大尺寸:16777215x16777215(。
我不明白的是,desktop((>availableGeometry 返回的几何看起来不正确。我的问题是,如何确定警告消息中显示的几何形状?(1600×1150+0+22(
我在这里找到了答案:https://wiki.qt.io/How_to_Center_a_Window_on_the_Screen现在,我的 Show 函数如下:
Qt::WindowStates WindowState = this->windowState();
if(WindowState == Qt::WindowMaximized)
{
this->setWindowState(WindowState ^ Qt::WindowMaximized);
}
this->setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
this->size(),
QApplication::desktop()->availableGeometry(mDisplayNumber)));
this->showMaximized();
我仍然收到警告:setGeometryDp:无法在QWidgetWindow/'CDisplayClassWindow'上设置几何图形1600x1150+0+11。生成的几何体:1600x1150+0+22(帧:8、30、8、8,自定义边距:0、0、0、0,最小尺寸:780x539,最大尺寸:16777215x16777215(。
分辨率相同 (1600x1150(,窗口按预期显示。
相关文章:
- C / C++ 移位/偏移/向左或向右移动位图?
- 构建可组合有向图(扫描仪生成器的汤普森构造算法)
- 在无向图中打印循环
- 有没有办法在一行中填充矢量图
- 按边长度递归搜索图中所有可行路径
- 线性丢番图方程 - 求给定区间内的解数和解
- Winapi:屏幕截图未显示在窗口中
- 提升图广度优先搜索前置编译错误
- 在 UML 类图中为C++类添加构造函数和析构函数
- 如何在快板的屏幕中显示子位图的绘制?
- 为什么 std::next 在以空地图开头馈送时卡住
- Qt 图表条形图调整大小崩溃
- 如何从二进制文件中的给定符号中获取调用程序图
- 为什么提升图库的 read_graphviz() 函数会改变节点的索引
- 表达式必须具有完整或无作用域的枚举图
- OpenCV - Python 断言错误:SAD 算法 - 立体相机视差图计算
- CreateDIBSection为同一图像返回不一致的位图位值
- 如何在Qt Designer UI文件中清除QMainWindow的几何标记
- 使用几何着色器的图层渲染似乎只输出图像数组的第一层
- 用C 的GNUPLOT绘制几何图