forked from qt-creator/qt-creator
Fix showing of info bar in .ui text editor.
Removes another useless IEditorFactor::open implementation Change-Id: I01d3c46131e8e3d6dcce1f0e338bc7d637153e98 Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -66,23 +66,15 @@ QString FormEditorFactory::displayName() const
|
||||
return qApp->translate("Designer", C_DESIGNER_XML_DISPLAY_NAME);
|
||||
}
|
||||
|
||||
Core::IDocument *FormEditorFactory::open(const QString &fileName)
|
||||
{
|
||||
Core::IEditor *iface = Core::EditorManager::openEditor(fileName, id());
|
||||
if (!iface)
|
||||
return 0;
|
||||
if (qobject_cast<FormWindowEditor *>(iface)) {
|
||||
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()));
|
||||
iface->document()->infoBar()->addInfo(info);
|
||||
}
|
||||
return iface->document();
|
||||
}
|
||||
|
||||
Core::IEditor *FormEditorFactory::createEditor(QWidget *parent)
|
||||
{
|
||||
const EditorData data = FormEditorW::instance()->createEditor(parent);
|
||||
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()));
|
||||
data.formWindowEditor->document()->infoBar()->addInfo(info);
|
||||
}
|
||||
return data.formWindowEditor;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ public:
|
||||
QStringList mimeTypes() const;
|
||||
Core::Id id() const;
|
||||
QString displayName() const;
|
||||
Core::IDocument *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
private slots:
|
||||
|
||||
Reference in New Issue
Block a user