c++ - 如何在 QT 中显示与主窗口相邻的新窗口
问题描述
我想在启动应用程序时使用两个 GUI 窗口。为此,我已经实现了 Qt Designer Form Class(命名为它AnotherWindow
)并在我的MainWindow
构造函数中实现了以下内容:
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setWindowTitle("mainWindow");
anotherWindow = new AnotherWindow(); // will destroy it in corresponding destructor
anotherWindow->setWindowTitle("anotherWindow");
anotherWindow->show();
}
代码正常工作,当我运行应用程序时,会创建两个窗口(mainWindow
后跟anotherWindow
)。但是,当我运行应用程序时,这些窗口会相互重叠。是否可以显示这些窗口彼此相邻而不是重叠?每次运行我的应用程序时,我都不想拖动重叠的窗口彼此相邻。我已经看过这个问题How to show another window from mainwindow in QT,这没有帮助。
解决方案
推荐阅读
- java - 项目未正确添加到 arrayList
- python - 在 ListBox 内制作一个多选 CheckButton 的全选按钮
- reporting-services - 在主报表中呈现具有不同页眉和页脚的多个子报表时出现问题
- php - 如何简化嵌套循环?
- ruby-on-rails - 资产管道中不存在资产“devise/sessions.css”
- javascript - 类型错误:“这是未定义的”在成员数组上使用 forEach 时
- javascript - DateTimePicker 不能禁用过去的时间吗?
- php - 如何使用 PHP 代码找到每天的某个时间间隔
- ios - 在swift 4中按下按钮时如何将json结果发送到电子邮件?
- javascript - 变量 ES5 到 ES6 的动态导出