c++ - 如何在不设置为最大化的情况下最大化尺寸?
问题描述
使用 QT5 在 Win10 上工作。
showMaximized
可以使窗口最大化。但是,如果双击标题栏,它将调整大小。所以我想将窗口设置得尽可能大(不是全屏,还是要 Windows 任务栏),并将其设置为固定,这样就禁用了双击。我应该如何获得最大尺寸?
解决方案
您可以确定当前屏幕的大小
int screen_height = QApplication::desktop()->screenGeometry().height();
int screen_width = QApplication::desktop()->screenGeometry().width();
你可以做这样的事情
Widget* w = new Widget;
int screen_height = QApplication::desktop()->screenGeometry().height();
int screen_width = QApplication::desktop()->screenGeometry().width();
w->setMinimumSize(screen_width-10, screen_height-screen_height/12);
w->showMaximized();
推荐阅读
- codeigniter - Session: 配置的保存路径 APPPATH.application/logs' 不可被 centos nginx 中的 PHP 进程写入
- reactjs - 无法在 Reactjs 中导入图像返回错误找不到模块:无法解析
- azure-data-factory - CosmosToBlobCopyActivity 的 ADFv1 到 ADFv2 迁移
- intellij-idea - 如何向 Intellij IDEA 添加自定义操作?
- android - 如何从片段膨胀 ViewStub
- javascript - Typescript Object 可能是在 react 中使用 ref 聚焦的“null”焦点
- c# - 将图像转换为字节并返回
- wpf - Generic.xaml 不使用在 App.xaml 中设置的 SystemParameters
- python - 熊猫/excel/权限被拒绝
- mysql - Mysql - 指定密钥太长,最大密钥长度为 1024 字节,尽管编码类型为 latin1,索引包含 2 列(每列 512)