mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
ComboTabBar: Improve drop indicator drawing
Code was taken and modified from KFilePlacesView
This commit is contained in:
parent
546e777c7c
commit
4c494ebfb0
@ -1276,13 +1276,25 @@ void TabBarHelper::paintEvent(QPaintEvent* event)
|
|||||||
|
|
||||||
// Draw drop indicator
|
// Draw drop indicator
|
||||||
if (m_dropIndicatorIndex != -1) {
|
if (m_dropIndicatorIndex != -1) {
|
||||||
p.setPen(QPen(palette().text(), 3));
|
const QRect tr = tabRect(m_dropIndicatorIndex);
|
||||||
QRect r = tabRect(m_dropIndicatorIndex);
|
QRect r;
|
||||||
if (m_dropIndicatorPosition == ComboTabBar::BeforeTab) {
|
if (m_dropIndicatorPosition == ComboTabBar::BeforeTab) {
|
||||||
r.moveLeft(r.x() - 1);
|
r = QRect(qMax(0, tr.left() - 1), tr.top(), 3, tr.height());
|
||||||
p.drawLine(r.topLeft(), r.bottomLeft());
|
|
||||||
} else {
|
} else {
|
||||||
p.drawLine(r.topRight(), r.bottomRight());
|
r = QRect(tr.right(), tr.top() - 3, 3, tr.height());
|
||||||
|
}
|
||||||
|
// Modified code from KFilePlacesView
|
||||||
|
QColor color = palette().brush(QPalette::Normal, QPalette::Highlight).color();
|
||||||
|
const int x = (r.left() + r.right()) / 2;
|
||||||
|
const int thickness = qRound(r.width() / 2.0);
|
||||||
|
int alpha = 255;
|
||||||
|
const int alphaDec = alpha / (thickness + 1);
|
||||||
|
for (int i = 0; i < thickness; i++) {
|
||||||
|
color.setAlpha(alpha);
|
||||||
|
alpha -= alphaDec;
|
||||||
|
p.setPen(color);
|
||||||
|
p.drawLine(x - i, r.top(), x - i, r.bottom());
|
||||||
|
p.drawLine(x + i, r.top(), x + i, r.bottom());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user