diff --git a/frame/accessible/accessible.h b/frame/accessible/accessible.h index cf3647001..67ecd2618 100644 --- a/frame/accessible/accessible.h +++ b/frame/accessible/accessible.h @@ -100,6 +100,7 @@ SET_LABEL_ACCESSIBLE(QLabel, m_w->objectName() == "notifications" ? m_w->objectN SET_BUTTON_ACCESSIBLE(DIconButton, m_w->objectName().isEmpty() ? "imagebutton" : m_w->objectName()) SET_BUTTON_ACCESSIBLE(DSwitchButton, m_w->text().isEmpty() ? "switchbutton" : m_w->text()) SET_BUTTON_ACCESSIBLE(DesktopWidget, "desktopWidget"); +SET_FORM_ACCESSIBLE(HorizontalSeperator, "HorizontalSeperator"); // 几个没什么用的标记,但为了提醒大家不要遗漏标记控件,还是不要去掉 SET_FORM_ACCESSIBLE(DBlurEffectWidget, "DBlurEffectWidget") SET_FORM_ACCESSIBLE(DListView, "DListView") @@ -183,6 +184,7 @@ QAccessibleInterface *accessibleFactory(const QString &classname, QObject *objec USE_ACCESSIBLE(classname, NetworkItem); USE_ACCESSIBLE(classname, StateButton); USE_ACCESSIBLE(classname, DeviceControlWidget); + USE_ACCESSIBLE(classname, HorizontalSeperator); if (!interface && object->inherits("QWidget") && !ignoreLst.contains(classname)) { QWidget *w = static_cast(object); diff --git a/plugins/network/item/applet/horizontalseperator.cpp b/frame/util/horizontalseperator.cpp similarity index 63% rename from plugins/network/item/applet/horizontalseperator.cpp rename to frame/util/horizontalseperator.cpp index 06af33b89..c910662f4 100644 --- a/plugins/network/item/applet/horizontalseperator.cpp +++ b/frame/util/horizontalseperator.cpp @@ -21,30 +21,33 @@ #include "horizontalseperator.h" +#include + #include /** - * @brief HorizontalSeperator::HorizontalSeperator 网络界面控件分割线,高度值初始化为2个像素 + * @brief HorizontalSeperator::HorizontalSeperator 分割线控件,高度值初始化为2个像素 * @param parent */ HorizontalSeperator::HorizontalSeperator(QWidget *parent) - : QWidget(parent), - m_color(0, 0, 0, 0.1*255) + : QWidget(parent) { setFixedHeight(2); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); -} -void HorizontalSeperator::setColor(const QColor color) -{ - m_color = color; - update(); + QPalette palette = this->palette(); + palette.setColor(QPalette::Light, QColor(0, 0, 0, 0.1 * 255)); + palette.setColor(QPalette::Dark, QColor(255, 255, 255, 0.1 * 255)); + this->setPalette(palette); } void HorizontalSeperator::paintEvent(QPaintEvent *e) { - QWidget::paintEvent(e); + Q_UNUSED(e) QPainter painter(this); - painter.fillRect(rect(), m_color); + if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) + painter.fillRect(rect(), palette().color(QPalette::Light)); + else + painter.fillRect(rect(), palette().color(QPalette::Dark)); } diff --git a/plugins/network/item/applet/horizontalseperator.h b/frame/util/horizontalseperator.h similarity index 93% rename from plugins/network/item/applet/horizontalseperator.h rename to frame/util/horizontalseperator.h index 242f85878..ace6c5e97 100644 --- a/plugins/network/item/applet/horizontalseperator.h +++ b/frame/util/horizontalseperator.h @@ -31,13 +31,8 @@ class HorizontalSeperator : public QWidget public: explicit HorizontalSeperator(QWidget *parent = nullptr); - void setColor(const QColor color); - protected: void paintEvent(QPaintEvent *e); - -private: - QColor m_color; }; #endif // HORIZONTALSEPERATOR_H diff --git a/plugins/bluetooth/CMakeLists.txt b/plugins/bluetooth/CMakeLists.txt index 7cf605189..a6b820d51 100644 --- a/plugins/bluetooth/CMakeLists.txt +++ b/plugins/bluetooth/CMakeLists.txt @@ -6,7 +6,8 @@ project(${PLUGIN_NAME}) # Sources files file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp" "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp" - "../../frame/util/statebutton.h" "../../frame/util/statebutton.cpp") + "../../frame/util/statebutton.h" "../../frame/util/statebutton.cpp" + "../../frame/util/horizontalseperator.h" "../../frame/util/horizontalseperator.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.cpp b/plugins/bluetooth/componments/bluetoothadapteritem.cpp index 8c5424dff..8343def61 100644 --- a/plugins/bluetooth/componments/bluetoothadapteritem.cpp +++ b/plugins/bluetooth/componments/bluetoothadapteritem.cpp @@ -24,9 +24,7 @@ #include "componments/adapter.h" #include "bluetoothconstants.h" #include "refreshbutton.h" - -#include -#include +#include "util/horizontalseperator.h" #include #include @@ -35,6 +33,9 @@ #include #include +#include +#include + ItemDelegate::ItemDelegate(QAbstractItemView *parent) : DStyledItemDelegate(parent) { @@ -156,8 +157,9 @@ BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent) QDBusConnection::sessionBus(), this)) , m_showUnnamedDevices(false) - , m_Separator(new HorizontalSeperator(this)) + , m_seperator(new HorizontalSeperator(this)) , m_itemDelegate(new ItemDelegate(m_deviceListview)) + , m_bottomSeperator(new HorizontalSeperator(this)) { initData(); initUi(); @@ -201,15 +203,11 @@ void BluetoothAdapterItem::onAdapterNameChanged(const QString name) void BluetoothAdapterItem::updateIconTheme(DGuiApplicationHelper::ColorType type) { - if (type == DGuiApplicationHelper::LightType) { + if (type == DGuiApplicationHelper::LightType) m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh_dark.svg"); - //浅色主题蓝牙界面控件分割线颜色 - m_Separator->setColor(QColor(0, 0, 0, 0.1 * 255)); - } else { + else m_refreshBtn->setRotateIcon(":/wireless/resources/wireless/refresh.svg"); - //深色主题蓝牙界面控件分割线颜色 - m_Separator->setColor(QColor(255, 255, 255, 0.1 * 255)); - } + setItemHoverColor(); } @@ -346,8 +344,9 @@ void BluetoothAdapterItem::initUi() mainLayout->addWidget(m_adapterLabel); mainLayout->addSpacing(2); - mainLayout->addWidget(m_Separator); + mainLayout->addWidget(m_seperator); mainLayout->addWidget(m_deviceListview); + mainLayout->addWidget(m_bottomSeperator); updateIconTheme(DGuiApplicationHelper::instance()->themeType()); if (m_adapter->discover()) { @@ -379,6 +378,7 @@ void BluetoothAdapterItem::initConnect() initData(); m_refreshBtn->setVisible(state); m_deviceListview->setVisible(state); + m_seperator->setVisible(state); m_adapterStateBtn->setChecked(state); m_adapterStateBtn->setEnabled(true); emit adapterPowerChanged(); @@ -388,6 +388,7 @@ void BluetoothAdapterItem::initConnect() m_deviceItems.clear(); m_deviceModel->clear(); m_deviceListview->setVisible(false); + m_seperator->setVisible(false); m_adapterStateBtn->setEnabled(false); m_refreshBtn->setVisible(state); emit requestSetAdapterPower(m_adapter, state); diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.h b/plugins/bluetooth/componments/bluetoothadapteritem.h index 1b9eaf748..94bfb95df 100644 --- a/plugins/bluetooth/componments/bluetoothadapteritem.h +++ b/plugins/bluetooth/componments/bluetoothadapteritem.h @@ -49,6 +49,7 @@ class Adapter; class SettingLabel; class QStandardItemModel; class RefreshButton; +class HorizontalSeperator; const QString LightString = QString(":/light/buletooth_%1_light.svg"); const QString DarkString = QString(":/dark/buletooth_%1_dark.svg"); @@ -145,7 +146,8 @@ private: bool m_showUnnamedDevices; QMap m_deviceItems; - HorizontalSeperator *m_Separator; + HorizontalSeperator *m_seperator; + HorizontalSeperator *m_bottomSeperator; }; #endif // BLUETOOTHADAPTERITEM_H diff --git a/plugins/bluetooth/componments/bluetoothapplet.cpp b/plugins/bluetooth/componments/bluetoothapplet.cpp index 99feca01a..b57edf460 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.cpp +++ b/plugins/bluetooth/componments/bluetoothapplet.cpp @@ -27,11 +27,6 @@ #include "adapter.h" #include "bluetoothadapteritem.h" -#include -#include -#include -#include - #include #include #include @@ -39,35 +34,10 @@ #include #include -/** - * @brief HorizontalSeperator::HorizontalSeperator 蓝牙界面控件分割线,高度值初始化为2个像素 - * @param parent - */ -HorizontalSeperator::HorizontalSeperator(QWidget *parent) - : QWidget(parent), - m_color(0, 0, 0, 0.1*255) -{ - setFixedHeight(2); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); -} - -/** - * @brief HorizontalSeperator::setColor 蓝牙界面控件分割线背景颜色设置 - * @param color 颜色值 - */ -void HorizontalSeperator::setColor(const QColor color) -{ - m_color = color; - update(); -} - -void HorizontalSeperator::paintEvent(QPaintEvent *e) -{ - QWidget::paintEvent(e); - - QPainter painter(this); - painter.fillRect(rect(), m_color); -} +#include +#include +#include +#include SettingLabel::SettingLabel(QString text, QWidget *parent) : QWidget(parent) @@ -136,7 +106,6 @@ BluetoothApplet::BluetoothApplet(QWidget *parent) , m_settingLabel(new SettingLabel(tr("Bluetooth settings"), this)) , m_mainLayout(new QVBoxLayout(this)) , m_contentLayout(new QVBoxLayout(m_contentWidget)) - , m_Separator(new HorizontalSeperator(this)) { initUi(); initConnect(); @@ -205,7 +174,7 @@ void BluetoothApplet::onAdapterAdded(Adapter *adapter) m_adapterItems.insert(adapter->id(), adapterItem); //插入分割线 - m_contentLayout->insertWidget(0, m_Separator, Qt::AlignTop | Qt::AlignVCenter); +// m_contentLayout->insertWidget(0, m_Separator, Qt::AlignTop | Qt::AlignVCenter); m_contentLayout->insertWidget(0, adapterItem, Qt::AlignTop | Qt::AlignVCenter); updateBluetoothPowerState(); updateSize(); @@ -297,13 +266,11 @@ void BluetoothApplet::updateIconTheme() { QPalette widgetBackgroud; QPalette scroareaBackgroud; - if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType){ + if(DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) widgetBackgroud.setColor(QPalette::Background, QColor(255, 255, 255, 0.03 * 255)); - m_Separator->setColor(QColor(0, 0, 0, 0.1 * 255)); - } else { + else widgetBackgroud.setColor(QPalette::Background, QColor(0, 0, 0, 0.03 * 255)); - m_Separator->setColor(QColor(255, 255, 255, 0.1 * 255)); - } + m_contentWidget->setAutoFillBackground(true); m_contentWidget->setPalette(widgetBackgroud); scroareaBackgroud.setColor(QPalette::Background, Qt::transparent); diff --git a/plugins/bluetooth/componments/bluetoothapplet.h b/plugins/bluetooth/componments/bluetoothapplet.h index 25b4d9c7f..e28ec541f 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.h +++ b/plugins/bluetooth/componments/bluetoothapplet.h @@ -45,22 +45,6 @@ DWIDGET_END_NAMESPACE DWIDGET_USE_NAMESPACE -class HorizontalSeperator : public QWidget -{ - Q_OBJECT - -public: - explicit HorizontalSeperator(QWidget *parent = nullptr); - - void setColor(const QColor color); - -protected: - void paintEvent(QPaintEvent *e); - -private: - QColor m_color; -}; - class SettingLabel : public QWidget { Q_OBJECT @@ -130,8 +114,7 @@ private: QVBoxLayout *m_contentLayout = nullptr; QStringList m_connectDeviceName; - QMap m_adapterItems; - HorizontalSeperator *m_Separator = nullptr; + QMap m_adapterItems; // 所有蓝牙适配器 }; #endif // BLUETOOTHAPPLET_H diff --git a/plugins/network/CMakeLists.txt b/plugins/network/CMakeLists.txt index 746365016..d630a4a68 100644 --- a/plugins/network/CMakeLists.txt +++ b/plugins/network/CMakeLists.txt @@ -6,7 +6,8 @@ project(${PLUGIN_NAME}) # Sources files file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp" "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp" - "../../frame/util/statebutton.h" "../../frame/util/statebutton.cpp") + "../../frame/util/statebutton.h" "../../frame/util/statebutton.cpp" + "../../frame/util/horizontalseperator.h" "../../frame/util/horizontalseperator.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/network/item/wireditem.cpp b/plugins/network/item/wireditem.cpp index c2061cb66..713df8da8 100644 --- a/plugins/network/item/wireditem.cpp +++ b/plugins/network/item/wireditem.cpp @@ -22,7 +22,7 @@ #include "constants.h" #include "wireditem.h" -#include "applet/horizontalseperator.h" +#include "util/horizontalseperator.h" #include "../widgets/tipswidget.h" #include "util/utils.h" #include "util/statebutton.h" diff --git a/plugins/network/networkitem.cpp b/plugins/network/networkitem.cpp index 038daab6e..80bc84874 100644 --- a/plugins/network/networkitem.cpp +++ b/plugins/network/networkitem.cpp @@ -183,18 +183,13 @@ void NetworkItem::setControlBackground() { QPalette backgroud; QColor separatorColor; - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) { + if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) backgroud.setColor(QPalette::Background, QColor(255, 255, 255, 0.03 * 255)); - separatorColor.setRgb(0, 0, 0, 0.1 * 255); - } else { + else backgroud.setColor(QPalette::Background, QColor(0, 0, 0, 0.03 * 255)); - separatorColor.setRgb(255, 255, 255, 0.1 * 255); - } + m_applet->setAutoFillBackground(true); m_applet->setPalette(backgroud); - m_firstSeparator->setColor(separatorColor); - m_secondSeparator->setColor(separatorColor); - m_thirdSeparator->setColor(separatorColor); } QWidget *NetworkItem::itemApplet() diff --git a/plugins/sound/CMakeLists.txt b/plugins/sound/CMakeLists.txt index 7f98cda8b..fd4fac0d9 100644 --- a/plugins/sound/CMakeLists.txt +++ b/plugins/sound/CMakeLists.txt @@ -4,7 +4,8 @@ set(PLUGIN_NAME "sound") project(${PLUGIN_NAME}) # Sources files -file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp" "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp") +file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp" "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp" + "../../frame/util/horizontalseperator.h" "../../frame/util/horizontalseperator.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) diff --git a/plugins/sound/componments/horizontalseparator.cpp b/plugins/sound/componments/horizontalseparator.cpp deleted file mode 100644 index 142862dd5..000000000 --- a/plugins/sound/componments/horizontalseparator.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: sbw - * - * Maintainer: sbw - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "horizontalseparator.h" - -#include - -/** - * @brief HorizontalSeparator::HorizontalSeparator 声音界面控件分割线,高度值初始化为2个像素 - * @param parent - */ -HorizontalSeparator::HorizontalSeparator(QWidget *parent) - : QWidget(parent) -{ - setFixedHeight(2); - setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); -} - -void HorizontalSeparator::setColor(const QColor color) -{ - m_color = color; - update(); -} - -void HorizontalSeparator::paintEvent(QPaintEvent *e) -{ - QWidget::paintEvent(e); - - QPainter painter(this); - painter.fillRect(rect(), m_color); -} diff --git a/plugins/sound/componments/horizontalseparator.h b/plugins/sound/componments/horizontalseparator.h deleted file mode 100644 index c62a3b0f0..000000000 --- a/plugins/sound/componments/horizontalseparator.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd. - * - * Author: sbw - * - * Maintainer: sbw - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef HORIZONTALSEPARATOR_H -#define HORIZONTALSEPARATOR_H - -#include - -class HorizontalSeparator : public QWidget -{ - Q_OBJECT - -public: - explicit HorizontalSeparator(QWidget *parent = 0); - - void setColor(const QColor color); - -protected: - void paintEvent(QPaintEvent *e); - -private: - QColor m_color; -}; - -#endif // HORIZONTALSEPARATOR_H diff --git a/plugins/sound/soundaccessible.h b/plugins/sound/soundaccessible.h index d83f42ad9..133ef367b 100644 --- a/plugins/sound/soundaccessible.h +++ b/plugins/sound/soundaccessible.h @@ -6,13 +6,11 @@ #include "soundapplet.h" #include "sinkinputwidget.h" #include "./componments/volumeslider.h" -#include "./componments/horizontalseparator.h" SET_BUTTON_ACCESSIBLE(SoundItem, "plugin-sounditem") SET_FORM_ACCESSIBLE(SoundApplet, "soundapplet") SET_FORM_ACCESSIBLE(SinkInputWidget, "sinkinputwidget") SET_SLIDER_ACCESSIBLE(VolumeSlider, "volumeslider") -SET_FORM_ACCESSIBLE(HorizontalSeparator, "horizontalseparator") QAccessibleInterface *soundAccessibleFactory(const QString &classname, QObject *object) { @@ -22,7 +20,6 @@ QAccessibleInterface *soundAccessibleFactory(const QString &classname, QObject * USE_ACCESSIBLE(classname, SoundApplet); USE_ACCESSIBLE(classname, SinkInputWidget); USE_ACCESSIBLE(classname, VolumeSlider); - USE_ACCESSIBLE(classname, HorizontalSeparator); return interface; } diff --git a/plugins/sound/soundapplet.cpp b/plugins/sound/soundapplet.cpp index ef476593f..fd5d91760 100644 --- a/plugins/sound/soundapplet.cpp +++ b/plugins/sound/soundapplet.cpp @@ -21,7 +21,7 @@ #include "soundapplet.h" #include "sinkinputwidget.h" -#include "componments/horizontalseparator.h" +#include "util/horizontalseperator.h" #include "../widgets/tipswidget.h" #include "../frame/util/imageutil.h" #include "util/utils.h" @@ -140,8 +140,8 @@ SoundApplet::SoundApplet(QWidget *parent) , m_volumeIconMax(new QLabel) , m_volumeSlider(new VolumeSlider) , m_soundShow(new TipsWidget) - , m_separator(new HorizontalSeparator(this)) - , m_secondSeparator(new HorizontalSeparator(this)) + , m_seperator(new HorizontalSeperator(this)) + , m_secondSeperator(new HorizontalSeperator(this)) , m_deviceLabel(nullptr) , m_audioInter(new DBusAudio("com.deepin.daemon.Audio", "/com/deepin/daemon/Audio", QDBusConnection::sessionBus(), this)) , m_defSinkInter(nullptr) @@ -163,15 +163,11 @@ void SoundApplet::setControlBackground() { QPalette soundAppletBackgroud; QPalette listViewBackgroud = m_listView->palette(); - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) { + if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) soundAppletBackgroud.setColor(QPalette::Background, QColor(255, 255, 255, 0.03 * 255)); - m_separator->setColor(QColor(0, 0, 0, 0.1 * 255)); - m_secondSeparator->setColor(QColor(0, 0, 0, 0.1 * 255)); - } else { + else soundAppletBackgroud.setColor(QPalette::Background, QColor(0, 0, 0, 0.03 * 255)); - m_separator->setColor(QColor(255, 255, 255, 0.1 * 255)); - m_secondSeparator->setColor(QColor(255, 255, 255, 0.1 * 255)); - } + this->setAutoFillBackground(true); this->setPalette(soundAppletBackgroud); listViewBackgroud.setColor(QPalette::Base, Qt::transparent); @@ -232,7 +228,7 @@ void SoundApplet::initUi() QVBoxLayout *deviceLineLayout = new QVBoxLayout; deviceLineLayout->addLayout(deviceLayout); - deviceLineLayout->addWidget(m_separator); + deviceLineLayout->addWidget(m_seperator); deviceLineLayout->setMargin(0); deviceLineLayout->setSpacing(DEVICE_SPACING); @@ -250,7 +246,7 @@ void SoundApplet::initUi() //音频界面添加第二个分割线 QVBoxLayout *volumeLineLayout = new QVBoxLayout; volumeLineLayout->addLayout(volumeCtrlLayout); - volumeLineLayout->addWidget(m_secondSeparator); + volumeLineLayout->addWidget(m_secondSeperator); volumeLineLayout->setMargin(0); m_volumeBtn->setFixedSize(ICON_SIZE, ICON_SIZE); @@ -392,7 +388,7 @@ void SoundApplet::sinkInputsChanged() } for (auto input : m_audioInter->sinkInputs()) { - appLayout->addWidget(new HorizontalSeparator); + appLayout->addWidget(new HorizontalSeperator(this)); SinkInputWidget *si = new SinkInputWidget(input.path()); appLayout->addWidget(si); @@ -740,7 +736,7 @@ void SoundApplet::updateListHeight() int viewHeight = visualHeight + m_listView->spacing() * count * 2 + listMargin; // 设备信息高度 = 设备标签 + 分隔线 + 滚动条 + 间隔 int labelHeight = m_deviceLabel->height() > m_soundShow->height() ? m_deviceLabel->height() : m_soundShow->height(); - int infoHeight = labelHeight + m_separator->height() + m_volumeSlider->height() + m_centralLayout->spacing() * 3 + DEVICE_SPACING; + int infoHeight = labelHeight + m_seperator->height() + m_volumeSlider->height() + m_centralLayout->spacing() * 3 + DEVICE_SPACING; int margain = m_centralLayout->contentsMargins().top() + m_centralLayout->contentsMargins().bottom(); //整个界面高度 = 显示声音设备列表高度 + 设备信息高度 + 边距 int totalHeight = viewHeight + infoHeight + margain; diff --git a/plugins/sound/soundapplet.h b/plugins/sound/soundapplet.h index e706b7836..0064a79c4 100644 --- a/plugins/sound/soundapplet.h +++ b/plugins/sound/soundapplet.h @@ -40,7 +40,7 @@ DWIDGET_USE_NAMESPACE using DBusAudio = com::deepin::daemon::Audio; using DBusSink = com::deepin::daemon::audio::Sink; -class HorizontalSeparator; +class HorizontalSeperator; class QGSettings; namespace Dock{ @@ -156,8 +156,8 @@ private: VolumeSlider *m_volumeSlider; Dock::TipsWidget *m_soundShow; QVBoxLayout *m_centralLayout; - HorizontalSeparator *m_separator; - HorizontalSeparator *m_secondSeparator; + HorizontalSeperator *m_seperator; + HorizontalSeperator *m_secondSeperator; Dock::TipsWidget *m_deviceLabel; DBusAudio *m_audioInter;