1 Star 0 Fork 0

GXDE OS/GXDE 热区

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.cpp 737 Bytes
一键复制 编辑 原始数据 按行查看 历史
gfdgd xi 提交于 2026-02-01 09:52 +08:00 . 新增屏幕检测
#include "widget.h"
#include <QApplication>
#include <QList>
QList <Widget*> list;
void loadWidget() {
for (int i = 0; i < list.count(); ++i) {
delete list[i];
list.remove(i);
}
for (QScreen *screen: QGuiApplication::screens()) {
list << new Widget(screen);
}
}
int main(int argc, char *argv[])
{
// 在 Wayland 下需要使用 xwayland 运行
qputenv("QT_QPA_PLATFORM", "xcb");
QApplication a(argc, argv);
loadWidget();
QAction::connect(&a, &QApplication::screenAdded, NULL, &loadWidget);
QAction::connect(&a, &QApplication::screenRemoved, NULL, &loadWidget);
QAction::connect(&a, &QApplication::primaryScreenChanged, NULL, &loadWidget);
return a.exec();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/GXDE-OS/gxde-requ.git
git@gitee.com:GXDE-OS/gxde-requ.git
GXDE-OS
gxde-requ
GXDE 热区
master

搜索帮助