qt5base-lts/tests/auto/widgets/kernel
Thomas Fischer 983dde1f2f Avoid adding widget to its own layout
Widgets and layouts added or inserted to a layout are checked for:
- Not being NULL
- Not being the parent widget of a layout or the layout itself,
  respectively

Without this commit, adding a widget to its own layout would result in a
CPU-hogging infinite loop. Now, a warning is written to stderr and the
add or insert function call is ignored.

The checks are implemented as public functions of QLayoutPrivate and
thus accessible in QLayout's descendants to be used in various
"addWidget", "insertWidget", etc functions.

Unlike 'classical' layouts like QGridLayout, QFormLayout does indeed
accept widgets that are NULL. To not break this behavior, any call for
the check functions first tests if the widget or layout, respectively,
to test is NULL or not and calls the check only in the latter case.

Automated tests for QBoxLayout, QGridLayout, and QFormLayout were added.
For an unpatched Qt 5.3, each of those automated tests will freeze as
explained in QTBUG-40609. For a fixed version, warning messages about
invalid parameters to addWidget/addLayout/... calls will be read by
QTest::ignoreMessage, resulting in a passed test.

Change-Id: I1522d5727e643da3f7c025755975aca9f482676d
Task-number: QTBUG-40609
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-09-05 00:05:45 +02:00
..
qaction QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qactiongroup QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qapplication expand tabs and related whitespace fixes in *.{cpp,h,qdoc} 2014-01-13 22:46:50 +01:00
qboxlayout Avoid adding widget to its own layout 2014-09-05 00:05:45 +02:00
qdesktopwidget QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qformlayout Avoid adding widget to its own layout 2014-09-05 00:05:45 +02:00
qgridlayout Avoid adding widget to its own layout 2014-09-05 00:05:45 +02:00
qlayout QSizePolicy - add retainSizeWhenHidden 2013-07-10 09:26:31 +02:00
qshortcut expand tabs and related whitespace fixes in *.{cpp,h,qdoc} 2014-01-13 22:46:50 +01:00
qsizepolicy QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qstackedlayout Add widget replace function to QLayout 2013-09-21 23:17:55 +02:00
qtooltip QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qwidget Fix some tst_qwidget test cases 2014-07-02 10:29:44 +02:00
qwidget_window Recreate child windows when changing screens 2014-08-28 23:48:56 +02:00
qwidgetaction QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qwidgetmetatype QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qwidgetsvariant QtWidgets tests: Remove DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 2013-03-28 02:02:14 +01:00
qwindowcontainer Fix crash when windowcontainer is used in a dockwidget 2013-11-20 14:10:37 +01:00
kernel.pro Introducing QWidget::createWindowContainer() 2013-01-25 14:11:07 +01:00