modified paint effects

Change-Id: I0e58eb65b3e997201e7c76532c9c29253171e8e1
This commit is contained in:
石博文 2016-06-23 10:50:26 +08:00 committed by Hualet Wang
parent 1c1228a875
commit 61eb74dd48
3 changed files with 21 additions and 7 deletions

View File

@ -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);

View File

@ -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;"
"}");

View File

@ -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;");