Cleanup Widgets examples - parent ctor

Cleanup the Widgets examples - add missing parent parameter

Change-Id: I5cd7aa333dbb8e6e4b7b9e05c085120733da83ec
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
This commit is contained in:
Christian Ehrlicher 2018-12-02 14:17:21 +01:00
parent fd83e03e7f
commit 588bd92228
25 changed files with 40 additions and 30 deletions

View File

@ -53,7 +53,8 @@
#include "window.h"
//! [0]
Window::Window()
Window::Window(QWidget *parent)
: QWidget(parent)
{
createPreviewGroupBox();
createGeneralOptionsGroupBox();

View File

@ -70,7 +70,7 @@ class Window : public QWidget
Q_OBJECT
public:
Window();
Window(QWidget *parent = nullptr);
private slots:
void localeChanged(int index);

View File

@ -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);

View File

@ -70,7 +70,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow();
MainWindow(QWidget *parent = nullptr);
public slots:
void filterChanged(int);

View File

@ -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);

View File

@ -74,7 +74,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow();
MainWindow(QWidget *parent = nullptr);
void loadImages(const QStringList &fileNames);

View File

@ -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);

View File

@ -71,7 +71,7 @@ class ImageViewer : public QMainWindow
Q_OBJECT
public:
ImageViewer();
ImageViewer(QWidget *parent = nullptr);
bool loadFile(const QString &);
private slots:

View File

@ -53,7 +53,8 @@
#include "window.h"
//! [0]
Window::Window()
Window::Window(QWidget *parent)
: QWidget(parent)
{
QGroupBox *echoGroup = new QGroupBox(tr("Echo"));

View File

@ -64,7 +64,7 @@ class Window : public QWidget
Q_OBJECT
public:
Window();
Window(QWidget *parent = nullptr);
public slots:
void echoChanged(int);

View File

@ -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);

View File

@ -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();

View File

@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow();
MainWindow(QWidget *parent = nullptr);
protected:
void closeEvent(QCloseEvent *event) override;

View File

@ -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"));

View File

@ -69,7 +69,7 @@ class Window : public QWidget
Q_OBJECT
public:
Window();
Window(QWidget *parent = nullptr);
private:
void createControls(const QString &title);

View File

@ -53,7 +53,8 @@
#include "window.h"
//! [0]
Window::Window()
Window::Window(QWidget *parent)
: QWidget(parent)
{
createSpinBoxes();
createDateTimeEdits();

View File

@ -67,7 +67,7 @@ class Window : public QWidget
Q_OBJECT
public:
Window();
Window(QWidget *parent = nullptr);
public slots:
void changePrecision(int decimals);

View File

@ -53,7 +53,8 @@
#include "mainwindow.h"
#include "stylesheeteditor.h"
MainWindow::MainWindow()
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);

View File

@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow();
MainWindow(QWidget *parent = nullptr);
private slots:
void on_editStyleAction_triggered();

View File

@ -54,7 +54,8 @@
#include "tetrixwindow.h"
//! [0]
TetrixWindow::TetrixWindow()
TetrixWindow::TetrixWindow(QWidget *parent)
: QWidget(parent)
{
board = new TetrixBoard;
//! [0]

View File

@ -67,7 +67,7 @@ class TetrixWindow : public QWidget
Q_OBJECT
public:
TetrixWindow();
TetrixWindow(QWidget *parent = nullptr);
private:
QLabel *createLabel(const QString &text);

View File

@ -55,7 +55,8 @@
#include "sortingbox.h"
//! [0]
SortingBox::SortingBox()
SortingBox::SortingBox(QWidget *parent)
: QWidget(parent)
{
//! [0] //! [1]
setMouseTracking(true);

View File

@ -67,7 +67,7 @@ class SortingBox : public QWidget
Q_OBJECT
public:
SortingBox();
SortingBox(QWidget *parent = nullptr);
protected:
bool event(QEvent *event) override;

View File

@ -53,7 +53,8 @@
#include "controllerwindow.h"
//! [0]
ControllerWindow::ControllerWindow()
ControllerWindow::ControllerWindow(QWidget *parent)
: QWidget(parent)
{
previewWindow = new PreviewWindow(this);

View File

@ -69,7 +69,7 @@ class ControllerWindow : public QWidget
Q_OBJECT
public:
ControllerWindow();
ControllerWindow(QWidget *parent = nullptr);
private slots:
void updatePreview();