diff options
Diffstat (limited to 'examples/widgets/widgets/lineedits')
-rw-r--r-- | examples/widgets/widgets/lineedits/window.cpp | 25 | ||||
-rw-r--r-- | examples/widgets/widgets/lineedits/window.h | 3 |
2 files changed, 14 insertions, 14 deletions
diff --git a/examples/widgets/widgets/lineedits/window.cpp b/examples/widgets/widgets/lineedits/window.cpp index ffb1edc5ce..33f09d544d 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")); @@ -122,16 +123,16 @@ Window::Window() //! [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<int>::of(&QComboBox::activated), + this, &Window::echoChanged); + connect(validatorComboBox, QOverload<int>::of(&QComboBox::activated), + this, &Window::validatorChanged); + connect(alignmentComboBox, QOverload<int>::of(&QComboBox::activated), + this, &Window::alignmentChanged); + connect(inputMaskComboBox, QOverload<int>::of(&QComboBox::activated), + this, &Window::inputMaskChanged); + connect(accessComboBox, QOverload<int>::of(&QComboBox::activated), + this, &Window::accessChanged); //! [5] //! [6] @@ -205,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( diff --git a/examples/widgets/widgets/lineedits/window.h b/examples/widgets/widgets/lineedits/window.h index 2070b3b84c..a31634f3a3 100644 --- a/examples/widgets/widgets/lineedits/window.h +++ b/examples/widgets/widgets/lineedits/window.h @@ -54,7 +54,6 @@ #include <QWidget> QT_BEGIN_NAMESPACE -class QComboBox; class QLineEdit; QT_END_NAMESPACE @@ -64,7 +63,7 @@ class Window : public QWidget Q_OBJECT public: - Window(); + Window(QWidget *parent = nullptr); public slots: void echoChanged(int); |