fix bug 154969 应用代理界面列表显示问题

This commit is contained in:
zhangyuanyuan1 2023-01-09 14:26:41 +08:00
parent b072aba07e
commit b8c67d1249
2 changed files with 22 additions and 7 deletions

View File

@ -45,7 +45,7 @@
#define PROXY_HOST_KEY "host"
#define PROXY_PORT_KEY "port"
#define THEME_SCHAME "org.ukui.style"
#define FRAME_LAYOUT_MARGINS 16,0,16,0
#define FRAME_LAYOUT_SPACING 8
#define LABEL_WIDTH 136
@ -1160,18 +1160,22 @@ void Proxy::setAppListFrameUi(QWidget *widget)
m_allowAppProxyLabel->setText(tr("The following applications are allowed to use this configuration:")); //允许以下应用使用该配置:
m_appListWidget = new QListWidget(m_appListFrame);
m_appListWidget->setMinimumHeight(240);
m_appListWidget->setBackgroundRole(QPalette::Base);
m_appListWidget->setFocusPolicy(Qt::FocusPolicy::NoFocus);
m_appListWidget->setFrameShape(QFrame::Shape::Panel);
appListLayout->addWidget(m_allowAppProxyLabel);
appListLayout->addWidget(m_appListWidget);
QPalette mpal(m_appListWidget->palette());
mpal.setColor(QPalette::Base, qApp->palette().base().color());
mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color());
m_appListWidget->setAlternatingRowColors(true);
m_appListWidget->setPalette(mpal);
onPaletteChanged();
const QByteArray style_id(THEME_SCHAME);
if (QGSettings::isSchemaInstalled(style_id)) {
QGSettings * styleGsettings = new QGSettings(style_id, QByteArray(), this);
connect(styleGsettings, &QGSettings::changed, this, [=](QString key){
if ("styleName" == key) {
onPaletteChanged();
}
});
}
}
void Proxy::appProxyInfoPadding()
@ -1269,6 +1273,16 @@ void Proxy::onAppProxyConfEditFinished()
}
}
void Proxy::onPaletteChanged()
{
QPalette mpal(m_appListWidget->palette());
mpal.setColor(QPalette::Base, qApp->palette().base().color());
mpal.setColor(QPalette::AlternateBase, qApp->palette().alternateBase().color());
m_appListWidget->setBackgroundRole(QPalette::Base);
m_appListWidget->setAlternatingRowColors(true);
m_appListWidget->setPalette(mpal);
}
void Proxy::onappProxyEnableChanged(bool enable)
{
m_proxyTypeFrame->setVisible(enable);

View File

@ -277,6 +277,7 @@ private slots:
void onipEditStateChanged(); //IP地址无效提示
void onAppProxyConfChanged(); //应用代理配置信息变化
void onAppProxyConfEditFinished();
void onPaletteChanged();
// void onCancelBtnClicked();
// void onSaveBtnClicked();
// void setBtnEnable();