Merge branch '2303update-bug' into 'yhkylin/v101'

fix bug 176216  165498 控制面板打开应用代理卡顿问题  开关应用代理按钮时会有撕裂态横细线出现问题

See merge request kylinos-src/kylin-nm!186
This commit is contained in:
赵世旭 2023-06-25 06:55:59 +00:00
commit d95dfb1dfc
4 changed files with 46 additions and 35 deletions

View File

@ -43,12 +43,11 @@ void AppListWidget::setAppChecked(bool flag)
/**
* @brief AppListWidget::setAppIcon
* @param icon
* @param icon
*/
void AppListWidget::setAppIcon(const QPixmap &icon)
void AppListWidget::setAppIcon(const QIcon &icon)
{
m_iconLabel->setAlignment(Qt::AlignCenter);
m_iconLabel->setPixmap(icon);
m_iconBtn->setIcon(icon);
}
/**
@ -119,12 +118,19 @@ void AppListWidget::initUI()
mainLayout->setSpacing(8);
m_checkBox = new QCheckBox(this);
m_checkBox->setAttribute(Qt::WA_TransparentForMouseEvents, true); //m_checkBox不响应鼠标事件,将其传递给父窗口
m_iconLabel = new QLabel(this);
m_iconLabel->setFixedSize(24, 24);
m_iconBtn = new QToolButton(this);
m_iconBtn->setToolButtonStyle(Qt::ToolButtonStyle::ToolButtonIconOnly);
m_iconBtn->setAttribute(Qt::WA_TranslucentBackground, true); //透明
m_iconBtn->setAttribute(Qt::WA_TransparentForMouseEvents, true);
m_iconBtn->setAutoRaise(true);
m_iconBtn->setFixedSize(24, 24);
m_iconBtn->setIconSize(QSize(24, 24));
m_nameLabel = new QLabel(this);
mainLayout->addWidget(m_checkBox);
mainLayout->addWidget(m_iconLabel);
mainLayout->addWidget(m_iconBtn);
mainLayout->addWidget(m_nameLabel);
mainLayout->addStretch();
}

View File

@ -28,6 +28,7 @@
#include <QHBoxLayout>
#include <QDBusInterface>
#include <QDBusReply>
#include <QToolButton>
class AppListWidget : public QWidget
{
@ -37,7 +38,7 @@ public:
~AppListWidget();
void setAppChecked(bool flag);
void setAppIcon(const QPixmap &icon);
void setAppIcon(const QIcon &icon);
void setAppName(const QString &text);
void onAppCheckStateChanged();
void AddAppProxyConfig();
@ -51,7 +52,7 @@ private:
void initDbus();
QCheckBox *m_checkBox = nullptr;
QLabel *m_iconLabel = nullptr;
QToolButton *m_iconBtn = nullptr;
QLabel *m_nameLabel = nullptr;
QString m_path = nullptr;
QDBusInterface *m_dbusInterface = nullptr;

View File

@ -722,10 +722,10 @@ void Proxy::initAppProxyStatus()
m_appEnableBtn->setChecked(state);
onappProxyEnableChanged(state);
appProxyInfoPadding();
// m_cancelBtn->setEnabled(false);
// m_saveBtn->setEnabled(false);
appListPadding();
if (state) {
appProxyInfoPadding();
appListPadding();
}
}
int Proxy::_getCurrentProxyMode(){
@ -1133,17 +1133,24 @@ void Proxy::setAppProxyFrameUi(QWidget *widget)
m_appLine4 = setLine(m_appProxyFrame);
m_appLine5 = setLine(m_appProxyFrame);
m_appProxyInfoWidget = new QWidget(m_appProxyFrame);
QVBoxLayout *widgetHLayout = new QVBoxLayout(m_appProxyInfoWidget);
widgetHLayout->setContentsMargins(0, 0, 0, 0);
widgetHLayout->setSpacing(0);
widgetHLayout->addWidget(m_appLine1);
widgetHLayout->addWidget(m_proxyTypeFrame);
widgetHLayout->addWidget(m_appLine2);
widgetHLayout->addWidget(m_ipAddressFrame);
widgetHLayout->addWidget(m_appLine3);
widgetHLayout->addWidget(m_portFrame);
widgetHLayout->addWidget(m_appLine4);
widgetHLayout->addWidget(m_userNameFrame);
widgetHLayout->addWidget(m_appLine5);
widgetHLayout->addWidget(m_pwdFrame);
appProxyLayout->addWidget(m_appEnableFrame);
appProxyLayout->addWidget(m_appLine1);
appProxyLayout->addWidget(m_proxyTypeFrame);
appProxyLayout->addWidget(m_appLine2);
appProxyLayout->addWidget(m_ipAddressFrame);
appProxyLayout->addWidget(m_appLine3);
appProxyLayout->addWidget(m_portFrame);
appProxyLayout->addWidget(m_appLine4);
appProxyLayout->addWidget(m_userNameFrame);
appProxyLayout->addWidget(m_appLine5);
appProxyLayout->addWidget(m_pwdFrame);
appProxyLayout->addWidget(m_appProxyInfoWidget);
// appProxyLayout->addWidget(line5);
// appProxyLayout->addWidget(m_appBtnFrame);
@ -1227,7 +1234,7 @@ void Proxy::appListPadding()
AppListWidget *appWidget = new AppListWidget(index, m_appListWidget);
appWidget->setAppName(appInfo.value(0));
appWidget->setAppIcon(QIcon::fromTheme(appInfo.value(1)).pixmap(24, 24));
appWidget->setAppIcon(QIcon::fromTheme(appInfo.value(1)));
appWidget->setAppChecked(flag);
QListWidgetItem *appListWidgetItem = new QListWidgetItem(m_appListWidget);
@ -1304,17 +1311,13 @@ void Proxy::onPaletteChanged()
void Proxy::onappProxyEnableChanged(bool enable)
{
m_proxyTypeFrame->setVisible(enable);
m_ipAddressFrame->setVisible(enable);
m_portFrame->setVisible(enable);
m_userNameFrame->setVisible(enable);
m_pwdFrame->setVisible(enable);
m_appListFrame->setVisible(enable);
m_appLine1->setVisible(enable);
m_appLine2->setVisible(enable);
m_appLine3->setVisible(enable);
m_appLine4->setVisible(enable);
m_appLine5->setVisible(enable);
if (enable) {
m_appProxyInfoWidget->show();
m_appListFrame->show();
} else {
m_appProxyInfoWidget->hide();
m_appListFrame->hide();
}
}
#if 0

View File

@ -250,6 +250,7 @@ private:
// QPushButton *m_cancelBtn;
// QPushButton *m_saveBtn;
QListWidget *m_appListWidget = nullptr;
QWidget *m_appProxyInfoWidget;
QTextEdit *mIgnoreLineEdit;