From 61eb74dd48f3cac070f82be17e0f78f1e8065e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E5=8D=9A=E6=96=87?= Date: Thu, 23 Jun 2016 10:50:26 +0800 Subject: [PATCH] modified paint effects Change-Id: I0e58eb65b3e997201e7c76532c9c29253171e8e1 --- frame/item/appitem.cpp | 24 +++++++++++++++++++----- frame/panel/mainpanel.cpp | 2 +- plugins/datetime/datetimeplugin.cpp | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index a38672c58..ae9e0cebc 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -67,13 +67,27 @@ void AppItem::paintEvent(QPaintEvent *e) const QRect itemRect = rect(); // draw background - const QRect backgroundRect = itemRect.marginsRemoved(QMargins(3, 3, 3, 3)); + const QRect backgroundRect = itemRect.marginsRemoved(QMargins(1, 2, 1, 2)); if (m_itemEntry->active()) - painter.fillRect(backgroundRect, Qt::blue); + { + painter.fillRect(backgroundRect, QColor(70, 100, 200, 120)); + + const int activeLineWidth = 3; + QRect activeRect = backgroundRect; + switch (DockPosition) + { + case Top: activeRect.setBottom(activeRect.top() + activeLineWidth); break; + case Bottom: activeRect.setTop(activeRect.bottom() - activeLineWidth); break; + case Left: activeRect.setRight(activeRect.left() + activeLineWidth); break; + case Right: activeRect.setLeft(activeRect.right() - activeLineWidth); break; + } + + painter.fillRect(activeRect, QColor(47, 168, 247)); + } else if (!m_titles.isEmpty()) - painter.fillRect(backgroundRect, Qt::cyan); - else - painter.fillRect(backgroundRect, Qt::gray); + painter.fillRect(backgroundRect, QColor(255, 255, 255, 50)); +// else +// painter.fillRect(backgroundRect, Qt::gray); // draw icon painter.drawPixmap(itemRect.center() - m_icon.rect().center(), m_icon); diff --git a/frame/panel/mainpanel.cpp b/frame/panel/mainpanel.cpp index 67f935747..5933aca83 100644 --- a/frame/panel/mainpanel.cpp +++ b/frame/panel/mainpanel.cpp @@ -22,7 +22,7 @@ MainPanel::MainPanel(QWidget *parent) setObjectName("MainPanel"); setStyleSheet("QWidget #MainPanel {" "border:none;" - "background-color:green;" + "background-color:rgba(0, 0, 0, .6);" "border-radius:5px 5px 5px 5px;" "}"); diff --git a/plugins/datetime/datetimeplugin.cpp b/plugins/datetime/datetimeplugin.cpp index 9998c231c..d0a68432d 100644 --- a/plugins/datetime/datetimeplugin.cpp +++ b/plugins/datetime/datetimeplugin.cpp @@ -7,7 +7,7 @@ DatetimePlugin::DatetimePlugin(QObject *parent) { m_timeLabel->setAlignment(Qt::AlignCenter); m_timeLabel->setStyleSheet("color:white;" - "background-color:black;" +// "background-color:black;" "padding:5px;" "font-size:12px;");