Core: Use std::function for info bar callbacks

Change-Id: Iae7cbef053bfe86a7692e09f66af91117815d2a6
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
hjk
2014-09-03 10:34:52 +02:00
parent 2e17339b05
commit f70ba9930e
18 changed files with 61 additions and 96 deletions

View File

@@ -41,6 +41,7 @@
#include <QCoreApplication>
#include <QDebug>
using namespace Core;
using namespace Designer::Constants;
namespace Designer {
@@ -62,16 +63,11 @@ Core::IEditor *FormEditorFactory::createEditor()
if (data.formWindowEditor) {
Core::InfoBarEntry info(Core::Id(Constants::INFO_READ_ONLY),
tr("This file can only be edited in <b>Design</b> mode."));
info.setCustomButtonInfo(tr("Switch Mode"), this, SLOT(designerModeClicked()));
info.setCustomButtonInfo(tr("Switch Mode"), []() { ModeManager::activateMode(Core::Constants::MODE_DESIGN); });
data.formWindowEditor->document()->infoBar()->addInfo(info);
}
return data.formWindowEditor;
}
void FormEditorFactory::designerModeClicked()
{
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
}
} // namespace Internal
} // namespace Designer