From 588bd92228efa7ed3a92929e0eb90c22be189e04 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 2 Dec 2018 14:17:21 +0100 Subject: Cleanup Widgets examples - parent ctor Cleanup the Widgets examples - add missing parent parameter Change-Id: I5cd7aa333dbb8e6e4b7b9e05c085120733da83ec Reviewed-by: Samuel Gaist Reviewed-by: Konstantin Shegunov Reviewed-by: Richard Moe Gustavsen Reviewed-by: Paul Wicking --- examples/widgets/widgets/lineedits/window.cpp | 3 ++- examples/widgets/widgets/lineedits/window.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'examples/widgets/widgets/lineedits') diff --git a/examples/widgets/widgets/lineedits/window.cpp b/examples/widgets/widgets/lineedits/window.cpp index ffb1edc5ce..47324589b7 100644 --- a/examples/widgets/widgets/lineedits/window.cpp +++ b/examples/widgets/widgets/lineedits/window.cpp @@ -53,7 +53,8 @@ #include "window.h" //! [0] -Window::Window() +Window::Window(QWidget *parent) + : QWidget(parent) { QGroupBox *echoGroup = new QGroupBox(tr("Echo")); diff --git a/examples/widgets/widgets/lineedits/window.h b/examples/widgets/widgets/lineedits/window.h index 2070b3b84c..3231588f4f 100644 --- a/examples/widgets/widgets/lineedits/window.h +++ b/examples/widgets/widgets/lineedits/window.h @@ -64,7 +64,7 @@ class Window : public QWidget Q_OBJECT public: - Window(); + Window(QWidget *parent = nullptr); public slots: void echoChanged(int); -- cgit v1.2.3 From aa32510430d6a5e58cb456faeb072d9f189872fe Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 2 Dec 2018 14:11:13 +0100 Subject: Cleanup Widgets examples - nullptr Cleanup the widgets examples - replace 0 with nullptr Change-Id: Id4bf119b9a41f6d10117f3a613a6e604128fa196 Reviewed-by: Konstantin Shegunov Reviewed-by: Edward Welbourne Reviewed-by: Paul Wicking --- examples/widgets/widgets/lineedits/window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/widgets/widgets/lineedits') diff --git a/examples/widgets/widgets/lineedits/window.cpp b/examples/widgets/widgets/lineedits/window.cpp index 47324589b7..0926f6f20b 100644 --- a/examples/widgets/widgets/lineedits/window.cpp +++ b/examples/widgets/widgets/lineedits/window.cpp @@ -206,7 +206,7 @@ void Window::validatorChanged(int index) { switch (index) { case 0: - validatorLineEdit->setValidator(0); + validatorLineEdit->setValidator(nullptr); break; case 1: validatorLineEdit->setValidator(new QIntValidator( -- cgit v1.2.3 From bf4bf3a58360d4f7907895096b452cb3821ea593 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 2 Dec 2018 14:16:47 +0100 Subject: Cleanup Widgets examples - signals/slots Cleanup the widgets examples - use new signal/slot syntax where possible Change-Id: I6bc8953534d8b1efca0de4ee6a9fe4a6aa79fda9 Reviewed-by: Samuel Gaist Reviewed-by: Konstantin Shegunov Reviewed-by: Edward Welbourne Reviewed-by: Paul Wicking --- examples/widgets/widgets/lineedits/window.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'examples/widgets/widgets/lineedits') diff --git a/examples/widgets/widgets/lineedits/window.cpp b/examples/widgets/widgets/lineedits/window.cpp index 0926f6f20b..33f09d544d 100644 --- a/examples/widgets/widgets/lineedits/window.cpp +++ b/examples/widgets/widgets/lineedits/window.cpp @@ -123,16 +123,16 @@ Window::Window(QWidget *parent) //! [4] //! [5] - connect(echoComboBox, SIGNAL(activated(int)), - this, SLOT(echoChanged(int))); - connect(validatorComboBox, SIGNAL(activated(int)), - this, SLOT(validatorChanged(int))); - connect(alignmentComboBox, SIGNAL(activated(int)), - this, SLOT(alignmentChanged(int))); - connect(inputMaskComboBox, SIGNAL(activated(int)), - this, SLOT(inputMaskChanged(int))); - connect(accessComboBox, SIGNAL(activated(int)), - this, SLOT(accessChanged(int))); + connect(echoComboBox, QOverload::of(&QComboBox::activated), + this, &Window::echoChanged); + connect(validatorComboBox, QOverload::of(&QComboBox::activated), + this, &Window::validatorChanged); + connect(alignmentComboBox, QOverload::of(&QComboBox::activated), + this, &Window::alignmentChanged); + connect(inputMaskComboBox, QOverload::of(&QComboBox::activated), + this, &Window::inputMaskChanged); + connect(accessComboBox, QOverload::of(&QComboBox::activated), + this, &Window::accessChanged); //! [5] //! [6] -- cgit v1.2.3 From 004d7168a335219b19805badae0590b0f5dcfad0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 2 Dec 2018 14:18:38 +0100 Subject: Cleanup Widgets examples - includes Cleanup the Widgets examples - adjust includes to Qt coding style and remove unused includes and formward declarations Change-Id: I9f2e513284ad631337ff52ec9c0b98645055dcca Reviewed-by: Konstantin Shegunov Reviewed-by: Paul Wicking --- examples/widgets/widgets/lineedits/window.h | 1 - 1 file changed, 1 deletion(-) (limited to 'examples/widgets/widgets/lineedits') diff --git a/examples/widgets/widgets/lineedits/window.h b/examples/widgets/widgets/lineedits/window.h index 3231588f4f..a31634f3a3 100644 --- a/examples/widgets/widgets/lineedits/window.h +++ b/examples/widgets/widgets/lineedits/window.h @@ -54,7 +54,6 @@ #include QT_BEGIN_NAMESPACE -class QComboBox; class QLineEdit; QT_END_NAMESPACE -- cgit v1.2.3