summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/widgets')
-rw-r--r--examples/widgets/widgets/analogclock/analogclock.h2
-rw-r--r--examples/widgets/widgets/calculator/button.h2
-rw-r--r--examples/widgets/widgets/calculator/calculator.h2
-rw-r--r--examples/widgets/widgets/calendarwidget/window.cpp3
-rw-r--r--examples/widgets/widgets/calendarwidget/window.h2
-rw-r--r--examples/widgets/widgets/charactermap/characterwidget.h2
-rw-r--r--examples/widgets/widgets/charactermap/mainwindow.cpp5
-rw-r--r--examples/widgets/widgets/charactermap/mainwindow.h2
-rw-r--r--examples/widgets/widgets/codeeditor/codeeditor.h2
-rw-r--r--examples/widgets/widgets/digitalclock/digitalclock.h2
-rw-r--r--examples/widgets/widgets/elidedlabel/elidedlabel.h2
-rw-r--r--examples/widgets/widgets/elidedlabel/testwidget.h2
-rw-r--r--examples/widgets/widgets/groupbox/window.h2
-rw-r--r--examples/widgets/widgets/icons/mainwindow.cpp3
-rw-r--r--examples/widgets/widgets/icons/mainwindow.h2
-rw-r--r--examples/widgets/widgets/imageviewer/imageviewer.cpp7
-rw-r--r--examples/widgets/widgets/imageviewer/imageviewer.h2
-rw-r--r--examples/widgets/widgets/lineedits/window.cpp5
-rw-r--r--examples/widgets/widgets/lineedits/window.h2
-rw-r--r--examples/widgets/widgets/mousebuttons/buttontester.h5
-rw-r--r--examples/widgets/widgets/movie/movieplayer.h2
-rw-r--r--examples/widgets/widgets/scribble/mainwindow.cpp4
-rw-r--r--examples/widgets/widgets/scribble/mainwindow.h2
-rw-r--r--examples/widgets/widgets/scribble/scribblearea.h2
-rw-r--r--examples/widgets/widgets/shapedclock/shapedclock.h2
-rw-r--r--examples/widgets/widgets/sliders/slidersgroup.h2
-rw-r--r--examples/widgets/widgets/sliders/window.cpp3
-rw-r--r--examples/widgets/widgets/sliders/window.h2
-rw-r--r--examples/widgets/widgets/spinboxes/window.cpp3
-rw-r--r--examples/widgets/widgets/spinboxes/window.h2
-rw-r--r--examples/widgets/widgets/styles/widgetgallery.h2
-rw-r--r--examples/widgets/widgets/stylesheet/mainwindow.cpp3
-rw-r--r--examples/widgets/widgets/stylesheet/mainwindow.h2
-rw-r--r--examples/widgets/widgets/stylesheet/stylesheeteditor.h2
-rw-r--r--examples/widgets/widgets/tablet/tabletapplication.h5
-rw-r--r--examples/widgets/widgets/tetrix/tetrixboard.h2
-rw-r--r--examples/widgets/widgets/tetrix/tetrixwindow.cpp3
-rw-r--r--examples/widgets/widgets/tetrix/tetrixwindow.h2
-rw-r--r--examples/widgets/widgets/tooltips/sortingbox.cpp7
-rw-r--r--examples/widgets/widgets/tooltips/sortingbox.h2
-rw-r--r--examples/widgets/widgets/validators/ledwidget.h2
-rw-r--r--examples/widgets/widgets/validators/localeselector.h2
-rw-r--r--examples/widgets/widgets/validators/main.cpp85
-rw-r--r--examples/widgets/widgets/validators/validators.pro4
-rw-r--r--examples/widgets/widgets/validators/validatorwidget.cpp122
-rw-r--r--examples/widgets/widgets/validators/validatorwidget.h64
-rw-r--r--examples/widgets/widgets/wiggly/dialog.h2
-rw-r--r--examples/widgets/widgets/wiggly/wigglywidget.h2
-rw-r--r--examples/widgets/widgets/windowflags/controllerwindow.cpp3
-rw-r--r--examples/widgets/widgets/windowflags/controllerwindow.h2
-rw-r--r--examples/widgets/widgets/windowflags/previewwindow.h2
51 files changed, 257 insertions, 143 deletions
diff --git a/examples/widgets/widgets/analogclock/analogclock.h b/examples/widgets/widgets/analogclock/analogclock.h
index 19e580d1ac..e2486a915f 100644
--- a/examples/widgets/widgets/analogclock/analogclock.h
+++ b/examples/widgets/widgets/analogclock/analogclock.h
@@ -59,7 +59,7 @@ class AnalogClock : public QWidget
Q_OBJECT
public:
- AnalogClock(QWidget *parent = 0);
+ AnalogClock(QWidget *parent = nullptr);
protected:
void paintEvent(QPaintEvent *event) override;
diff --git a/examples/widgets/widgets/calculator/button.h b/examples/widgets/widgets/calculator/button.h
index 057640700f..7c6f26867f 100644
--- a/examples/widgets/widgets/calculator/button.h
+++ b/examples/widgets/widgets/calculator/button.h
@@ -59,7 +59,7 @@ class Button : public QToolButton
Q_OBJECT
public:
- explicit Button(const QString &text, QWidget *parent = 0);
+ explicit Button(const QString &text, QWidget *parent = nullptr);
QSize sizeHint() const override;
};
diff --git a/examples/widgets/widgets/calculator/calculator.h b/examples/widgets/widgets/calculator/calculator.h
index 6d7e336347..937de185e7 100644
--- a/examples/widgets/widgets/calculator/calculator.h
+++ b/examples/widgets/widgets/calculator/calculator.h
@@ -64,7 +64,7 @@ class Calculator : public QWidget
Q_OBJECT
public:
- Calculator(QWidget *parent = 0);
+ Calculator(QWidget *parent = nullptr);
private slots:
void digitClicked();
diff --git a/examples/widgets/widgets/calendarwidget/window.cpp b/examples/widgets/widgets/calendarwidget/window.cpp
index c3a0e1e3f7..a1c1746786 100644
--- a/examples/widgets/widgets/calendarwidget/window.cpp
+++ b/examples/widgets/widgets/calendarwidget/window.cpp
@@ -53,7 +53,8 @@
#include "window.h"
//! [0]
-Window::Window()
+Window::Window(QWidget *parent)
+ : QWidget(parent)
{
createPreviewGroupBox();
createGeneralOptionsGroupBox();
diff --git a/examples/widgets/widgets/calendarwidget/window.h b/examples/widgets/widgets/calendarwidget/window.h
index fa01fc4db6..83ea494fc2 100644
--- a/examples/widgets/widgets/calendarwidget/window.h
+++ b/examples/widgets/widgets/calendarwidget/window.h
@@ -70,7 +70,7 @@ class Window : public QWidget
Q_OBJECT
public:
- Window();
+ Window(QWidget *parent = nullptr);
private slots:
void localeChanged(int index);
diff --git a/examples/widgets/widgets/charactermap/characterwidget.h b/examples/widgets/widgets/charactermap/characterwidget.h
index 53add51e6f..34e061e96b 100644
--- a/examples/widgets/widgets/charactermap/characterwidget.h
+++ b/examples/widgets/widgets/charactermap/characterwidget.h
@@ -68,7 +68,7 @@ class CharacterWidget : public QWidget
Q_OBJECT
public:
- CharacterWidget(QWidget *parent = 0);
+ CharacterWidget(QWidget *parent = nullptr);
QSize sizeHint() const override;
public slots:
diff --git a/examples/widgets/widgets/charactermap/mainwindow.cpp b/examples/widgets/widgets/charactermap/mainwindow.cpp
index d3ac55483c..1b6f77bf30 100644
--- a/examples/widgets/widgets/charactermap/mainwindow.cpp
+++ b/examples/widgets/widgets/charactermap/mainwindow.cpp
@@ -57,7 +57,8 @@
Q_DECLARE_METATYPE(QFontComboBox::FontFilter)
-MainWindow::MainWindow()
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
{
QMenu *fileMenu = menuBar()->addMenu(tr("File"));
fileMenu->addAction(tr("Quit"), this, &QWidget::close);
@@ -187,7 +188,7 @@ void MainWindow::filterChanged(int f)
const QFontComboBox::FontFilter filter =
filterCombo->itemData(f).value<QFontComboBox::FontFilter>();
fontCombo->setFontFilters(filter);
- statusBar()->showMessage(tr("%n font(s) found", 0, fontCombo->count()));
+ statusBar()->showMessage(tr("%n font(s) found", nullptr, fontCombo->count()));
}
void MainWindow::findSizes(const QFont &font)
diff --git a/examples/widgets/widgets/charactermap/mainwindow.h b/examples/widgets/widgets/charactermap/mainwindow.h
index eac16b35fa..79fe9f9cc8 100644
--- a/examples/widgets/widgets/charactermap/mainwindow.h
+++ b/examples/widgets/widgets/charactermap/mainwindow.h
@@ -70,7 +70,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow();
+ MainWindow(QWidget *parent = nullptr);
public slots:
void filterChanged(int);
diff --git a/examples/widgets/widgets/codeeditor/codeeditor.h b/examples/widgets/widgets/codeeditor/codeeditor.h
index 65be76d81d..fcfc188cf2 100644
--- a/examples/widgets/widgets/codeeditor/codeeditor.h
+++ b/examples/widgets/widgets/codeeditor/codeeditor.h
@@ -70,7 +70,7 @@ class CodeEditor : public QPlainTextEdit
Q_OBJECT
public:
- CodeEditor(QWidget *parent = 0);
+ CodeEditor(QWidget *parent = nullptr);
void lineNumberAreaPaintEvent(QPaintEvent *event);
int lineNumberAreaWidth();
diff --git a/examples/widgets/widgets/digitalclock/digitalclock.h b/examples/widgets/widgets/digitalclock/digitalclock.h
index 4365b965bf..31c12f39ab 100644
--- a/examples/widgets/widgets/digitalclock/digitalclock.h
+++ b/examples/widgets/widgets/digitalclock/digitalclock.h
@@ -59,7 +59,7 @@ class DigitalClock : public QLCDNumber
Q_OBJECT
public:
- DigitalClock(QWidget *parent = 0);
+ DigitalClock(QWidget *parent = nullptr);
private slots:
void showTime();
diff --git a/examples/widgets/widgets/elidedlabel/elidedlabel.h b/examples/widgets/widgets/elidedlabel/elidedlabel.h
index 8a2a40f49a..9d4fe5fef3 100644
--- a/examples/widgets/widgets/elidedlabel/elidedlabel.h
+++ b/examples/widgets/widgets/elidedlabel/elidedlabel.h
@@ -65,7 +65,7 @@ class ElidedLabel : public QFrame
Q_PROPERTY(bool isElided READ isElided)
public:
- explicit ElidedLabel(const QString &text, QWidget *parent = 0);
+ explicit ElidedLabel(const QString &text, QWidget *parent = nullptr);
void setText(const QString &text);
const QString & text() const { return content; }
diff --git a/examples/widgets/widgets/elidedlabel/testwidget.h b/examples/widgets/widgets/elidedlabel/testwidget.h
index 840bc98b40..cd309d2316 100644
--- a/examples/widgets/widgets/elidedlabel/testwidget.h
+++ b/examples/widgets/widgets/elidedlabel/testwidget.h
@@ -64,7 +64,7 @@ class TestWidget : public QWidget
Q_OBJECT
public:
- TestWidget(QWidget *parent = 0);
+ TestWidget(QWidget *parent = nullptr);
protected:
void resizeEvent(QResizeEvent *event) override;
diff --git a/examples/widgets/widgets/groupbox/window.h b/examples/widgets/widgets/groupbox/window.h
index 566fafa151..1f041fd003 100644
--- a/examples/widgets/widgets/groupbox/window.h
+++ b/examples/widgets/widgets/groupbox/window.h
@@ -63,7 +63,7 @@ class Window : public QWidget
Q_OBJECT
public:
- Window(QWidget *parent = 0);
+ Window(QWidget *parent = nullptr);
private:
QGroupBox *createFirstExclusiveGroup();
diff --git a/examples/widgets/widgets/icons/mainwindow.cpp b/examples/widgets/widgets/icons/mainwindow.cpp
index f704b8306f..904245494c 100644
--- a/examples/widgets/widgets/icons/mainwindow.cpp
+++ b/examples/widgets/widgets/icons/mainwindow.cpp
@@ -60,7 +60,8 @@ enum { OtherSize = QStyle::PM_CustomBase };
//! [40]
//! [0]
-MainWindow::MainWindow()
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
{
QWidget *centralWidget = new QWidget(this);
setCentralWidget(centralWidget);
diff --git a/examples/widgets/widgets/icons/mainwindow.h b/examples/widgets/widgets/icons/mainwindow.h
index e3888e5fb1..1949bd235c 100644
--- a/examples/widgets/widgets/icons/mainwindow.h
+++ b/examples/widgets/widgets/icons/mainwindow.h
@@ -74,7 +74,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow();
+ MainWindow(QWidget *parent = nullptr);
void loadImages(const QStringList &fileNames);
diff --git a/examples/widgets/widgets/imageviewer/imageviewer.cpp b/examples/widgets/widgets/imageviewer/imageviewer.cpp
index 327abf7e43..b1346d9ccb 100644
--- a/examples/widgets/widgets/imageviewer/imageviewer.cpp
+++ b/examples/widgets/widgets/imageviewer/imageviewer.cpp
@@ -59,10 +59,9 @@
#include "imageviewer.h"
//! [0]
-ImageViewer::ImageViewer()
- : imageLabel(new QLabel)
- , scrollArea(new QScrollArea)
- , scaleFactor(1)
+ImageViewer::ImageViewer(QWidget *parent)
+ : QMainWindow(parent), imageLabel(new QLabel),
+ scrollArea(new QScrollArea), scaleFactor(1)
{
imageLabel->setBackgroundRole(QPalette::Base);
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
diff --git a/examples/widgets/widgets/imageviewer/imageviewer.h b/examples/widgets/widgets/imageviewer/imageviewer.h
index f4a62cafe9..7e53105b33 100644
--- a/examples/widgets/widgets/imageviewer/imageviewer.h
+++ b/examples/widgets/widgets/imageviewer/imageviewer.h
@@ -71,7 +71,7 @@ class ImageViewer : public QMainWindow
Q_OBJECT
public:
- ImageViewer();
+ ImageViewer(QWidget *parent = nullptr);
bool loadFile(const QString &);
private slots:
diff --git a/examples/widgets/widgets/lineedits/window.cpp b/examples/widgets/widgets/lineedits/window.cpp
index ffb1edc5ce..0926f6f20b 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"));
@@ -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..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);
diff --git a/examples/widgets/widgets/mousebuttons/buttontester.h b/examples/widgets/widgets/mousebuttons/buttontester.h
index d99dcceb18..231733bd44 100644
--- a/examples/widgets/widgets/mousebuttons/buttontester.h
+++ b/examples/widgets/widgets/mousebuttons/buttontester.h
@@ -59,13 +59,14 @@
class ButtonTester : public QTextEdit
{
Q_OBJECT
-
+public:
+ using QTextEdit::QTextEdit;
protected:
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void mouseDoubleClickEvent(QMouseEvent *event) override;
#if QT_CONFIG(wheelevent)
- void wheelEvent(QWheelEvent * event) override;
+ void wheelEvent(QWheelEvent *event) override;
#endif
int buttonByNumber(const Qt::MouseButton button);
QString enumNameFromValue(const Qt::MouseButton button);
diff --git a/examples/widgets/widgets/movie/movieplayer.h b/examples/widgets/widgets/movie/movieplayer.h
index 9fa9604025..7d143bd37c 100644
--- a/examples/widgets/widgets/movie/movieplayer.h
+++ b/examples/widgets/widgets/movie/movieplayer.h
@@ -70,7 +70,7 @@ class MoviePlayer : public QWidget
Q_OBJECT
public:
- MoviePlayer(QWidget *parent = 0);
+ MoviePlayer(QWidget *parent = nullptr);
void openFile(const QString &fileName);
private slots:
diff --git a/examples/widgets/widgets/scribble/mainwindow.cpp b/examples/widgets/widgets/scribble/mainwindow.cpp
index d54e5ce0f9..b8d01d505c 100644
--- a/examples/widgets/widgets/scribble/mainwindow.cpp
+++ b/examples/widgets/widgets/scribble/mainwindow.cpp
@@ -54,9 +54,9 @@
#include "scribblearea.h"
//! [0]
-MainWindow::MainWindow()
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent), scribbleArea(new ScribbleArea(this))
{
- scribbleArea = new ScribbleArea;
setCentralWidget(scribbleArea);
createActions();
diff --git a/examples/widgets/widgets/scribble/mainwindow.h b/examples/widgets/widgets/scribble/mainwindow.h
index 9e0ddaff71..e57ff065ac 100644
--- a/examples/widgets/widgets/scribble/mainwindow.h
+++ b/examples/widgets/widgets/scribble/mainwindow.h
@@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow();
+ MainWindow(QWidget *parent = nullptr);
protected:
void closeEvent(QCloseEvent *event) override;
diff --git a/examples/widgets/widgets/scribble/scribblearea.h b/examples/widgets/widgets/scribble/scribblearea.h
index 7729fb5b89..100c45e133 100644
--- a/examples/widgets/widgets/scribble/scribblearea.h
+++ b/examples/widgets/widgets/scribble/scribblearea.h
@@ -62,7 +62,7 @@ class ScribbleArea : public QWidget
Q_OBJECT
public:
- ScribbleArea(QWidget *parent = 0);
+ ScribbleArea(QWidget *parent = nullptr);
bool openImage(const QString &fileName);
bool saveImage(const QString &fileName, const char *fileFormat);
diff --git a/examples/widgets/widgets/shapedclock/shapedclock.h b/examples/widgets/widgets/shapedclock/shapedclock.h
index 6468d21618..a854d956b3 100644
--- a/examples/widgets/widgets/shapedclock/shapedclock.h
+++ b/examples/widgets/widgets/shapedclock/shapedclock.h
@@ -59,7 +59,7 @@ class ShapedClock : public QWidget
Q_OBJECT
public:
- ShapedClock(QWidget *parent = 0);
+ ShapedClock(QWidget *parent = nullptr);
QSize sizeHint() const override;
protected:
diff --git a/examples/widgets/widgets/sliders/slidersgroup.h b/examples/widgets/widgets/sliders/slidersgroup.h
index 76dcbee0d8..7be8a3b4f8 100644
--- a/examples/widgets/widgets/sliders/slidersgroup.h
+++ b/examples/widgets/widgets/sliders/slidersgroup.h
@@ -66,7 +66,7 @@ class SlidersGroup : public QGroupBox
public:
SlidersGroup(Qt::Orientation orientation, const QString &title,
- QWidget *parent = 0);
+ QWidget *parent = nullptr);
signals:
void valueChanged(int value);
diff --git a/examples/widgets/widgets/sliders/window.cpp b/examples/widgets/widgets/sliders/window.cpp
index 16b60dde49..16467e71be 100644
--- a/examples/widgets/widgets/sliders/window.cpp
+++ b/examples/widgets/widgets/sliders/window.cpp
@@ -54,7 +54,8 @@
#include "window.h"
//! [0]
-Window::Window()
+Window::Window(QWidget *parent)
+ : QWidget(parent)
{
horizontalSliders = new SlidersGroup(Qt::Horizontal, tr("Horizontal"));
verticalSliders = new SlidersGroup(Qt::Vertical, tr("Vertical"));
diff --git a/examples/widgets/widgets/sliders/window.h b/examples/widgets/widgets/sliders/window.h
index 9c4c14fa37..4894781ac2 100644
--- a/examples/widgets/widgets/sliders/window.h
+++ b/examples/widgets/widgets/sliders/window.h
@@ -69,7 +69,7 @@ class Window : public QWidget
Q_OBJECT
public:
- Window();
+ Window(QWidget *parent = nullptr);
private:
void createControls(const QString &title);
diff --git a/examples/widgets/widgets/spinboxes/window.cpp b/examples/widgets/widgets/spinboxes/window.cpp
index 54604e35aa..eb660faace 100644
--- a/examples/widgets/widgets/spinboxes/window.cpp
+++ b/examples/widgets/widgets/spinboxes/window.cpp
@@ -53,7 +53,8 @@
#include "window.h"
//! [0]
-Window::Window()
+Window::Window(QWidget *parent)
+ : QWidget(parent)
{
createSpinBoxes();
createDateTimeEdits();
diff --git a/examples/widgets/widgets/spinboxes/window.h b/examples/widgets/widgets/spinboxes/window.h
index 97e9ac1083..138773a5aa 100644
--- a/examples/widgets/widgets/spinboxes/window.h
+++ b/examples/widgets/widgets/spinboxes/window.h
@@ -67,7 +67,7 @@ class Window : public QWidget
Q_OBJECT
public:
- Window();
+ Window(QWidget *parent = nullptr);
public slots:
void changePrecision(int decimals);
diff --git a/examples/widgets/widgets/styles/widgetgallery.h b/examples/widgets/widgets/styles/widgetgallery.h
index ec6edff536..9ee65c21c4 100644
--- a/examples/widgets/widgets/styles/widgetgallery.h
+++ b/examples/widgets/widgets/styles/widgetgallery.h
@@ -78,7 +78,7 @@ class WidgetGallery : public QDialog
Q_OBJECT
public:
- WidgetGallery(QWidget *parent = 0);
+ WidgetGallery(QWidget *parent = nullptr);
private slots:
void changeStyle(const QString &styleName);
diff --git a/examples/widgets/widgets/stylesheet/mainwindow.cpp b/examples/widgets/widgets/stylesheet/mainwindow.cpp
index 9acd90658a..eb4b3a2424 100644
--- a/examples/widgets/widgets/stylesheet/mainwindow.cpp
+++ b/examples/widgets/widgets/stylesheet/mainwindow.cpp
@@ -53,7 +53,8 @@
#include "mainwindow.h"
#include "stylesheeteditor.h"
-MainWindow::MainWindow()
+MainWindow::MainWindow(QWidget *parent)
+ : QMainWindow(parent)
{
ui.setupUi(this);
diff --git a/examples/widgets/widgets/stylesheet/mainwindow.h b/examples/widgets/widgets/stylesheet/mainwindow.h
index 46d3ecbb93..8af4c01da0 100644
--- a/examples/widgets/widgets/stylesheet/mainwindow.h
+++ b/examples/widgets/widgets/stylesheet/mainwindow.h
@@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- MainWindow();
+ MainWindow(QWidget *parent = nullptr);
private slots:
void on_editStyleAction_triggered();
diff --git a/examples/widgets/widgets/stylesheet/stylesheeteditor.h b/examples/widgets/widgets/stylesheet/stylesheeteditor.h
index 65a3018adb..f51af7877c 100644
--- a/examples/widgets/widgets/stylesheet/stylesheeteditor.h
+++ b/examples/widgets/widgets/stylesheet/stylesheeteditor.h
@@ -60,7 +60,7 @@ class StyleSheetEditor : public QDialog
Q_OBJECT
public:
- StyleSheetEditor(QWidget *parent = 0);
+ StyleSheetEditor(QWidget *parent = nullptr);
private slots:
void on_styleCombo_activated(const QString &styleName);
diff --git a/examples/widgets/widgets/tablet/tabletapplication.h b/examples/widgets/widgets/tablet/tabletapplication.h
index 6b3b2a1730..9b4a4f1886 100644
--- a/examples/widgets/widgets/tablet/tabletapplication.h
+++ b/examples/widgets/widgets/tablet/tabletapplication.h
@@ -61,15 +61,14 @@ class TabletApplication : public QApplication
Q_OBJECT
public:
- TabletApplication(int &argv, char **args)
- : QApplication(argv, args) {}
+ using QApplication::QApplication;
bool event(QEvent *event) override;
void setCanvas(TabletCanvas *canvas)
{ m_canvas = canvas; }
private:
- TabletCanvas *m_canvas;
+ TabletCanvas *m_canvas = nullptr;
};
//! [0]
diff --git a/examples/widgets/widgets/tetrix/tetrixboard.h b/examples/widgets/widgets/tetrix/tetrixboard.h
index 7c6871dfbd..86bcfa4d6e 100644
--- a/examples/widgets/widgets/tetrix/tetrixboard.h
+++ b/examples/widgets/widgets/tetrix/tetrixboard.h
@@ -67,7 +67,7 @@ class TetrixBoard : public QFrame
Q_OBJECT
public:
- TetrixBoard(QWidget *parent = 0);
+ TetrixBoard(QWidget *parent = nullptr);
void setNextPieceLabel(QLabel *label);
QSize sizeHint() const override;
diff --git a/examples/widgets/widgets/tetrix/tetrixwindow.cpp b/examples/widgets/widgets/tetrix/tetrixwindow.cpp
index 7e951aceb8..970a38c1dc 100644
--- a/examples/widgets/widgets/tetrix/tetrixwindow.cpp
+++ b/examples/widgets/widgets/tetrix/tetrixwindow.cpp
@@ -54,7 +54,8 @@
#include "tetrixwindow.h"
//! [0]
-TetrixWindow::TetrixWindow()
+TetrixWindow::TetrixWindow(QWidget *parent)
+ : QWidget(parent)
{
board = new TetrixBoard;
//! [0]
diff --git a/examples/widgets/widgets/tetrix/tetrixwindow.h b/examples/widgets/widgets/tetrix/tetrixwindow.h
index a21cef2ecf..02226ffe1c 100644
--- a/examples/widgets/widgets/tetrix/tetrixwindow.h
+++ b/examples/widgets/widgets/tetrix/tetrixwindow.h
@@ -67,7 +67,7 @@ class TetrixWindow : public QWidget
Q_OBJECT
public:
- TetrixWindow();
+ TetrixWindow(QWidget *parent = nullptr);
private:
QLabel *createLabel(const QString &text);
diff --git a/examples/widgets/widgets/tooltips/sortingbox.cpp b/examples/widgets/widgets/tooltips/sortingbox.cpp
index 4769a30c64..5f8d96f110 100644
--- a/examples/widgets/widgets/tooltips/sortingbox.cpp
+++ b/examples/widgets/widgets/tooltips/sortingbox.cpp
@@ -55,7 +55,8 @@
#include "sortingbox.h"
//! [0]
-SortingBox::SortingBox()
+SortingBox::SortingBox(QWidget *parent)
+ : QWidget(parent)
{
//! [0] //! [1]
setMouseTracking(true);
@@ -63,7 +64,7 @@ SortingBox::SortingBox()
setBackgroundRole(QPalette::Base);
//! [2]
- itemInMotion = 0;
+ itemInMotion = nullptr;
//! [3]
newCircleButton = createToolButton(tr("New Circle"),
@@ -178,7 +179,7 @@ void SortingBox::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton && itemInMotion) {
moveItemTo(event->pos());
- itemInMotion = 0;
+ itemInMotion = nullptr;
}
}
//! [13]
diff --git a/examples/widgets/widgets/tooltips/sortingbox.h b/examples/widgets/widgets/tooltips/sortingbox.h
index 2ac27614a5..12bdeff1f6 100644
--- a/examples/widgets/widgets/tooltips/sortingbox.h
+++ b/examples/widgets/widgets/tooltips/sortingbox.h
@@ -67,7 +67,7 @@ class SortingBox : public QWidget
Q_OBJECT
public:
- SortingBox();
+ SortingBox(QWidget *parent = nullptr);
protected:
bool event(QEvent *event) override;
diff --git a/examples/widgets/widgets/validators/ledwidget.h b/examples/widgets/widgets/validators/ledwidget.h
index dcbfb176c2..c4b406db23 100644
--- a/examples/widgets/widgets/validators/ledwidget.h
+++ b/examples/widgets/widgets/validators/ledwidget.h
@@ -59,7 +59,7 @@ class LEDWidget : public QLabel
{
Q_OBJECT
public:
- LEDWidget(QWidget *parent = 0);
+ LEDWidget(QWidget *parent = nullptr);
public slots:
void flash();
diff --git a/examples/widgets/widgets/validators/localeselector.h b/examples/widgets/widgets/validators/localeselector.h
index 05290eae81..611e2da66e 100644
--- a/examples/widgets/widgets/validators/localeselector.h
+++ b/examples/widgets/widgets/validators/localeselector.h
@@ -58,7 +58,7 @@ class LocaleSelector : public QComboBox
Q_OBJECT
public:
- LocaleSelector(QWidget *parent = 0);
+ LocaleSelector(QWidget *parent = nullptr);
signals:
void localeSelected(const QLocale &locale);
diff --git a/examples/widgets/widgets/validators/main.cpp b/examples/widgets/widgets/validators/main.cpp
index d8ba2943d0..1fbf12410d 100644
--- a/examples/widgets/widgets/validators/main.cpp
+++ b/examples/widgets/widgets/validators/main.cpp
@@ -48,88 +48,9 @@
**
****************************************************************************/
-#include <qdebug.h>
-#include <QApplication>
-#include <QLineEdit>
-#include <QValidator>
-
-#include "ui_validators.h"
-
-class ValidatorWidget : public QWidget, public Ui::ValidatorsForm
-{
- Q_OBJECT
-public:
- ValidatorWidget(QWidget *parent = 0);
-
-private slots:
- void updateValidator();
- void updateDoubleValidator();
- void _setLocale(const QLocale &l) { setLocale(l); updateValidator(); updateDoubleValidator(); }
-
-private:
- QIntValidator *validator;
- QDoubleValidator *doubleValidator;
-};
-
-ValidatorWidget::ValidatorWidget(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-
- connect(localeSelector, SIGNAL(localeSelected(QLocale)), this, SLOT(_setLocale(QLocale)));
-
- connect(minVal, SIGNAL(editingFinished()), this, SLOT(updateValidator()));
- connect(maxVal, SIGNAL(editingFinished()), this, SLOT(updateValidator()));
- connect(editor, SIGNAL(editingFinished()), ledWidget, SLOT(flash()));
-
- connect(doubleMaxVal, SIGNAL(editingFinished()), this, SLOT(updateDoubleValidator()));
- connect(doubleMinVal, SIGNAL(editingFinished()), this, SLOT(updateDoubleValidator()));
- connect(doubleDecimals, SIGNAL(valueChanged(int)), this, SLOT(updateDoubleValidator()));
- connect(doubleFormat, SIGNAL(activated(int)), this, SLOT(updateDoubleValidator()));
- connect(doubleEditor, SIGNAL(editingFinished()), doubleLedWidget, SLOT(flash()));
+#include "validatorwidget.h"
- validator = 0;
- doubleValidator = 0;
- updateValidator();
- updateDoubleValidator();
-};
-
-void ValidatorWidget::updateValidator()
-{
- QIntValidator *v = new QIntValidator(minVal->value(), maxVal->value(), this);
- v->setLocale(locale());
- editor->setValidator(v);
- delete validator;
- validator = v;
-
- QString s = editor->text();
- int i = 0;
- if (validator->validate(s, i) == QValidator::Invalid) {
- editor->clear();
- } else {
- editor->setText(s);
- }
-}
-
-void ValidatorWidget::updateDoubleValidator()
-{
- QDoubleValidator *v
- = new QDoubleValidator(doubleMinVal->value(), doubleMaxVal->value(),
- doubleDecimals->value(), this);
- v->setNotation(static_cast<QDoubleValidator::Notation>(doubleFormat->currentIndex()));
- v->setLocale(locale());
- doubleEditor->setValidator(v);
- delete doubleValidator;
- doubleValidator = v;
-
- QString s = doubleEditor->text();
- int i = 0;
- if (doubleValidator->validate(s, i) == QValidator::Invalid) {
- doubleEditor->clear();
- } else {
- doubleEditor->setText(s);
- }
-}
+#include <QApplication>
int main(int argc, char **argv)
{
@@ -142,5 +63,3 @@ int main(int argc, char **argv)
return app.exec();
}
-
-#include "main.moc"
diff --git a/examples/widgets/widgets/validators/validators.pro b/examples/widgets/widgets/validators/validators.pro
index ab1eb7809b..029cf95aca 100644
--- a/examples/widgets/widgets/validators/validators.pro
+++ b/examples/widgets/widgets/validators/validators.pro
@@ -4,8 +4,8 @@ requires(qtConfig(combobox))
FORMS += validators.ui
RESOURCES += validators.qrc
-SOURCES += main.cpp ledwidget.cpp localeselector.cpp
-HEADERS += ledwidget.h localeselector.h
+SOURCES += main.cpp ledwidget.cpp localeselector.cpp validatorwidget.cpp
+HEADERS += ledwidget.h localeselector.h validatorwidget.h
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/widgets/validators
diff --git a/examples/widgets/widgets/validators/validatorwidget.cpp b/examples/widgets/widgets/validators/validatorwidget.cpp
new file mode 100644
index 0000000000..fa0a55aa52
--- /dev/null
+++ b/examples/widgets/widgets/validators/validatorwidget.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "validatorwidget.h"
+
+#include <QtWidgets>
+
+ValidatorWidget::ValidatorWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+
+ connect(localeSelector, &LocaleSelector::localeSelected,
+ this, &ValidatorWidget::setLocale);
+ connect(localeSelector, &LocaleSelector::localeSelected,
+ this, &ValidatorWidget::updateValidator);
+ connect(localeSelector, &LocaleSelector::localeSelected,
+ this, &ValidatorWidget::updateDoubleValidator);
+
+ connect(minVal, &QSpinBox::editingFinished,
+ this, &ValidatorWidget::updateValidator);
+ connect(maxVal, &QSpinBox::editingFinished,
+ this, &ValidatorWidget::updateValidator);
+ connect(editor, &QLineEdit::editingFinished,
+ ledWidget, &LEDWidget::flash);
+
+ connect(doubleMaxVal, &QDoubleSpinBox::editingFinished,
+ this, &ValidatorWidget::updateDoubleValidator);
+ connect(doubleMinVal, &QDoubleSpinBox::editingFinished,
+ this, &ValidatorWidget::updateDoubleValidator);
+ connect(doubleDecimals, QOverload<int>::of(&QSpinBox::valueChanged),
+ this, &ValidatorWidget::updateDoubleValidator);
+ connect(doubleFormat, QOverload<int>::of(&QComboBox::activated),
+ this, &ValidatorWidget::updateDoubleValidator);
+ connect(doubleEditor, &QLineEdit::editingFinished,
+ doubleLedWidget, &LEDWidget::flash);
+
+ updateValidator();
+ updateDoubleValidator();
+}
+
+void ValidatorWidget::updateValidator()
+{
+ QIntValidator *v = new QIntValidator(minVal->value(), maxVal->value(), this);
+ v->setLocale(locale());
+ delete editor->validator();
+ editor->setValidator(v);
+
+ QString s = editor->text();
+ int i = 0;
+ if (v->validate(s, i) == QValidator::Invalid) {
+ editor->clear();
+ } else {
+ editor->setText(s);
+ }
+}
+
+void ValidatorWidget::updateDoubleValidator()
+{
+ QDoubleValidator *v
+ = new QDoubleValidator(doubleMinVal->value(), doubleMaxVal->value(),
+ doubleDecimals->value(), this);
+ v->setNotation(static_cast<QDoubleValidator::Notation>(doubleFormat->currentIndex()));
+ v->setLocale(locale());
+ delete doubleEditor->validator();
+ doubleEditor->setValidator(v);
+
+ QString s = doubleEditor->text();
+ int i = 0;
+ if (v->validate(s, i) == QValidator::Invalid) {
+ doubleEditor->clear();
+ } else {
+ doubleEditor->setText(s);
+ }
+}
diff --git a/examples/widgets/widgets/validators/validatorwidget.h b/examples/widgets/widgets/validators/validatorwidget.h
new file mode 100644
index 0000000000..bcc4a9b91e
--- /dev/null
+++ b/examples/widgets/widgets/validators/validatorwidget.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QWidget>
+
+#include "ui_validators.h"
+
+class ValidatorWidget : public QWidget, public Ui::ValidatorsForm
+{
+ Q_OBJECT
+public:
+ ValidatorWidget(QWidget *parent = nullptr);
+
+private slots:
+ void updateValidator();
+ void updateDoubleValidator();
+};
diff --git a/examples/widgets/widgets/wiggly/dialog.h b/examples/widgets/widgets/wiggly/dialog.h
index a0981dc6b6..357b6354b5 100644
--- a/examples/widgets/widgets/wiggly/dialog.h
+++ b/examples/widgets/widgets/wiggly/dialog.h
@@ -59,7 +59,7 @@ class Dialog : public QDialog
Q_OBJECT
public:
- explicit Dialog(QWidget *parent = 0);
+ explicit Dialog(QWidget *parent = nullptr);
};
//! [0]
diff --git a/examples/widgets/widgets/wiggly/wigglywidget.h b/examples/widgets/widgets/wiggly/wigglywidget.h
index 58a7d045e1..1d909c34da 100644
--- a/examples/widgets/widgets/wiggly/wigglywidget.h
+++ b/examples/widgets/widgets/wiggly/wigglywidget.h
@@ -60,7 +60,7 @@ class WigglyWidget : public QWidget
Q_OBJECT
public:
- WigglyWidget(QWidget *parent = 0);
+ WigglyWidget(QWidget *parent = nullptr);
public slots:
void setText(const QString &newText) { text = newText; }
diff --git a/examples/widgets/widgets/windowflags/controllerwindow.cpp b/examples/widgets/widgets/windowflags/controllerwindow.cpp
index 78323810ed..c19f23c513 100644
--- a/examples/widgets/widgets/windowflags/controllerwindow.cpp
+++ b/examples/widgets/widgets/windowflags/controllerwindow.cpp
@@ -53,7 +53,8 @@
#include "controllerwindow.h"
//! [0]
-ControllerWindow::ControllerWindow()
+ControllerWindow::ControllerWindow(QWidget *parent)
+ : QWidget(parent)
{
previewWindow = new PreviewWindow(this);
diff --git a/examples/widgets/widgets/windowflags/controllerwindow.h b/examples/widgets/widgets/windowflags/controllerwindow.h
index cfb88ed20f..43ec67e27f 100644
--- a/examples/widgets/widgets/windowflags/controllerwindow.h
+++ b/examples/widgets/widgets/windowflags/controllerwindow.h
@@ -69,7 +69,7 @@ class ControllerWindow : public QWidget
Q_OBJECT
public:
- ControllerWindow();
+ ControllerWindow(QWidget *parent = nullptr);
private slots:
void updatePreview();
diff --git a/examples/widgets/widgets/windowflags/previewwindow.h b/examples/widgets/widgets/windowflags/previewwindow.h
index e9efd09507..9bb487e8ab 100644
--- a/examples/widgets/widgets/windowflags/previewwindow.h
+++ b/examples/widgets/widgets/windowflags/previewwindow.h
@@ -64,7 +64,7 @@ class PreviewWindow : public QWidget
Q_OBJECT
public:
- PreviewWindow(QWidget *parent = 0);
+ PreviewWindow(QWidget *parent = nullptr);
void setWindowFlags(Qt::WindowFlags flags);