summaryrefslogtreecommitdiff
path: root/src/gui/styles/qgtkstyle.cpp
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-10-30 14:39:48 +0100
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-10-30 14:39:48 +0100
commit6a907f37d698eadc9cc35712b9cda48ba19e634d (patch)
treed1df866f6a19901f5fe0431e5609cfc2d02484a9 /src/gui/styles/qgtkstyle.cpp
parent8097fa53b5e0e6228bd5737de6de8cd77c04dddf (diff)
parent8c4edbd04f350294462fd689748de2dd7cc84d47 (diff)
downloadqt4-tools-6a907f37d698eadc9cc35712b9cda48ba19e634d.tar.gz
Merge commit '8c4edbd04f350294462fd689748de2dd7cc84d47' into 4.6-upstream
Diffstat (limited to 'src/gui/styles/qgtkstyle.cpp')
-rw-r--r--src/gui/styles/qgtkstyle.cpp43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index b8d36740c1..ab0ab3a5b4 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);
}