diff options
author | hjk <hjk@theqtcompany.com> | 2016-03-15 10:08:56 +0100 |
---|---|---|
committer | hjk <hjk@theqtcompany.com> | 2016-03-15 11:24:49 +0000 |
commit | 1c483b95a61e1abe40ed3d7e626ccdbd21e635de (patch) | |
tree | daa472533ac8afdbcce3da4b3231df37099d16b7 /doc/api | |
parent | af05e661a325dcb5aee253b5b32b389938a5affb (diff) | |
download | qt-creator-1c483b95a61e1abe40ed3d7e626ccdbd21e635de.tar.gz |
Doc: Modernize example code a bit
Use Qt 5 connects.
Change-Id: I0e8ae956258892f60a1d12222a081c0fa6577717
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/examples/exampleplugin/exampleplugin.cpp | 8 | ||||
-rw-r--r-- | doc/api/examples/exampleplugin/exampleplugin.h | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/doc/api/examples/exampleplugin/exampleplugin.cpp b/doc/api/examples/exampleplugin/exampleplugin.cpp index bd62991444..5adc093c46 100644 --- a/doc/api/examples/exampleplugin/exampleplugin.cpp +++ b/doc/api/examples/exampleplugin/exampleplugin.cpp @@ -15,7 +15,8 @@ #include <QtPlugin> -using namespace Example::Internal; +namespace Example { +namespace Internal { ExamplePlugin::ExamplePlugin() { @@ -45,7 +46,7 @@ bool ExamplePlugin::initialize(const QStringList &arguments, QString *errorStrin Core::Command *cmd = Core::ActionManager::registerAction(action, Constants::ACTION_ID, Core::Context(Core::Constants::C_GLOBAL)); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Alt+Meta+A"))); - connect(action, SIGNAL(triggered()), this, SLOT(triggerAction())); + connect(action, &QAction::triggered, this, &ExamplePlugin::triggerAction); //! [add action] //! [add menu] Core::ActionContainer *menu = Core::ActionManager::createMenu(Constants::MENU_ID); @@ -80,3 +81,6 @@ void ExamplePlugin::triggerAction() tr("This is an action from Example.")); } //! [slot implementation] + +} // namespace Internal +} // namespace Example diff --git a/doc/api/examples/exampleplugin/exampleplugin.h b/doc/api/examples/exampleplugin/exampleplugin.h index 208612e72b..56f04ea746 100644 --- a/doc/api/examples/exampleplugin/exampleplugin.h +++ b/doc/api/examples/exampleplugin/exampleplugin.h @@ -28,7 +28,7 @@ public: //! [plugin functions] //! [slot] -private slots: +private: void triggerAction(); //! [slot] }; |