Format code

This commit is contained in:
Jonas Kvinge 2020-05-08 18:34:33 +02:00
parent f5983d5f10
commit 6ef69f6b32
1 changed files with 8 additions and 8 deletions

View File

@ -232,23 +232,23 @@ class FancyTabBar: public QTabBar {
if (verticalTextTabs) { if (verticalTextTabs) {
m = QTransform::fromTranslate(tabrect.left(), tabrect.bottom()); m = QTransform::fromTranslate(tabrect.left(), tabrect.bottom());
m.rotate(-90); m.rotate(-90);
textFlags = Qt::AlignLeft | Qt::AlignVCenter ; textFlags = Qt::AlignLeft | Qt::AlignVCenter;
iconFlags = Qt::AlignLeft | Qt::AlignVCenter; iconFlags = Qt::AlignLeft | Qt::AlignVCenter;
tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size()); tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size());
tabrectText = tabrectLabel; tabrectText = tabrectLabel;
tabrectText.translate(30,0); tabrectText.translate(30, 0);
} }
else { else {
m = QTransform::fromTranslate(tabrect.left(), tabrect.top()); m = QTransform::fromTranslate(tabrect.left(), tabrect.top());
textFlags = Qt::AlignHCenter | Qt::AlignBottom ; textFlags = Qt::AlignHCenter | Qt::AlignBottom;
iconFlags = Qt::AlignHCenter | Qt::AlignTop; iconFlags = Qt::AlignHCenter | Qt::AlignTop;
tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size()); tabrectLabel = QRect(QPoint(0, 0), m.mapRect(tabrect).size());
tabrectText = tabrectLabel; tabrectText = tabrectLabel;
tabrectText.translate(0,-5); tabrectText.translate(0, -5);
} }
p.setTransform(m); p.setTransform(m);
@ -275,14 +275,14 @@ class FancyTabBar: public QTabBar {
if (verticalTextTabs) { if (verticalTextTabs) {
tabrectIcon = tabrectLabel; tabrectIcon = tabrectLabel;
tabrectIcon.setSize(FancyTabWidget::IconSize_SmallSidebar); tabrectIcon.setSize(FancyTabWidget::IconSize_SmallSidebar);
tabrectIcon.translate(PADDING,PADDING); tabrectIcon.translate(PADDING, PADDING);
} }
else { else {
tabrectIcon = tabrectLabel; tabrectIcon = tabrectLabel;
tabrectIcon.setSize(FancyTabWidget::IconSize_LargeSidebar); tabrectIcon.setSize(FancyTabWidget::IconSize_LargeSidebar);
// Center the icon // Center the icon
const int moveRight = (FancyTabWidget::TabSize_LargeSidebar.width() - FancyTabWidget::IconSize_LargeSidebar.width() -1)/2; const int moveRight = (FancyTabWidget::TabSize_LargeSidebar.width() - FancyTabWidget::IconSize_LargeSidebar.width() -1) / 2;
tabrectIcon.translate(moveRight,PADDING); tabrectIcon.translate(moveRight, PADDING);
} }
tabIcon(index).paint(&p, tabrectIcon, iconFlags); tabIcon(index).paint(&p, tabrectIcon, iconFlags);
p.restore(); p.restore();