forked from qt-creator/qt-creator
Mor polish for the sidebar
This commit is contained in:
@@ -242,31 +242,30 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
|
||||
|
||||
if (selected) {
|
||||
//background
|
||||
painter->fillRect(rect, QColor(220, 220, 220));
|
||||
painter->save();
|
||||
QLinearGradient grad(rect.topLeft(), rect.topRight());
|
||||
grad.setColorAt(0, QColor(255, 255, 255, 160));
|
||||
grad.setColorAt(1, QColor(255, 255, 255, 210));
|
||||
painter->fillRect(rect.adjusted(0, 0, 0, -1), grad);
|
||||
painter->restore();
|
||||
|
||||
//highlight
|
||||
painter->setPen(QColor(255, 255, 255, 150));
|
||||
painter->drawLine(rect.bottomLeft() - QPoint(-1, 1), rect.bottomRight() - QPoint(0,1));
|
||||
painter->drawLine(rect.topRight(), rect.bottomRight());
|
||||
|
||||
//shadow
|
||||
painter->setPen(QColor(255, 255, 255, 50));
|
||||
painter->drawLine(rect.topLeft() - QPoint(0,2), rect.topRight() - QPoint(0,2));
|
||||
painter->setPen(QColor(0, 0, 0, 150));
|
||||
painter->drawLine(rect.topLeft() - QPoint(0,1), rect.topRight() - QPoint(0,1));
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
painter->setPen(QColor(0, 0, 0, 100));
|
||||
painter->drawLine(rect.topLeft(), rect.topRight());
|
||||
painter->setPen(QColor(0, 0, 0, 40));
|
||||
painter->drawLine(rect.topLeft() + QPoint(0,1), rect.topRight() + QPoint(0,1));
|
||||
painter->drawLine(rect.topLeft() + QPoint(1,1), rect.bottomLeft() + QPoint(1,0));
|
||||
painter->setPen(QColor(0, 0, 0, 20));
|
||||
painter->drawLine(rect.topLeft() + QPoint(0,2), rect.topRight() + QPoint(0,2));
|
||||
painter->drawLine(rect.topLeft() + QPoint(2,1), rect.bottomLeft() + QPoint(2,0));
|
||||
painter->setPen(QColor(0, 0, 0, 150));
|
||||
//shadows
|
||||
painter->setPen(QColor(0, 0, 0, 110));
|
||||
painter->drawLine(rect.topLeft() + QPoint(1,-1), rect.topRight() - QPoint(0,1));
|
||||
painter->drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
painter->setPen(QColor(255, 255, 255, 50));
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(0,1), rect.bottomRight() + QPoint(0,1));
|
||||
painter->setPen(QColor(0, 0, 0, 40));
|
||||
painter->drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
painter->setPen(QColor(0, 0, 0, 10));
|
||||
painter->drawLine(rect.topLeft() + QPoint(1, 1), rect.bottomLeft() + QPoint(1, -1));
|
||||
|
||||
//highlights
|
||||
painter->setPen(QColor(255, 255, 255, 90));
|
||||
painter->drawLine(rect.topLeft() + QPoint(1, -2), rect.topRight() - QPoint(0,2));
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(1, 1), rect.bottomRight() + QPoint(0,1));
|
||||
painter->setPen(QColor(255, 255, 255, 160));
|
||||
painter->drawLine(rect.topLeft() + QPoint(1, 0), rect.topRight());
|
||||
painter->drawLine(rect.topRight() + QPoint(0, 1), rect.bottomRight() - QPoint(0, 1));
|
||||
painter->drawLine(rect.bottomLeft() + QPoint(1,-1), rect.bottomRight()-QPoint(0,1));
|
||||
}
|
||||
|
||||
QString tabText(this->tabText(tabIndex));
|
||||
@@ -458,6 +457,9 @@ void FancyTabWidget::paintEvent(QPaintEvent *event)
|
||||
QColor light = Utils::StyleHelper::sidebarHighlight();
|
||||
painter.setPen(light);
|
||||
painter.drawLine(rect.bottomLeft(), rect.bottomRight());
|
||||
painter.setPen(QColor(0, 0, 0, 20));
|
||||
painter.drawLine(rect.topLeft() + QPoint(1, 0), rect.bottomLeft() + QPoint(1, 0));
|
||||
|
||||
setContentsMargins(0, 0, 0, 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user