mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
VerticalTabs: Draw background activity indicator
This commit is contained in:
parent
315218db9d
commit
512a19e528
@ -56,6 +56,8 @@ void TabListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &optio
|
|||||||
const int height = opt.rect.height();
|
const int height = opt.rect.height();
|
||||||
const int center = height / 2 + opt.rect.top();
|
const int center = height / 2 + opt.rect.top();
|
||||||
|
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing);
|
||||||
|
|
||||||
// Draw background
|
// Draw background
|
||||||
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, w);
|
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);
|
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
|
QSize TabListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
|
Loading…
Reference in New Issue
Block a user