diff --git a/frame/util/multiscreenworker.h b/frame/util/multiscreenworker.h index 5d85a3f1e..2cae2e78e 100644 --- a/frame/util/multiscreenworker.h +++ b/frame/util/multiscreenworker.h @@ -21,7 +21,7 @@ #include #include -#define WINDOWMARGIN ((m_displayMode == Dock::Efficient) ? 0 : 10) +#define WINDOWMARGIN ((m_displayMode == Dock::Efficient) ? 0 : 5) #define ANIMATIONTIME 300 #define FREE_POINT(p) if (p) {\ delete p;\ diff --git a/frame/window/traymanagerwindow.cpp b/frame/window/traymanagerwindow.cpp index 7e547b031..53a0812ea 100644 --- a/frame/window/traymanagerwindow.cpp +++ b/frame/window/traymanagerwindow.cpp @@ -393,9 +393,8 @@ void TrayManagerWindow::resetChildWidgetSize() int dateTimeHeight = m_appPluginDatetimeWidget->height() - - m.top() - m.bottom() - trayHeight; m_dateTimeWidget->setFixedSize(dateTimeWidth, dateTimeHeight); m_systemPluginWidget->setFixedSize(m_systemPluginWidget->suitableSize()); - int contentSpace = qMin(MAXDIFF, qMax(((Utils::isDraging() ? height() : (int)m_windowFashionSize) - MINHIGHT), 0)) + MINSPACE; - m_mainLayout->setContentsMargins(contentSpace, contentSpace, contentSpace, contentSpace); - m_mainLayout->setSpacing(contentSpace); + m_mainLayout->setContentsMargins(SINGLEROWSPACE, SINGLEROWSPACE, SINGLEROWSPACE, SINGLEROWSPACE); + m_mainLayout->setSpacing(SINGLEROWSPACE); // 调整插件和日期窗体的位置显示,这里没有用到布局,是因为在调整任务栏位置的时候, // 随着布局方向的改变,显示有很大的问题 @@ -537,8 +536,8 @@ void TrayManagerWindow::paintEvent(QPaintEvent *event) painter.save(); painter.setRenderHint(QPainter::Antialiasing); painter.setClipPath(path); - painter.fillRect(rect().adjusted(1, 1, -1, -1), maskColor(102)); - painter.setPen(maskColor(110)); + painter.fillRect(rect().adjusted(1, 1, -1, -1), maskColor(255 * 0.1)); + painter.setPen(maskColor(255 * 0.15)); painter.drawPath(path); painter.restore(); diff --git a/frame/window/windowmanager.cpp b/frame/window/windowmanager.cpp index c247a1c37..95c3e4624 100644 --- a/frame/window/windowmanager.cpp +++ b/frame/window/windowmanager.cpp @@ -816,7 +816,7 @@ void WindowManager::onRequestNotifyWindowManager() } XcbMisc::instance()->set_strut_partial(static_cast(mainWindow->winId()), orientation, - static_cast(strut + WINDOWMARGIN * ratio), // 设置窗口与屏幕边缘距离,需要乘缩放 + static_cast(strut - WINDOWMARGIN * ratio), // 设置窗口与屏幕边缘距离,需要乘缩放 static_cast(strutStart), // 设置任务栏起点坐标(上下为x,左右为y) static_cast(strutEnd)); // 设置任务栏终点坐标(上下为x,左右为y) } diff --git a/plugins/pluginmanager/quicksettingitem.cpp b/plugins/pluginmanager/quicksettingitem.cpp index 36f3a957b..2151bfd43 100644 --- a/plugins/pluginmanager/quicksettingitem.cpp +++ b/plugins/pluginmanager/quicksettingitem.cpp @@ -39,6 +39,10 @@ #include #include #include +#include +#include +#include +#include #define ICONWIDTH 24 #define ICONHEIGHT 24 @@ -93,12 +97,22 @@ void QuickSettingItem::paintEvent(QPaintEvent *e) painter.setClipPath(path); // 绘制背景色 QColor backColor(Qt::white); - if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::DarkType) { - backColor = Qt::black; - } - backColor.setAlphaF(0.5); + backColor.setAlphaF(0.1); + DPalette dpa = DPaletteHelper::instance()->palette(this); painter.fillRect(rect(), backColor); + + QColor borderColor(Qt::black); + borderColor.setAlphaF(0.2); + if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) { + borderColor = QColor(Qt::white); + borderColor.setAlphaF(0.15); + } + + painter.save(); + painter.setPen(borderColor); + painter.drawRoundedRect(rect(), RADIUS, RADIUS); + painter.restore(); } QColor QuickSettingItem::foregroundColor() const diff --git a/plugins/pluginmanager/standardquickitem.cpp b/plugins/pluginmanager/standardquickitem.cpp index 233fc3e84..9614cea24 100644 --- a/plugins/pluginmanager/standardquickitem.cpp +++ b/plugins/pluginmanager/standardquickitem.cpp @@ -100,6 +100,7 @@ QWidget *StandardQuickItem::iconWidget(QWidget *parent) layout->setAlignment(Qt::AlignVCenter); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); + layout->addSpacing(6); QLabel *imageLabel = new QLabel(widget); imageLabel->setObjectName("imageLabel"); imageLabel->setFixedHeight(ICONHEIGHT); @@ -113,7 +114,7 @@ QWidget *StandardQuickItem::iconWidget(QWidget *parent) labelText->setFixedWidth(70); updatePluginName(labelText); layout->addWidget(imageLabel); - layout->addSpacing(7); + layout->addSpacing(4); layout->addWidget(labelText); } diff --git a/widgets/slidercontainer.cpp b/widgets/slidercontainer.cpp index 44e114281..5374ab0a1 100644 --- a/widgets/slidercontainer.cpp +++ b/widgets/slidercontainer.cpp @@ -13,6 +13,7 @@ #include #include #include +#include DWIDGET_USE_NAMESPACE @@ -24,6 +25,7 @@ class SliderIconWidget : public QWidget : QWidget(parent) , m_iconSize(QSize(24, 24)) , m_shadowSize(QSize()) + , m_isEnter(false) {} void updateData(const QIcon &icon, const QSize &iconSize, const QSize &shadowSize) @@ -40,6 +42,20 @@ class SliderIconWidget : public QWidget update(); } + void enterEvent(QEvent *event) override + { + m_isEnter = true; + QWidget::enterEvent(event); + update(); + } + + void leaveEvent(QEvent *event) override + { + m_isEnter = false; + QWidget::leaveEvent(event); + update(); + } + protected: void paintEvent(QPaintEvent *e) override; @@ -47,6 +63,7 @@ class SliderIconWidget : public QWidget QIcon m_icon; QSize m_iconSize; QSize m_shadowSize; + bool m_isEnter; }; void SliderIconWidget::paintEvent(QPaintEvent *e) @@ -60,8 +77,12 @@ void SliderIconWidget::paintEvent(QPaintEvent *e) // 绘制圆形背景 painter.setPen(Qt::NoPen); // 获取阴影部分背景颜色 - DPalette dpa = DPaletteHelper::instance()->palette(this); - painter.setBrush(dpa.brush(DPalette::ColorRole::Midlight)); + QColor backColor = (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType ? Qt::black : Qt::white); + if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType) + backColor.setAlphaF(m_isEnter ? 0.2 : 0.1); + else + backColor.setAlphaF(m_isEnter ? 0.1 : 0.2); + painter.setBrush(backColor); int x = (rect().width() - m_shadowSize.width() ) / 2; int y = (rect().height() - m_shadowSize.height() ) / 2; painter.drawEllipse(QRect(x, y, m_shadowSize.width(), m_shadowSize.height())); @@ -270,23 +291,29 @@ void SliderProxyStyle::drawRoundSlider(QPainter *painter, QRect rectGroove, QRec QColor color = wigdet->isEnabled() ? (DGuiApplicationHelper::DarkType == DGuiApplicationHelper::instance()->themeType() ? Qt::white : Qt::black) : Qt::gray; // 此处中绘制圆形滑动条,需要绘制圆角,圆角大小为其高度的一半 int radius = rectGroove.height() / 2; - + // 此处绘制滑条的全长 - QBrush allBrush(QColor(190,190,190)); + QColor allBrush = (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::LightType ? Qt::black : Qt::white); + allBrush.setAlphaF( 0.15); + QPainterPath allPathGroove; allPathGroove.addRoundedRect(rectGroove, radius, radius); painter->fillPath(allPathGroove, allBrush); // 已经滑动过的区域 - QBrush brush(color); + if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::ColorType::DarkType) { + color.setAlphaF(0.6); + } + QPainterPath pathGroove; int handleSize = qMin(rectHandle.width(), rectHandle.height()); rectGroove.setWidth(rectHandle.x() + (rectHandle.width() - handleSize) / 2); pathGroove.addRoundedRect(rectGroove, radius, radius); - painter->fillPath(pathGroove, brush); + painter->fillPath(pathGroove, color); // 绘制滑块,因为滑块是正圆形,而它本来的区域是一个长方形区域,因此,需要计算当前 // 区域的正中心区域,将其作为一个正方形区域来绘制圆形滑块 + color.setAlphaF(1.0); int x = rectHandle.x() + (rectHandle.width() - handleSize) / 2; int y = rectHandle.y() + (rectHandle.height() - handleSize) / 2; rectHandle.setX(x); @@ -296,5 +323,5 @@ void SliderProxyStyle::drawRoundSlider(QPainter *painter, QRect rectGroove, QRec QPainterPath pathHandle; pathHandle.addEllipse(rectHandle); - painter->fillPath(pathHandle, brush); + painter->fillPath(pathHandle, color); }