From ce1fe8f513ff0d593fce4ea747aba67b892d6388 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Sun, 11 Nov 2018 00:53:35 +0100 Subject: [PATCH] HelloWorld: Modernize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit modernize-use-* Change-Id: I8b53d86b48f3b5c15e6967dd450b814a90987ac1 Reviewed-by: André Hartmann --- src/plugins/helloworld/helloworldplugin.cpp | 6 +++--- src/plugins/helloworld/helloworldplugin.h | 6 +++--- src/plugins/helloworld/helloworldwindow.cpp | 2 +- src/plugins/helloworld/helloworldwindow.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/plugins/helloworld/helloworldplugin.cpp b/src/plugins/helloworld/helloworldplugin.cpp index 8487e1b0763..c2e431508b5 100644 --- a/src/plugins/helloworld/helloworldplugin.cpp +++ b/src/plugins/helloworld/helloworldplugin.cpp @@ -94,7 +94,7 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe Core::Context context("HelloWorld.MainView"); // Create an action to be triggered by a menu entry - QAction *helloWorldAction = new QAction(tr("Say \"&Hello World!\""), this); + auto helloWorldAction = new QAction(tr("Say \"&Hello World!\""), this); connect(helloWorldAction, &QAction::triggered, this, &HelloWorldPlugin::sayHelloWorld); // Register the action with the action manager @@ -140,10 +140,10 @@ void HelloWorldPlugin::extensionsInitialized() void HelloWorldPlugin::sayHelloWorld() { - // When passing 0 for the parent, the message box becomes an + // When passing nullptr for the parent, the message box becomes an // application-global modal dialog box QMessageBox::information( - 0, tr("Hello World!"), tr("Hello World! Beautiful day today, isn't it?")); + nullptr, tr("Hello World!"), tr("Hello World! Beautiful day today, isn't it?")); } } // namespace Internal diff --git a/src/plugins/helloworld/helloworldplugin.h b/src/plugins/helloworld/helloworldplugin.h index 8546f4cf566..b03642f8805 100644 --- a/src/plugins/helloworld/helloworldplugin.h +++ b/src/plugins/helloworld/helloworldplugin.h @@ -40,11 +40,11 @@ class HelloWorldPlugin public: HelloWorldPlugin(); - ~HelloWorldPlugin(); + ~HelloWorldPlugin() override; - bool initialize(const QStringList &arguments, QString *errorMessage); + bool initialize(const QStringList &arguments, QString *errorMessage) override; - void extensionsInitialized(); + void extensionsInitialized() override; private: void sayHelloWorld(); diff --git a/src/plugins/helloworld/helloworldwindow.cpp b/src/plugins/helloworld/helloworldwindow.cpp index 0a54a46768a..be59474d9a1 100644 --- a/src/plugins/helloworld/helloworldwindow.cpp +++ b/src/plugins/helloworld/helloworldwindow.cpp @@ -33,7 +33,7 @@ using namespace HelloWorld::Internal; HelloWorldWindow::HelloWorldWindow(QWidget *parent) : QWidget(parent) { - QBoxLayout *layout = new QVBoxLayout(this); + auto layout = new QVBoxLayout(this); layout->addWidget(new QTextEdit(tr("Focus me to activate my context!"))); setWindowTitle(tr("Hello, world!")); } diff --git a/src/plugins/helloworld/helloworldwindow.h b/src/plugins/helloworld/helloworldwindow.h index 382dac8f22b..7fda68f5743 100644 --- a/src/plugins/helloworld/helloworldwindow.h +++ b/src/plugins/helloworld/helloworldwindow.h @@ -35,7 +35,7 @@ class HelloWorldWindow : public QWidget Q_OBJECT public: - HelloWorldWindow(QWidget *parent = 0); + explicit HelloWorldWindow(QWidget *parent = nullptr); }; } // namespace Internal