From a2f9d610c5cfd80819dc9a11c9452fcadba6ebb4 Mon Sep 17 00:00:00 2001
From: Jens Bache-Wiig <jbache@trolltech.com>
Date: Thu, 14 May 2009 16:09:41 +0200
Subject: Fix missing update of edit geometry on QSpinBox

When showing or hiding spinbox buttons we did not update the
child line edit geometry. This would on windows basically mean that
the buttons would not show up as they were completely covered by the
edit.

Task-number: 235747
Reviewed-by: ogoffart
---
 src/gui/widgets/qabstractspinbox.cpp | 1 +
 tests/auto/qspinbox/tst_qspinbox.cpp | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index 347f89a..d640c70 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -193,6 +193,7 @@ void QAbstractSpinBox::setButtonSymbols(ButtonSymbols buttonSymbols)
     Q_D(QAbstractSpinBox);
     if (d->buttonSymbols != buttonSymbols) {
         d->buttonSymbols = buttonSymbols;
+        d->updateEditFieldGeometry();
         update();
     }
 }
diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp
index 1867356..575f261 100644
--- a/tests/auto/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/qspinbox/tst_qspinbox.cpp
@@ -241,6 +241,12 @@ void tst_QSpinBox::getSetCheck()
     QCOMPARE(0.0, obj2.value());
     obj2.setValue(1.0);
     QCOMPARE(1.0, obj2.value());
+
+    // Make sure we update line edit geometry when updating
+    // buttons - see task 235747
+    QRect oldEditGeometry = obj1.childrenRect();
+    obj1.setButtonSymbols(QAbstractSpinBox::NoButtons);
+    QVERIFY(obj1.childrenRect() != oldEditGeometry);
 }
 
 tst_QSpinBox::tst_QSpinBox()
-- 
cgit v0.12