feat(mainwindow): Get transparency by GlobalSettings' interface.

Description: 使用GlobalSettings类提供的接口获取透明度

Log: 使用GlobalSettings类提供的接口获取透明度
This commit is contained in:
zhangjiaping 2021-01-06 14:40:48 +08:00
parent 33608a71ab
commit 2d6d41b05f
2 changed files with 17 additions and 16 deletions

View File

@ -75,6 +75,11 @@ MainWindow::MainWindow(QWidget *parent) :
if (QGSettings::isSchemaInstalled(id)) {
m_transparency_gsettings = new QGSettings(id);
}
connect(qApp, &QApplication::paletteChanged, this, [ = ](const QPalette &pal) {
this->setPalette(pal);
this->update();
});
}
MainWindow::~MainWindow()
@ -325,22 +330,18 @@ void MainWindow::searchContent(QString searchcontent){
//使用GSetting获取当前窗口应该使用的透明度
double MainWindow::getTransparentData()
{
//todo modify here!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//todo modify here!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//todo modify here!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//if you have questions, please ask iaom or MouseZhangZh
// return GlobalSettings::getInstance()->getValue(TRANSPARENCY_KEY).toDouble();
if (!m_transparency_gsettings) {
return 0.7;
}
return GlobalSettings::getInstance()->getValue(TRANSPARENCY_KEY).toDouble();
// if (!m_transparency_gsettings) {
// return 0.7;
// }
QStringList keys = m_transparency_gsettings->keys();
if (keys.contains("transparency")) {
double tp = m_transparency_gsettings->get("transparency").toDouble();
return tp;
} else {
return 0.7;
}
// QStringList keys = m_transparency_gsettings->keys();
// if (keys.contains("transparency")) {
// double tp = m_transparency_gsettings->get("transparency").toDouble();
// return tp;
// } else {
// return 0.7;
// }
}
/**

View File

@ -57,7 +57,7 @@ qm_files.files = $$OUT_PWD/res/translations/*.qm
INSTALLS += \
qm_files \
LIBS += -L$$PWD/../libsearch -lukui-search -L$$PWD/../libchinese-segmentation/ -lchinese-segmentation
LIBS += -L$$OUT_PWD/../libsearch -lukui-search -L$$OUT_PWD/../libchinese-segmentation/ -lchinese-segmentation
INCLUDEPATH += $$PWD/../libsearch
DEPENDPATH += $$PWD/../libsearch