diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-10-30 10:56:16 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-10-30 10:56:16 (GMT) |
commit | 6fbd9589cbe77c4d3213ba43c7e88fc451c9664e (patch) | |
tree | bfec32f37cdeed130731b758d4fe9fe14e2a8392 /src/gui/styles/qgtkstyle.cpp | |
parent | 83fff2f970b9a7b41861336c7dca0eadbda28099 (diff) | |
parent | 8c4edbd04f350294462fd689748de2dd7cc84d47 (diff) | |
download | Qt-6fbd9589cbe77c4d3213ba43c7e88fc451c9664e.zip Qt-6fbd9589cbe77c4d3213ba43c7e88fc451c9664e.tar.gz Qt-6fbd9589cbe77c4d3213ba43c7e88fc451c9664e.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt-platform-team into 4.6
Diffstat (limited to 'src/gui/styles/qgtkstyle.cpp')
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index d315c98..a7c291b 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -1004,32 +1004,27 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, gtkPainter.setAlphaSupport(false); GtkShadowType shadow = GTK_SHADOW_OUT; GtkStateType state = GTK_STATE_NORMAL; // Only state supported by gtknotebook - if (const QTabWidget *tabwidget = qobject_cast<const QTabWidget*>(widget)) { - // We should introduce QStyleOptionTabWidgetFrameV2 to obtain this information - // No gap if we do not show the actual tabs - QTabBar *tabBar = tabwidget->findChild<QTabBar*>(); - if (tabwidget->count() > 0 && tabBar->isVisible()) { - QRect tabRect = tabBar->tabRect(tabBar->currentIndex()); - int begin = 0, size = 0; - GtkPositionType frameType = GTK_POS_TOP; - QTabBar::Shape shape = frame->shape; - if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) { - begin = option->direction == Qt::LeftToRight ? - frame->leftCornerWidgetSize.width() + tabRect.left() : - frame->rect.width() - frame->tabBarSize.width() + tabRect.left() - - frame->rightCornerWidgetSize.width(); - size = tabRect.width(); - frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM; - } else { - begin = frame->leftCornerWidgetSize.height() + tabRect.top(); - size = tabRect.height(); - frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT; - } - gtkPainter.paintBoxGap(gtkNotebook, "notebook", option->rect, state, shadow, frameType, - begin, size, style); - break; // done + bool reverse = (option->direction == Qt::RightToLeft); + QGtk::gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR); + if (const QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2*>(option)) { + GtkPositionType frameType = GTK_POS_TOP; + QTabBar::Shape shape = frame->shape; + int gapStart = 0; + int gapSize = 0; + if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) { + frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM; + gapStart = tabframe->selectedTabRect.left(); + gapSize = tabframe->selectedTabRect.width(); + } else { + frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT; + gapStart = tabframe->selectedTabRect.y(); + gapSize = tabframe->selectedTabRect.height(); } + gtkPainter.paintBoxGap(gtkNotebook, "notebook", option->rect, state, shadow, frameType, + gapStart, gapSize, style); + break; // done } + // Note this is only the fallback option gtkPainter.paintBox(gtkNotebook, "notebook", option->rect, state, shadow, style); } |