Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bluetooth and network plugin applet layout error when clicked by… #301

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions panels/dock/tray/plugins/bluetooth/componments/bluetoothapplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void BluetoothApplet::initUi()
m_scroarea->setContentsMargins(0, 0, 0, 0);
m_scroarea->setWidget(m_contentWidget);

updateIconTheme();
// updateIconTheme();

m_mainLayout->setContentsMargins(QMargins(0, 0, 0, 0));
m_mainLayout->setSpacing(0);
Expand All @@ -294,29 +294,29 @@ void BluetoothApplet::initConnect()
.call();
emit requestHide();
});
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme);
// connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme);
connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, &BluetoothApplet::setAirplaneModeEnabled);
connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, &BluetoothApplet::setDisabled);
}

/**
* @brief BluetoothApplet::updateIconTheme 根据主题颜色设置蓝牙界面控件背景色
*/
void BluetoothApplet::updateIconTheme()
{
QPalette widgetBackgroud;
QPalette scroareaBackgroud;
if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
widgetBackgroud.setColor(QPalette::Window, QColor(255, 255, 255, 0.03 * 255));
else
widgetBackgroud.setColor(QPalette::Window, QColor(0, 0, 0, 0.03 * 255));

m_contentWidget->setAutoFillBackground(true);
m_contentWidget->setPalette(widgetBackgroud);
scroareaBackgroud.setColor(QPalette::Window, Qt::transparent);
m_scroarea->setAutoFillBackground(true);
m_scroarea->setPalette(scroareaBackgroud);
}
// /**
// * @brief BluetoothApplet::updateIconTheme 根据主题颜色设置蓝牙界面控件背景色
// */
// void BluetoothApplet::updateIconTheme()
// {
// QPalette widgetBackgroud;
// QPalette scroareaBackgroud;
// if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType)
// widgetBackgroud.setColor(QPalette::Window, QColor(255, 255, 255, 0.03 * 255));
// else
// widgetBackgroud.setColor(QPalette::Window, QColor(0, 0, 0, 0.03 * 255));

// m_contentWidget->setAutoFillBackground(true);
// m_contentWidget->setPalette(widgetBackgroud);
// scroareaBackgroud.setColor(QPalette::Window, Qt::transparent);
// m_scroarea->setAutoFillBackground(true);
// m_scroarea->setPalette(scroareaBackgroud);
// }

void BluetoothApplet::initAdapters()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public slots:
void initConnect();
// 更新蓝牙插件主界面大小
void updateSize();
void updateIconTheme();
// void updateIconTheme();
void initAdapters();

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#define BLUETOOTHCONSTANTS_H

const int DeviceItemHeight = 36;
const int ItemWidth = 300;
const int ItemWidth = 330;
const int TitleHeight = 46;
const int TitleSpace = 2;
const int MaxDeviceCount = 8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ enum NetItemRole {
sortRole
};

#define PANELWIDTH 300
#define PANELWIDTH 330

enum NetItemType {
DeviceControllViewItem = 0, // 总控开关
Expand Down
2 changes: 1 addition & 1 deletion panels/dock/tray/plugins/display/displaysettingwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ DisplaySettingWidget::DisplaySettingWidget(BrightnessModel *model, QWidget *pare

void DisplaySettingWidget::initUI()
{
setContentsMargins(0, 10, 0, 30);
setContentsMargins(10, 10, 10, 10);
QVBoxLayout *mainLayout = new QVBoxLayout();
mainLayout->setContentsMargins(0, 0, 0, 0);
mainLayout->setSpacing(ItemSpacing);
Expand Down
4 changes: 2 additions & 2 deletions panels/dock/tray/plugins/pluginmanager/pluginchildpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void PluginChildPage::initUi()
m_back->setFlat(true);
m_title->setAlignment(Qt::AlignCenter);
QHBoxLayout *headerLayout = new QHBoxLayout(m_headerWidget);
headerLayout->setContentsMargins(11, 12, 24 + 11, 12);
headerLayout->setContentsMargins(11, 12, 11, 12);
headerLayout->setSpacing(0);
headerLayout->addWidget(m_back);
headerLayout->addWidget(m_title);
Expand All @@ -74,7 +74,7 @@ void PluginChildPage::initUi()

mainLayout->addWidget(m_headerWidget);
mainLayout->addWidget(m_container);
m_containerLayout->setContentsMargins(11, 0, 11, 0);
m_containerLayout->setContentsMargins(0, 0, 0, 0);
m_containerLayout->setSpacing(0);
}

Expand Down
3 changes: 2 additions & 1 deletion panels/dock/tray/plugins/sound/sounddeviceswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ bool SoundDevicesWidget::eventFilter(QObject *watcher, QEvent *event)

void SoundDevicesWidget::initUi()
{
setContentsMargins(0, 0, 0, 0);
m_tipsLabel->setAccessibleName("soundtips");
m_tipsLabel->setVisible(false);

QVBoxLayout *layout = new QVBoxLayout(this);
layout->setContentsMargins(10, 0, 10, 0);
layout->setContentsMargins(10, 10, 10, 10);

QPixmap leftPixmap = QIcon::fromTheme(QString("audio-volume-%1-symbolic").arg(m_sinkInter->mute() ? "muted" : "off")).pixmap(18, 18);
m_sliderContainer->setIcon(SliderContainer::IconPosition::LeftIcon, leftPixmap, QSize(), 5);
Expand Down
Loading