summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qgtkstyle.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2012-10-08 15:59:09 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-10 08:45:22 +0200
commite91b27b610066a10e27cfa6e3994c5d029c317c2 (patch)
tree4a19089ae7472444de9f18d6ac91497c4f5bdf7c /src/widgets/styles/qgtkstyle.cpp
parent3c05a0f3e7cad3ef4738eb11df4d427c8dbc13e8 (diff)
QGtkStyle: use gtk_widget_get/set_allocation()
Do not access GtkWidget::allocation directly, it doesn't exist in GTK3. Change-Id: I8ce69fab19ce8f3afe35d0d30d4e28b0348fdaf1 Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Diffstat (limited to 'src/widgets/styles/qgtkstyle.cpp')
-rw-r--r--src/widgets/styles/qgtkstyle.cpp46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp
index 3539bee8da..080689779f 100644
--- a/src/widgets/styles/qgtkstyle.cpp
+++ b/src/widgets/styles/qgtkstyle.cpp
@@ -1921,10 +1921,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
: QHashableLatin1Literal("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator");
if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) {
- QRect vLineRect(gtkVSeparator->allocation.x,
- gtkVSeparator->allocation.y,
- gtkVSeparator->allocation.width,
- gtkVSeparator->allocation.height);
+ GtkAllocation allocation;
+ d->gtk_widget_get_allocation(gtkVSeparator, &allocation);
+ QRect vLineRect(allocation.x, allocation.y, allocation.width, allocation.height);
gtkCachedPainter.paintVline( gtkVSeparator, "vseparator",
vLineRect, state, gtkVSeparator->style,
@@ -1976,8 +1975,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
d->gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL);
}
if (gtkArrow) {
- arrowWidgetRect = QRect(gtkArrow->allocation.x, gtkArrow->allocation.y,
- gtkArrow->allocation.width, gtkArrow->allocation.height);
+ GtkAllocation allocation;
+ d->gtk_widget_get_allocation(gtkArrow, &allocation);
+ arrowWidgetRect = QRect(allocation.x, allocation.y, allocation.width, allocation.height);
style = gtkArrow->style;
}
@@ -2199,10 +2199,15 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
}
if (scrollBar->subControls & SC_ScrollBarAddLine) {
- gtkVScrollBar->allocation.y = scrollBarAddLine.top();
- gtkVScrollBar->allocation.height = scrollBarAddLine.height() - rect.height() + 6;
- gtkHScrollBar->allocation.x = scrollBarAddLine.right();
- gtkHScrollBar->allocation.width = scrollBarAddLine.width() - rect.width();
+ GtkAllocation vAllocation;
+ vAllocation.y = scrollBarAddLine.top();
+ vAllocation.height = scrollBarAddLine.height() - rect.height() + 6;
+ d->gtk_widget_set_allocation(gtkVScrollBar, &vAllocation);
+
+ GtkAllocation hAllocation;
+ hAllocation.x = scrollBarAddLine.right();
+ hAllocation.width = scrollBarAddLine.width() - rect.width();
+ d->gtk_widget_set_allocation(gtkHScrollBar, &hAllocation);
GtkShadowType shadow = GTK_SHADOW_OUT;
GtkStateType state = GTK_STATE_NORMAL;
@@ -2226,10 +2231,15 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
}
if (scrollBar->subControls & SC_ScrollBarSubLine) {
- gtkVScrollBar->allocation.y = 0;
- gtkVScrollBar->allocation.height = scrollBarSubLine.height();
- gtkHScrollBar->allocation.x = 0;
- gtkHScrollBar->allocation.width = scrollBarSubLine.width();
+ GtkAllocation vAllocation;
+ vAllocation.y = 0;
+ vAllocation.height = scrollBarSubLine.height();
+ d->gtk_widget_set_allocation(gtkVScrollBar, &vAllocation);
+
+ GtkAllocation hAllocation;
+ hAllocation.x = 0;
+ hAllocation.width = scrollBarSubLine.width();
+ d->gtk_widget_set_allocation(gtkHScrollBar, &hAllocation);
GtkShadowType shadow = GTK_SHADOW_OUT;
GtkStateType state = GTK_STATE_NORMAL;
@@ -3761,9 +3771,11 @@ QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComple
if (!arrowWidget)
return QWindowsStyle::subControlRect(control, option, subControl, widget);
- QRect buttonRect(option->rect.left() + arrowWidget->allocation.x,
- option->rect.top() + arrowWidget->allocation.y,
- arrowWidget->allocation.width, arrowWidget->allocation.height);
+ GtkAllocation allocation;
+ d->gtk_widget_get_allocation(arrowWidget, &allocation);
+ QRect buttonRect(option->rect.left() + allocation.x,
+ option->rect.top() + allocation.y,
+ allocation.width, allocation.height);
switch (subControl) {