fix: 修复插拔显示器,多屏显示设置选项未动态隐藏或显示的问题

优化处理,以前是切换到其他页面再切换回来才会刷新

Log:
Influence: 插拔显示器,控制多屏显示设置
Task: https://pms.uniontech.com/zentao/task-view-98032.html
Change-Id: I23f2444c466ea3300e0bb5516cefaf1b9d6e26fd
This commit is contained in:
fanpengcheng 2022-01-14 14:38:06 +08:00
parent cd34f12ac3
commit f92b877db9

View File

@ -229,6 +229,15 @@ void ModuleWidget::initUI()
connect(m_screenSettingComboxWidget, &ComboxWidget::onSelectChanged, this, [ = ] (const QString &text) {
m_dockInter->setShowInPrimary(g_screenSettingMap.value(text));
});
connect(qApp, &QApplication::screenAdded, this, [ = ] {
m_screenSettingTitle->setVisible(qApp->screens().count() > 1);
m_screenSettingComboxWidget->setVisible(qApp->screens().count() > 1);
});
connect(qApp, &QApplication::screenRemoved, this, [ = ] {
m_screenSettingTitle->setVisible(qApp->screens().count() > 1);
m_screenSettingComboxWidget->setVisible(qApp->screens().count() > 1);
});
// 这里不会生效,但实际场景中也不存在有其他可配置的地方,可以不用处理
connect(m_dockInter, &DBusInter::ShowInPrimaryChanged, this, [ = ] (bool showInPrimary) {
if (m_screenSettingComboxWidget->comboBox()->currentText() == g_screenSettingMap.key(showInPrimary))