forked from qt-creator/qt-creator
Core: Use std::function for info bar callbacks
Change-Id: Iae7cbef053bfe86a7692e09f66af91117815d2a6 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user