fix bug# 131221 & 131184

This commit is contained in:
lizhuoan 2022-09-13 10:29:12 +08:00
parent 07c9bf2b02
commit c9f1f937a9
1 changed files with 16 additions and 3 deletions

View File

@ -45,6 +45,9 @@
#define TRANSPARENCY_SETTINGS "org.ukui.control-center.personalise"
#define TRANSPARENCY_KEY "transparency"
#define PANEL_SIZE "panelsize"
#define PANEL_POSITION "panelposition"
#define POWER_POLICY_AC "powerPolicyAc"
#define POWER_POLICY_BATTERY "powerPolicyBattery"
@ -77,11 +80,13 @@ powerwindow::powerwindow(QWidget *parent) : QWidget(parent)
initgsetting();
// set_window_position(); //设置出现在屏幕的位置以及大小
watchTranspartency();
#if 0
//监听屏幕改变的信号
#if 0
connect(QApplication::desktop(), &QDesktopWidget::resized, this, [=]() {
QTimer::singleShot(1000, this, [=]() { set_window_position(); });
});
connect(QApplication::desktop(), &QDesktopWidget::workAreaResized, this, [=]() {set_window_position();});
connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged, this, [=]() { set_window_position(); });
connect(QApplication::desktop(), &QDesktopWidget::primaryScreenChanged, this, [=]() { set_window_position(); });
#endif
@ -154,7 +159,7 @@ void powerwindow::initUI()
m_enduranceIconButtun = new QToolButton(this);
m_enduranceIconButtun->setIconSize(QSize(16,16));
m_enduranceIconButtun->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_enduranceIconButtun->setProperty("useIconHighlightEffect", 0x10);
m_enduranceIconButtun->setProperty("useIconHighlightEffect", 0x2);
m_enduranceIconButtun->setStyle(new CustomStyle);
QIcon icon1 = QIcon::fromTheme("ukui-eco-symbolic");
m_enduranceIconButtun->setIcon(icon1);
@ -162,7 +167,7 @@ void powerwindow::initUI()
m_performanceIconButtun = new QToolButton(this);
m_performanceIconButtun->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_performanceIconButtun->setProperty("useIconHighlightEffect", 0x10);
m_performanceIconButtun->setProperty("useIconHighlightEffect", 0x2);
m_performanceIconButtun->setStyle(new CustomStyle);
QIcon icon2 = QIcon::fromTheme("ukui-performance-symbolic");
m_performanceIconButtun->setIcon(icon2);
@ -242,6 +247,14 @@ void powerwindow::initgsetting()
setSliderValue();
}
});
const QByteArray panelId(UKUI_PANEL_SETTING);
m_pPanelSetting = new QGSettings(panelId);
connect(m_pPanelSetting, &QGSettings::changed, this, [=](const QString &key){
if (key == PANEL_SIZE || key == PANEL_POSITION) {
set_window_position();
}
});
}
void powerwindow::get_power_list()