From 512a19e52817143b1518b0bf7f9691f85072d89f Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 10 Feb 2018 21:57:07 +0100 Subject: [PATCH] VerticalTabs: Draw background activity indicator --- src/plugins/VerticalTabs/tablistdelegate.cpp | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/plugins/VerticalTabs/tablistdelegate.cpp b/src/plugins/VerticalTabs/tablistdelegate.cpp index 1246dcdb6..736dbcfbc 100644 --- a/src/plugins/VerticalTabs/tablistdelegate.cpp +++ b/src/plugins/VerticalTabs/tablistdelegate.cpp @@ -56,6 +56,8 @@ void TabListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio const int height = opt.rect.height(); const int center = height / 2 + opt.rect.top(); + painter->setRenderHint(QPainter::Antialiasing); + // Draw background style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, w); @@ -87,6 +89,25 @@ void TabListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio painter->drawPixmap(audioRect, audioMuted ? TabIcon::data()->audioMutedPixmap : TabIcon::data()->audioPlayingPixmap); } + + // Draw background activity indicator + const bool backgroundActivity = index.data(TabModel::BackgroundActivityRole).toBool(); + if (backgroundActivity) { + QSize activitySize(7, 7); + QPoint pos(iconRect.center().x() - activitySize.width() / 2 + 1, iconRect.bottom() - 2); + QRect activityRect(pos, activitySize); + + QColor c1 = opt.palette.color(QPalette::Window); + c1.setAlpha(180); + painter->setPen(Qt::transparent); + painter->setBrush(c1); + painter->drawEllipse(activityRect); + + const QRect r2 = activityRect.adjusted(1, 1, -1, -1); + painter->setPen(Qt::transparent); + painter->setBrush(opt.palette.color(QPalette::Text)); + painter->drawEllipse(r2); + } } QSize TabListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const