Commit b14bd3a5 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.designModeWidget: exposing DesignModeWidget

This allows calling cut copy and paste and component managment
from the outside.

Change-Id: Ie784b243f522409e9e778ef0700ac9c2f64e43cd
Reviewed-on: http://codereview.qt-project.org/4994

Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent d39fb3d8
......@@ -94,6 +94,8 @@ const char * const SB_OPENDOCUMENTS = "OpenDocuments";
namespace QmlDesigner {
namespace Internal {
DesignModeWidget *DesignModeWidget::s_instance = 0;
DocumentWarningWidget::DocumentWarningWidget(DesignModeWidget *parent) :
Utils::FakeToolTip(parent),
m_errorMessage(new QLabel("Placeholder", this)),
......@@ -195,6 +197,7 @@ DesignModeWidget::DesignModeWidget(QWidget *parent) :
m_navigatorHistoryCounter(-1),
m_keepNavigatorHistory(false)
{
s_instance = this;
m_undoAction = new QAction(tr("&Undo"), this);
connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo()));
m_redoAction = new QAction(tr("&Redo"), this);
......@@ -228,6 +231,7 @@ DesignModeWidget::DesignModeWidget(QWidget *parent) :
DesignModeWidget::~DesignModeWidget()
{
s_instance = 0;
}
void DesignModeWidget::restoreDefaultView()
......@@ -857,6 +861,17 @@ void DesignModeWidget::onGoForwardClicked()
}
}
void DesignModeWidget::onCrumblePathElementClicked(const QVariant &data)
{
currentDesignDocumentController()->setCrumbleBarInfo(data.value<CrumbleBarInfo>());
}
DesignModeWidget *DesignModeWidget::instance()
{
return s_instance;
}
void DesignModeWidget::resizeEvent(QResizeEvent *event)
{
if (m_warningWidget)
......
......@@ -133,6 +133,9 @@ public:
TextEditor::ITextEditor *textEditor() const {return m_textEditor.data(); }
static DesignModeWidget *instance();
DesignDocumentController *currentDesignDocumentController() const {return m_currentDesignDocumentController.data(); }
private slots:
void undo();
void redo();
......@@ -166,9 +169,7 @@ protected:
void resizeEvent(QResizeEvent *event);
private:
DesignDocumentController *currentDesignDocumentController() const {return m_currentDesignDocumentController.data(); }
void setCurrentDocument(DesignDocumentController *newDesignDocumentController);
//QStackedWidget *m_documentWidgetStack;
QHash<QPlainTextEdit*,QWeakPointer<DesignDocumentController> > m_documentHash;
QWeakPointer<DesignDocumentController> m_currentDesignDocumentController;
......@@ -222,6 +223,8 @@ private:
QStringList m_navigatorHistory;
int m_navigatorHistoryCounter;
bool m_keepNavigatorHistory;
static DesignModeWidget *s_instance;
};
} // namespace Internal
......
TEMPLATE = lib
TARGET = QmlDesigner
INCLUDEPATH += $$PWD
include(../../qtcreatorplugin.pri)
include(../../private_headers.pri)
include(qmldesigner_dependencies.pri)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment