forked from qt-creator/qt-creator
Macros: Use Qt5-style connects
The heavy lifting was done by clazy. Change-Id: I0154e09c1a9e028f3a80772c4c07751f4e282091 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
34a7ff07b7
commit
8641a5e956
@@ -102,8 +102,6 @@ public:
|
||||
|
||||
QList<IMacroHandler*> handlers;
|
||||
|
||||
QSignalMapper *mapper;
|
||||
|
||||
ActionMacroHandler *actionHandler;
|
||||
TextEditorMacroHandler *textEditorHandler;
|
||||
FindMacroHandler *findHandler;
|
||||
@@ -120,11 +118,8 @@ public:
|
||||
MacroManager::MacroManagerPrivate::MacroManagerPrivate(MacroManager *qq):
|
||||
q(qq),
|
||||
currentMacro(0),
|
||||
isRecording(false),
|
||||
mapper(new QSignalMapper(qq))
|
||||
isRecording(false)
|
||||
{
|
||||
connect(mapper, SIGNAL(mapped(QString)), q, SLOT(executeMacro(QString)));
|
||||
|
||||
// Load existing macros
|
||||
initialize();
|
||||
|
||||
@@ -164,8 +159,9 @@ void MacroManager::MacroManagerPrivate::addMacro(Macro *macro)
|
||||
Core::Command *command = Core::ActionManager::registerAction(
|
||||
action, makeId(macro->displayName()), context);
|
||||
command->setAttribute(Core::Command::CA_UpdateText);
|
||||
connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
|
||||
mapper->setMapping(action, macro->displayName());
|
||||
connect(action, &QAction::triggered, q, [this, macro]() {
|
||||
q->executeMacro(macro->displayName());
|
||||
});
|
||||
|
||||
// Add macro to the map
|
||||
macros[macro->displayName()] = macro;
|
||||
|
||||
Reference in New Issue
Block a user