HelloWorld: Modernize

modernize-use-*

Change-Id: I8b53d86b48f3b5c15e6967dd450b814a90987ac1
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Alessandro Portale
2018-11-11 00:53:35 +01:00
parent 1ef39405a4
commit ce1fe8f513
4 changed files with 8 additions and 8 deletions

View File

@@ -94,7 +94,7 @@ bool HelloWorldPlugin::initialize(const QStringList &arguments, QString *errorMe
Core::Context context("HelloWorld.MainView"); Core::Context context("HelloWorld.MainView");
// Create an action to be triggered by a menu entry // 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); connect(helloWorldAction, &QAction::triggered, this, &HelloWorldPlugin::sayHelloWorld);
// Register the action with the action manager // Register the action with the action manager
@@ -140,10 +140,10 @@ void HelloWorldPlugin::extensionsInitialized()
void HelloWorldPlugin::sayHelloWorld() 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 // application-global modal dialog box
QMessageBox::information( 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 } // namespace Internal

View File

@@ -40,11 +40,11 @@ class HelloWorldPlugin
public: public:
HelloWorldPlugin(); 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: private:
void sayHelloWorld(); void sayHelloWorld();

View File

@@ -33,7 +33,7 @@ using namespace HelloWorld::Internal;
HelloWorldWindow::HelloWorldWindow(QWidget *parent) HelloWorldWindow::HelloWorldWindow(QWidget *parent)
: 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!"))); layout->addWidget(new QTextEdit(tr("Focus me to activate my context!")));
setWindowTitle(tr("Hello, world!")); setWindowTitle(tr("Hello, world!"));
} }

View File

@@ -35,7 +35,7 @@ class HelloWorldWindow : public QWidget
Q_OBJECT Q_OBJECT
public: public:
HelloWorldWindow(QWidget *parent = 0); explicit HelloWorldWindow(QWidget *parent = nullptr);
}; };
} // namespace Internal } // namespace Internal