summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-12-18 16:05:52 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-12-18 19:35:11 +0100
commit322e5b7f5e35db73f7d7730a6fff558e153ad356 (patch)
treea029cf540194cc34d6914e81fd3ac7794aef9d18 /src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
parent2614347ab8aa0ec0b1ea8f383ae795cfdb6ae2ac (diff)
QtWidget docs: small fixes
Apply some minor fixes to the widget docs - use nullptr - use c++11 initializer list - properly delete widget when cleaning the layout (QTBUG-29471) - rework CardLayout example to make it work with Qt5 Fixes: QTBUG-29471 Change-Id: Ie2ee9f75eb8faf97d2bbd2c25e7013d4f30d8dd0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp')
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
index 0a70c1d32a..5e1f0883e7 100644
--- a/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qapplication.cpp
@@ -51,9 +51,10 @@
//! [0]
QCoreApplication* createApplication(int &argc, char *argv[])
{
- for (int i = 1; i < argc; ++i)
+ for (int i = 1; i < argc; ++i) {
if (!qstrcmp(argv[i], "-no-gui"))
return new QCoreApplication(argc, argv);
+ }
return new QApplication(argc, argv);
}
@@ -187,14 +188,14 @@ for (const QString &command : commands)
//! [12]
-QWidget *widget = qApp->widgetAt(x, y);
+QWidget *widget = QApplication::widgetAt(x, y);
if (widget)
widget = widget->window();
//! [12]
//! [13]
-QWidget *widget = qApp->widgetAt(point);
+QWidget *widget = QApplication::widgetAt(point);
if (widget)
widget = widget->window();
//! [13]