forked from qt-creator/qt-creator
Designmode/Designer: Fix uic code model support.
...to use new editor. Reviewed-by: Lasse Holmstedt <lasse.holmstedt@nokia.com>
This commit is contained in:
@@ -37,8 +37,8 @@
|
|||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
using namespace Designer::Internal;
|
namespace Designer {
|
||||||
|
namespace Internal {
|
||||||
DesignerXmlEditor::DesignerXmlEditor(QWidget *parent) : TextEditor::PlainTextEditor(parent)
|
DesignerXmlEditor::DesignerXmlEditor(QWidget *parent) : TextEditor::PlainTextEditor(parent)
|
||||||
{
|
{
|
||||||
setReadOnly(true);
|
setReadOnly(true);
|
||||||
@@ -74,11 +74,14 @@ void DesignerXmlEditor::designerOpened()
|
|||||||
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_DESIGN);
|
Core::ICore::instance()->modeManager()->activateMode(Core::Constants::MODE_DESIGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Internal
|
||||||
|
|
||||||
QString DesignerXmlEditorEditable::id() const
|
QString DesignerXmlEditorEditable::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String(Designer::Constants::K_DESIGNER_XML_EDITOR_ID);
|
return QLatin1String(Designer::Constants::K_DESIGNER_XML_EDITOR_ID);
|
||||||
}
|
}
|
||||||
DesignerXmlEditorEditable::DesignerXmlEditorEditable(DesignerXmlEditor *editor)
|
|
||||||
|
DesignerXmlEditorEditable::DesignerXmlEditorEditable(Internal::DesignerXmlEditor *editor)
|
||||||
: TextEditor::PlainTextEditorEditable(editor)
|
: TextEditor::PlainTextEditorEditable(editor)
|
||||||
{
|
{
|
||||||
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
||||||
@@ -96,3 +99,4 @@ Core::IEditor *DesignerXmlEditorEditable::duplicate(QWidget *parent)
|
|||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
} // namespace Designer
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#ifndef DESIGNERXMLEDITOR_H
|
#ifndef DESIGNERXMLEDITOR_H
|
||||||
#define DESIGNERXMLEDITOR_H
|
#define DESIGNERXMLEDITOR_H
|
||||||
|
|
||||||
|
#include "designer_export.h"
|
||||||
#include <texteditor/plaintexteditor.h>
|
#include <texteditor/plaintexteditor.h>
|
||||||
#include <texteditor/basetexteditor.h>
|
#include <texteditor/basetexteditor.h>
|
||||||
|
|
||||||
@@ -39,15 +40,16 @@ namespace Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class DesignerXmlEditor;
|
class DesignerXmlEditor;
|
||||||
|
}
|
||||||
|
|
||||||
class DesignerXmlEditorEditable : public TextEditor::PlainTextEditorEditable
|
class DESIGNER_EXPORT DesignerXmlEditorEditable : public TextEditor::PlainTextEditorEditable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DesignerXmlEditorEditable(DesignerXmlEditor *editor);
|
explicit DesignerXmlEditorEditable(Internal::DesignerXmlEditor *editor);
|
||||||
QList<int> context() const;
|
QList<int> context() const;
|
||||||
|
|
||||||
bool duplicateSupported() const { return false; }
|
bool duplicateSupported() const { return false; }
|
||||||
@@ -63,11 +65,13 @@ private:
|
|||||||
* read/write editor too, but due to lack of XML editor, highlighting and other such
|
* read/write editor too, but due to lack of XML editor, highlighting and other such
|
||||||
* functionality, editing is disabled.
|
* functionality, editing is disabled.
|
||||||
*/
|
*/
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
class DesignerXmlEditor : public TextEditor::PlainTextEditor
|
class DesignerXmlEditor : public TextEditor::PlainTextEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
DesignerXmlEditor(QWidget *parent = 0);
|
explicit DesignerXmlEditor(QWidget *parent = 0);
|
||||||
virtual ~DesignerXmlEditor();
|
virtual ~DesignerXmlEditor();
|
||||||
bool open(const QString &fileName = QString());
|
bool open(const QString &fileName = QString());
|
||||||
|
|
||||||
@@ -79,8 +83,6 @@ protected:
|
|||||||
virtual TextEditor::BaseTextEditorEditable *createEditableInterface() { return new DesignerXmlEditorEditable(this); }
|
virtual TextEditor::BaseTextEditorEditable *createEditableInterface() { return new DesignerXmlEditorEditable(this); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
namespace Designer {
|
namespace Designer {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
|
||||||
FormEditorStack::FormEditorStack() : activeEditor(0)
|
FormEditorStack::FormEditorStack() : activeEditor(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ namespace Core {
|
|||||||
|
|
||||||
namespace Designer {
|
namespace Designer {
|
||||||
class FormWindowEditor;
|
class FormWindowEditor;
|
||||||
|
class DesignerXmlEditorEditable;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class DesignerXmlEditorEditable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A wrapper for Qt Designer form editors, so that they can be used in Design mode.
|
* A wrapper for Qt Designer form editors, so that they can be used in Design mode.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <designer/formwindoweditor.h>
|
#include <designer/designerxmleditor.h>
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
@@ -115,7 +115,7 @@ void Qt4Manager::init()
|
|||||||
void Qt4Manager::editorChanged(Core::IEditor *editor)
|
void Qt4Manager::editorChanged(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
// Handle old editor
|
// Handle old editor
|
||||||
Designer::FormWindowEditor *lastFormEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor);
|
Designer::DesignerXmlEditorEditable *lastFormEditor = qobject_cast<Designer::DesignerXmlEditorEditable *>(m_lastEditor);
|
||||||
if (lastFormEditor) {
|
if (lastFormEditor) {
|
||||||
disconnect(lastFormEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
disconnect(lastFormEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ void Qt4Manager::editorChanged(Core::IEditor *editor)
|
|||||||
m_lastEditor = editor;
|
m_lastEditor = editor;
|
||||||
|
|
||||||
// Handle new editor
|
// Handle new editor
|
||||||
if (Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(editor))
|
if (Designer::DesignerXmlEditorEditable *fw = qobject_cast<Designer::DesignerXmlEditorEditable *>(editor))
|
||||||
connect(fw, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
connect(fw, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ void Qt4Manager::editorAboutToClose(Core::IEditor *editor)
|
|||||||
if (m_lastEditor == editor) {
|
if (m_lastEditor == editor) {
|
||||||
// Oh no our editor is going to be closed
|
// Oh no our editor is going to be closed
|
||||||
// get the content first
|
// get the content first
|
||||||
Designer::FormWindowEditor *lastEditor = qobject_cast<Designer::FormWindowEditor *>(m_lastEditor);
|
Designer::DesignerXmlEditorEditable *lastEditor = qobject_cast<Designer::DesignerXmlEditorEditable *>(m_lastEditor);
|
||||||
if (lastEditor) {
|
if (lastEditor) {
|
||||||
disconnect(lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
disconnect(lastEditor, SIGNAL(changed()), this, SLOT(uiEditorContentsChanged()));
|
||||||
if (m_dirty) {
|
if (m_dirty) {
|
||||||
@@ -158,7 +158,7 @@ void Qt4Manager::uiEditorContentsChanged()
|
|||||||
// cast sender, get filename
|
// cast sender, get filename
|
||||||
if (m_dirty)
|
if (m_dirty)
|
||||||
return;
|
return;
|
||||||
Designer::FormWindowEditor *fw = qobject_cast<Designer::FormWindowEditor *>(sender());
|
Designer::DesignerXmlEditorEditable *fw = qobject_cast<Designer::DesignerXmlEditorEditable *>(sender());
|
||||||
if (!fw)
|
if (!fw)
|
||||||
return;
|
return;
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user