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:
parent
fd83e03e7f
commit
588bd92228
@ -53,7 +53,8 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
Window::Window()
|
Window::Window(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
createPreviewGroupBox();
|
createPreviewGroupBox();
|
||||||
createGeneralOptionsGroupBox();
|
createGeneralOptionsGroupBox();
|
||||||
|
@ -70,7 +70,7 @@ class Window : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window();
|
Window(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void localeChanged(int index);
|
void localeChanged(int index);
|
||||||
|
@ -57,7 +57,8 @@
|
|||||||
|
|
||||||
Q_DECLARE_METATYPE(QFontComboBox::FontFilter)
|
Q_DECLARE_METATYPE(QFontComboBox::FontFilter)
|
||||||
|
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
QMenu *fileMenu = menuBar()->addMenu(tr("File"));
|
QMenu *fileMenu = menuBar()->addMenu(tr("File"));
|
||||||
fileMenu->addAction(tr("Quit"), this, &QWidget::close);
|
fileMenu->addAction(tr("Quit"), this, &QWidget::close);
|
||||||
|
@ -70,7 +70,7 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void filterChanged(int);
|
void filterChanged(int);
|
||||||
|
@ -60,7 +60,8 @@ enum { OtherSize = QStyle::PM_CustomBase };
|
|||||||
//! [40]
|
//! [40]
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
QWidget *centralWidget = new QWidget(this);
|
QWidget *centralWidget = new QWidget(this);
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
@ -74,7 +74,7 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
void loadImages(const QStringList &fileNames);
|
void loadImages(const QStringList &fileNames);
|
||||||
|
|
||||||
|
@ -59,10 +59,9 @@
|
|||||||
#include "imageviewer.h"
|
#include "imageviewer.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
ImageViewer::ImageViewer()
|
ImageViewer::ImageViewer(QWidget *parent)
|
||||||
: imageLabel(new QLabel)
|
: QMainWindow(parent), imageLabel(new QLabel),
|
||||||
, scrollArea(new QScrollArea)
|
scrollArea(new QScrollArea), scaleFactor(1)
|
||||||
, scaleFactor(1)
|
|
||||||
{
|
{
|
||||||
imageLabel->setBackgroundRole(QPalette::Base);
|
imageLabel->setBackgroundRole(QPalette::Base);
|
||||||
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
imageLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
|
||||||
|
@ -71,7 +71,7 @@ class ImageViewer : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ImageViewer();
|
ImageViewer(QWidget *parent = nullptr);
|
||||||
bool loadFile(const QString &);
|
bool loadFile(const QString &);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
Window::Window()
|
Window::Window(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
QGroupBox *echoGroup = new QGroupBox(tr("Echo"));
|
QGroupBox *echoGroup = new QGroupBox(tr("Echo"));
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class Window : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window();
|
Window(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void echoChanged(int);
|
void echoChanged(int);
|
||||||
|
@ -59,7 +59,8 @@
|
|||||||
class ButtonTester : public QTextEdit
|
class ButtonTester : public QTextEdit
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
using QTextEdit::QTextEdit;
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
#include "scribblearea.h"
|
#include "scribblearea.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent), scribbleArea(new ScribbleArea(this))
|
||||||
{
|
{
|
||||||
scribbleArea = new ScribbleArea;
|
|
||||||
setCentralWidget(scribbleArea);
|
setCentralWidget(scribbleArea);
|
||||||
|
|
||||||
createActions();
|
createActions();
|
||||||
|
@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
Window::Window()
|
Window::Window(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
horizontalSliders = new SlidersGroup(Qt::Horizontal, tr("Horizontal"));
|
horizontalSliders = new SlidersGroup(Qt::Horizontal, tr("Horizontal"));
|
||||||
verticalSliders = new SlidersGroup(Qt::Vertical, tr("Vertical"));
|
verticalSliders = new SlidersGroup(Qt::Vertical, tr("Vertical"));
|
||||||
|
@ -69,7 +69,7 @@ class Window : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window();
|
Window(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createControls(const QString &title);
|
void createControls(const QString &title);
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
#include "window.h"
|
#include "window.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
Window::Window()
|
Window::Window(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
createSpinBoxes();
|
createSpinBoxes();
|
||||||
createDateTimeEdits();
|
createDateTimeEdits();
|
||||||
|
@ -67,7 +67,7 @@ class Window : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window();
|
Window(QWidget *parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void changePrecision(int decimals);
|
void changePrecision(int decimals);
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "stylesheeteditor.h"
|
#include "stylesheeteditor.h"
|
||||||
|
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
|
: QMainWindow(parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ class MainWindow : public QMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow();
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_editStyleAction_triggered();
|
void on_editStyleAction_triggered();
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
#include "tetrixwindow.h"
|
#include "tetrixwindow.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
TetrixWindow::TetrixWindow()
|
TetrixWindow::TetrixWindow(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
board = new TetrixBoard;
|
board = new TetrixBoard;
|
||||||
//! [0]
|
//! [0]
|
||||||
|
@ -67,7 +67,7 @@ class TetrixWindow : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TetrixWindow();
|
TetrixWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *createLabel(const QString &text);
|
QLabel *createLabel(const QString &text);
|
||||||
|
@ -55,7 +55,8 @@
|
|||||||
#include "sortingbox.h"
|
#include "sortingbox.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
SortingBox::SortingBox()
|
SortingBox::SortingBox(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
//! [0] //! [1]
|
//! [0] //! [1]
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
@ -67,7 +67,7 @@ class SortingBox : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SortingBox();
|
SortingBox(QWidget *parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *event) override;
|
bool event(QEvent *event) override;
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
#include "controllerwindow.h"
|
#include "controllerwindow.h"
|
||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
ControllerWindow::ControllerWindow()
|
ControllerWindow::ControllerWindow(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
previewWindow = new PreviewWindow(this);
|
previewWindow = new PreviewWindow(this);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ class ControllerWindow : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ControllerWindow();
|
ControllerWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatePreview();
|
void updatePreview();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user