1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

VerticalTabs: Draw background activity indicator

This commit is contained in:
David Rosca 2018-02-10 21:57:07 +01:00
parent 315218db9d
commit 512a19e528
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

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