summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTero Ahola <tero.ahola@digia.com>2012-08-07 15:10:47 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-18 21:45:46 +0200
commit8b6de4677142cab41790ca50ce6c7f1efbab5de8 (patch)
tree567b9f0567be137d25244291e81578562f4acac1
parente6cbf2f9858f88f2148e80e528f5aaddc91373a1 (diff)
Modified vertical alignments of simple widgets on OSX
Adding QCheckBox, QComboBox, QLineEdit etc. into an HBox layout or grid layout makes the layout look like a snake's trail. Fixed the positioning of these widgets to make the layouts visually more appealing. Updated qmacstyle auto-test accordingly. Task-number: QTBUG-13635 Ammended-by: Gabriel de Dietrich Change-Id: I89461f9aad68ea8488070ed06257b9b8e7f493c5 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm14
-rw-r--r--tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp11
-rw-r--r--tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp4
-rw-r--r--tests/manual/manual.pro1
-rw-r--r--tests/manual/qlayout/gridwidget.cpp74
-rw-r--r--tests/manual/qlayout/gridwidget.h59
-rw-r--r--tests/manual/qlayout/hbwidget.cpp70
-rw-r--r--tests/manual/qlayout/hbwidget.h59
-rw-r--r--tests/manual/qlayout/main.cpp52
-rw-r--r--tests/manual/qlayout/mainwindow.cpp93
-rw-r--r--tests/manual/qlayout/mainwindow.h64
-rw-r--r--tests/manual/qlayout/qlayout.pro14
-rw-r--r--tests/manual/qlayout/vbwidget.cpp70
-rw-r--r--tests/manual/qlayout/vbwidget.h59
14 files changed, 627 insertions, 17 deletions
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 3110973740..38f4dc3abc 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1013,7 +1013,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
if (!widg || !qobject_cast<QComboBox *>(widg->parentWidget())) {
//should I take into account the font dimentions of the lineedit? -Sam
if (sz == QAquaSizeLarge)
- ret = QSize(-1, 22);
+ ret = QSize(-1, 21);
else
ret = QSize(-1, 19);
}
@@ -1392,7 +1392,7 @@ HIRect QMacStylePrivate::comboboxInnerBounds(const HIRect &outerBounds, int butt
switch (buttonKind){
case kThemePopupButton:
innerBounds.origin.x += 2;
- innerBounds.origin.y += 3;
+ innerBounds.origin.y += 2;
innerBounds.size.width -= 5;
innerBounds.size.height -= 6;
break;
@@ -1410,9 +1410,9 @@ HIRect QMacStylePrivate::comboboxInnerBounds(const HIRect &outerBounds, int butt
break;
case kThemeComboBox:
innerBounds.origin.x += 3;
- innerBounds.origin.y += 3;
+ innerBounds.origin.y += 2;
innerBounds.size.width -= 6;
- innerBounds.size.height -= 6;
+ innerBounds.size.height -= 8;
break;
case kThemeComboBoxSmall:
innerBounds.origin.x += 3;
@@ -1441,7 +1441,7 @@ QRect QMacStylePrivate::comboboxEditBounds(const QRect &outerBounds, const HIThe
QRect ret = outerBounds;
switch (bdi.kind){
case kThemeComboBox:
- ret.adjust(5, 8, -23, -4);
+ ret.adjust(5, 5, -22, -5);
break;
case kThemeComboBoxSmall:
ret.adjust(4, 5, -18, 0);
@@ -1452,7 +1452,7 @@ QRect QMacStylePrivate::comboboxEditBounds(const QRect &outerBounds, const HIThe
ret.setHeight(13);
break;
case kThemePopupButton:
- ret.adjust(10, 3, -23, -3);
+ ret.adjust(10, 2, -23, -4);
break;
case kThemePopupButtonSmall:
ret.adjust(9, 3, -20, -3);
@@ -4655,7 +4655,7 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
if(widget->parentWidget() && qobject_cast<const QComboBox*>(widget->parentWidget()))
rect.adjust(-1, -2, 0, 0);
else
- rect.adjust(-1, 0, 0, +1);
+ rect.adjust(-1, -1, 0, +1);
break;
case SE_CheckBoxLayoutItem:
rect = opt->rect;
diff --git a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
index 0fdce91151..c0b857d540 100644
--- a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
+++ b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp
@@ -124,7 +124,7 @@ void tst_QMacStyle::sizeHints()
setSize(&w, size);
QLineEdit lineEdit1(&w);
- QCOMPARE(sh(&lineEdit1).height(), SIZE(22, 19, 16)); // 16 in Builder, 15 in AHIG
+ QCOMPARE(sh(&lineEdit1).height(), SIZE(21, 19, 16)); // 16 in Builder, 15 in AHIG
QProgressBar progress1(&w);
progress1.setOrientation(Qt::Horizontal);
@@ -135,11 +135,10 @@ void tst_QMacStyle::sizeHints()
QCOMPARE(sh(&progress1).width(), SIZE(16, 10, 10)); // Builder
QRadioButton radio1("Radio", &w);
- QEXPECT_FAIL("", "QTBUG-25296", Abort);
- QCOMPARE(sh(&radio1).height(), SIZE(15, 12, 10)); // Builder
+ QCOMPARE(sh(&radio1).height(), SIZE(14, 12, 10)); // Builder
QCheckBox checkBox1("Switch", &w);
- QCOMPARE(sh(&checkBox1).height(), SIZE(14, 12, 10)); // Builder
+ QCOMPARE(sh(&checkBox1).height(), SIZE(13, 12, 10)); // Builder
QComboBox comboBox1(&w);
comboBox1.setEditable(false);
@@ -149,7 +148,7 @@ void tst_QMacStyle::sizeHints()
QComboBox comboBox2(&w);
comboBox2.setEditable(true);
comboBox2.addItem("Foo");
- QCOMPARE(sh(&comboBox2).height(), SIZE(20, 17, 15));
+ QCOMPARE(sh(&comboBox2).height(), SIZE(22, 17, 15));
// Combos in toolbars use the actual widget rect to
// avoid faulty clipping:
@@ -227,7 +226,7 @@ void tst_QMacStyle::sizeHints()
// QMacStyle bug: label doesn't react to Small and Mini
QLabel label1("Blah", &w);
- QCOMPARE(sh(&label1).height(), SIZE(17, 14, 11));
+ QCOMPARE(sh(&label1).height(), SIZE(16, 14, 11));
}
void tst_QMacStyle::layoutMargins_data()
diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
index dc8b1c12f3..4b2125ad6a 100644
--- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -874,10 +874,6 @@ void tst_QStyleSheetStyle::hoverColors()
QVERIFY2(testForColors(image, QColor(0xe8, 0xff, 0x66)),
(QString::fromLatin1(widget->metaObject()->className())
+ " did not contain background color #e8ff66").toLocal8Bit().constData());
-#ifdef Q_OS_MAC
- if (qobject_cast<QComboBox *>(widget))
- QEXPECT_FAIL("", "Failure only for QPushButton and QComboBox, see QTBUG-23686", Continue);
-#endif
QVERIFY2(testForColors(image, QColor(0xff, 0x00, 0x84)),
(QString::fromLatin1(widget->metaObject()->className())
+ " did not contain text color #ff0084").toLocal8Bit().constData());
diff --git a/tests/manual/manual.pro b/tests/manual/manual.pro
index 6aff45ac4d..04bdff6abc 100644
--- a/tests/manual/manual.pro
+++ b/tests/manual/manual.pro
@@ -14,6 +14,7 @@ qgraphicsitemgroup \
qgraphicslayout/flicker \
qhttpnetworkconnection \
qimagereader \
+qlayout \
qlocale \
qnetworkaccessmanager/qget \
qnetworkconfigurationmanager \
diff --git a/tests/manual/qlayout/gridwidget.cpp b/tests/manual/qlayout/gridwidget.cpp
new file mode 100644
index 0000000000..821ed7f604
--- /dev/null
+++ b/tests/manual/qlayout/gridwidget.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gridwidget.h"
+#include <QGridLayout>
+#include <QPushButton>
+#include <QComboBox>
+#include <QDateTimeEdit>
+#include <QLineEdit>
+#include <QSpinBox>
+#include <QLabel>
+#include <QCheckBox>
+
+GridWidget::GridWidget(QWidget *parent) :
+ QWidget(parent)
+{
+ QGridLayout *hb = new QGridLayout(this);
+ QComboBox *combo = new QComboBox();
+ combo->addItem("123");
+ QComboBox *combo2 = new QComboBox();
+ combo2->setEditable(true);
+ combo2->addItem("123");
+
+ hb->addWidget(new QLabel("123"), 0, 0);
+ hb->addWidget(new QLabel("123"), 0, 1);
+ hb->addWidget(new QLineEdit("123"), 1, 0);
+ hb->addWidget(new QLineEdit("123"), 1, 1);
+ hb->addWidget(new QCheckBox("123"), 0, 2);
+ hb->addWidget(new QCheckBox("123"), 1, 2);
+ hb->addWidget(combo, 0, 3);
+ hb->addWidget(combo2, 1, 3);
+ hb->addWidget(new QDateTimeEdit(), 0, 4);
+ hb->addWidget(new QPushButton("123"), 1, 4);
+ hb->addWidget(new QSpinBox(), 0, 5);
+ hb->addWidget(new QSpinBox(), 1, 5);
+}
diff --git a/tests/manual/qlayout/gridwidget.h b/tests/manual/qlayout/gridwidget.h
new file mode 100644
index 0000000000..481c17f5c3
--- /dev/null
+++ b/tests/manual/qlayout/gridwidget.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GRIDWIDGET_H
+#define GRIDWIDGET_H
+
+#include <QWidget>
+
+class GridWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit GridWidget(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // GRIDWIDGET_H
diff --git a/tests/manual/qlayout/hbwidget.cpp b/tests/manual/qlayout/hbwidget.cpp
new file mode 100644
index 0000000000..e4a568ef57
--- /dev/null
+++ b/tests/manual/qlayout/hbwidget.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "hbwidget.h"
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QComboBox>
+#include <QDateTimeEdit>
+#include <QLineEdit>
+#include <QSpinBox>
+#include <QLabel>
+#include <QCheckBox>
+
+HbWidget::HbWidget(QWidget *parent) :
+ QWidget(parent)
+{
+ QHBoxLayout *hb = new QHBoxLayout(this);
+ QComboBox *combo = new QComboBox(this);
+ combo->addItem("123");
+ QComboBox *combo2 = new QComboBox();
+ combo2->setEditable(true);
+ combo2->addItem("123");
+
+ hb->addWidget(new QLabel("123"));
+ hb->addWidget(new QLineEdit("123"));
+ hb->addWidget(combo);
+ hb->addWidget(combo2);
+ hb->addWidget(new QCheckBox("123"));
+ hb->addWidget(new QDateTimeEdit());
+ hb->addWidget(new QPushButton("123"));
+ hb->addWidget(new QSpinBox());
+}
diff --git a/tests/manual/qlayout/hbwidget.h b/tests/manual/qlayout/hbwidget.h
new file mode 100644
index 0000000000..f8efdc3531
--- /dev/null
+++ b/tests/manual/qlayout/hbwidget.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef HBWIDGET_H
+#define HBWIDGET_H
+
+#include <QWidget>
+
+class HbWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit HbWidget(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // HBWIDGET_H
diff --git a/tests/manual/qlayout/main.cpp b/tests/manual/qlayout/main.cpp
new file mode 100644
index 0000000000..7c6bbab5e7
--- /dev/null
+++ b/tests/manual/qlayout/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QApplication>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow w;
+ w.show();
+
+ return a.exec();
+}
diff --git a/tests/manual/qlayout/mainwindow.cpp b/tests/manual/qlayout/mainwindow.cpp
new file mode 100644
index 0000000000..9899e0d881
--- /dev/null
+++ b/tests/manual/qlayout/mainwindow.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "mainwindow.h"
+#include "hbwidget.h"
+#include "vbwidget.h"
+#include "gridwidget.h"
+#include <QGridLayout>
+#include <QComboBox>
+
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
+{
+ QWidget *widget = new QWidget(this);
+ setCentralWidget(widget);
+ m_mainLayout = new QGridLayout(widget);
+
+ QComboBox *combo = new QComboBox();
+ combo->addItem("HBox Layout");
+ combo->addItem("VBox Layout");
+ combo->addItem("Grid Layout");
+ connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(layoutIndexChanged(int)));
+ HbWidget *hbWidget = new HbWidget(this);
+
+ m_mainLayout->addWidget(combo);
+ m_mainLayout->addWidget(hbWidget);
+}
+
+MainWindow::~MainWindow()
+{
+
+}
+
+void MainWindow::layoutIndexChanged(int index)
+{
+ delete m_mainLayout->takeAt(1)->widget();
+
+ switch (index) {
+ case 0: {
+ HbWidget *hbWidget = new HbWidget(this);
+ m_mainLayout->addWidget(hbWidget);
+ break;
+ }
+ case 1: {
+ VbWidget *vbWidget = new VbWidget(this);
+ m_mainLayout->addWidget(vbWidget);
+ break;
+ }
+ default: {
+ GridWidget *gridW = new GridWidget(this);
+ m_mainLayout->addWidget(gridW);
+ break;
+ }
+ }
+}
diff --git a/tests/manual/qlayout/mainwindow.h b/tests/manual/qlayout/mainwindow.h
new file mode 100644
index 0000000000..44ccd6618a
--- /dev/null
+++ b/tests/manual/qlayout/mainwindow.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+class QGridLayout;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+private slots:
+ void layoutIndexChanged(int index);
+
+private:
+ QGridLayout *m_mainLayout;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/manual/qlayout/qlayout.pro b/tests/manual/qlayout/qlayout.pro
new file mode 100644
index 0000000000..44cd7496ef
--- /dev/null
+++ b/tests/manual/qlayout/qlayout.pro
@@ -0,0 +1,14 @@
+QT += widgets
+
+TEMPLATE = app
+
+SOURCES += main.cpp\
+ mainwindow.cpp \
+ hbwidget.cpp \
+ gridwidget.cpp \
+ vbwidget.cpp
+
+HEADERS += mainwindow.h \
+ hbwidget.h \
+ gridwidget.h \
+ vbwidget.h
diff --git a/tests/manual/qlayout/vbwidget.cpp b/tests/manual/qlayout/vbwidget.cpp
new file mode 100644
index 0000000000..9033105d4b
--- /dev/null
+++ b/tests/manual/qlayout/vbwidget.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "vbwidget.h"
+#include <QVBoxLayout>
+#include <QPushButton>
+#include <QComboBox>
+#include <QDateTimeEdit>
+#include <QLineEdit>
+#include <QSpinBox>
+#include <QLabel>
+#include <QCheckBox>
+
+VbWidget::VbWidget(QWidget *parent) :
+ QWidget(parent)
+{
+ QVBoxLayout *hb = new QVBoxLayout(this);
+ QComboBox *combo = new QComboBox(this);
+ combo->addItem("123");
+ QComboBox *combo2 = new QComboBox();
+ combo2->setEditable(true);
+ combo2->addItem("123");
+
+ hb->addWidget(new QLabel("123"));
+ hb->addWidget(new QLineEdit("123"));
+ hb->addWidget(combo);
+ hb->addWidget(combo2);
+ hb->addWidget(new QCheckBox("123"));
+ hb->addWidget(new QDateTimeEdit());
+ hb->addWidget(new QPushButton("123"));
+ hb->addWidget(new QSpinBox());
+}
diff --git a/tests/manual/qlayout/vbwidget.h b/tests/manual/qlayout/vbwidget.h
new file mode 100644
index 0000000000..86559c5950
--- /dev/null
+++ b/tests/manual/qlayout/vbwidget.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef VBWIDGET_H
+#define VBWIDGET_H
+
+#include <QWidget>
+
+class VbWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit VbWidget(QWidget *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // VBWIDGET_H