diff options
author | Mitch Curtis <mitch.curtis@digia.com> | 2012-11-02 17:19:59 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-02 18:07:54 +0100 |
commit | 61e0fa5d689264fa776aab4e8f8cd5e6f7b458de (patch) | |
tree | 5c1aaf25234131839e62ee4d23fa3c0924fa1c5c /tests | |
parent | b4dd6faac30c80ea3154ba19e61eec72984ad4b6 (diff) |
Make it obvious that adding a QLayout to QSplitter is not supported.
It does not make sense to add a QLayout to a QSplitter, since the
splitter manages its child widgets in the same manner as a QLayout.
The result of doing so is that the child widgets inside that layout
will lead to the splitter and the layout fighting to position the child
widgets.
QSplitter::addWidget should be used to add widgets directly to the
splitter instead.
Change-Id: I640b463cae8673f87354d28636bff4dd3cfb9679
Reviewed-by: Samu Voutilainen <samu.voutilainen@gmail.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index 51132e2116..7f2033f527 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp @@ -93,7 +93,7 @@ private slots: void task169702_sizes(); void taskQTBUG_4101_ensureOneNonCollapsedWidget_data(); void taskQTBUG_4101_ensureOneNonCollapsedWidget(); - + void setLayout(); private: void removeThirdWidget(); void addThirdWidget(); @@ -770,5 +770,15 @@ void tst_QSplitter::taskQTBUG_4101_ensureOneNonCollapsedWidget() QVERIFY(s.sizes().at(0) > 0); } +void tst_QSplitter::setLayout() +{ + QSplitter splitter; + QVBoxLayout layout; + QTest::ignoreMessage(QtWarningMsg, "Adding a QLayout to a QSplitter is not supported."); + splitter.setLayout(&layout); + // It will work, but we don't recommend it... + QCOMPARE(splitter.layout(), &layout); +} + QTEST_MAIN(tst_QSplitter) #include "tst_qsplitter.moc" |