summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2009-10-08 19:10:01 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2009-10-08 19:21:53 (GMT)
commit8c4edbd04f350294462fd689748de2dd7cc84d47 (patch)
tree0040c308fe3a5751ec04c27367a8110c5954912c /src/gui/widgets
parent9551b8c349ce4e15a57c24a2408ee1b73c2b7510 (diff)
downloadQt-8c4edbd04f350294462fd689748de2dd7cc84d47.zip
Qt-8c4edbd04f350294462fd689748de2dd7cc84d47.tar.gz
Qt-8c4edbd04f350294462fd689748de2dd7cc84d47.tar.bz2
Fix tab widget painting in QGtkStyle with reverse
This also adds QStyleOptionTabWidgetFrameV2 so that we do not have to do ugly hacks in the style to obtain it. Task-number: QTBUG-5187 Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qtabwidget.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp
index 0c89a72..d22bd54 100644
--- a/src/gui/widgets/qtabwidget.cpp
+++ b/src/gui/widgets/qtabwidget.cpp
@@ -313,7 +313,16 @@ void QTabWidget::initStyleOption(QStyleOptionTabWidgetFrame *option) const
: QTabBar::TriangularEast;
break;
}
+
option->tabBarSize = t;
+
+ if (QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<QStyleOptionTabWidgetFrameV2*>(option)) {
+ QRect tbRect = tabBar()->geometry();
+ QRect selectedTabRect = tabBar()->tabRect(tabBar()->currentIndex());
+ tabframe->tabBarRect = tbRect;
+ selectedTabRect.moveTopLeft(selectedTabRect.topLeft() + tbRect.topLeft());
+ tabframe->selectedTabRect = selectedTabRect;
+ }
}
/*!
@@ -756,7 +765,7 @@ void QTabWidget::setUpLayout(bool onlyCheck)
if (onlyCheck && !d->dirty)
return; // nothing to do
- QStyleOptionTabWidgetFrame option;
+ QStyleOptionTabWidgetFrameV2 option;
initStyleOption(&option);
// this must be done immediately, because QWidgetItem relies on it (even if !isVisible())
@@ -1186,7 +1195,8 @@ void QTabWidget::paintEvent(QPaintEvent *)
return;
}
QStylePainter p(this);
- QStyleOptionTabWidgetFrame opt;
+
+ QStyleOptionTabWidgetFrameV2 opt;
initStyleOption(&opt);
opt.rect = d->panelRect;
p.drawPrimitive(QStyle::PE_FrameTabWidget, opt);