forked from qt-creator/qt-creator
Context Help support for Bauhaus
Task-number: BAUHAUS-451 Reviewed-by: kkoehne
This commit is contained in:
@@ -416,7 +416,7 @@ void DesignDocumentController::loadCurrentModel()
|
||||
m_d->model->attachView(m_d->navigator.data());
|
||||
m_d->itemLibrary->setMetaInfo(m_d->model->metaInfo());
|
||||
|
||||
if (m_d->formEditorView .isNull()) {
|
||||
if (m_d->formEditorView.isNull()) {
|
||||
m_d->formEditorView = new FormEditorView(this);
|
||||
m_d->stackedWidget->addWidget(m_d->formEditorView->widget());
|
||||
ComponentAction *componentAction = new ComponentAction(m_d->formEditorView->widget());
|
||||
@@ -857,4 +857,19 @@ bool DesignDocumentController::save(QIODevice *device, QString * /*errorMessage*
|
||||
}
|
||||
}
|
||||
|
||||
QString DesignDocumentController::contextHelpId() const
|
||||
{
|
||||
DesignDocumentControllerView view;
|
||||
m_d->model->attachView(&view);
|
||||
|
||||
QList<ModelNode> nodes = view.selectedModelNodes();
|
||||
QString helpId;
|
||||
if (!nodes.isEmpty()) {
|
||||
helpId = nodes.first().type();
|
||||
helpId.replace("Qt/", "QML.");
|
||||
}
|
||||
|
||||
return helpId;
|
||||
}
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -90,6 +90,7 @@ public:
|
||||
bool isModelSyncBlocked() const;
|
||||
void blockModelSync(bool block);
|
||||
|
||||
QString contextHelpId() const;
|
||||
QList<RewriterView::Error> qmlErrors() const;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -29,13 +29,14 @@
|
||||
|
||||
#include "designmodecontext.h"
|
||||
#include "qmldesignerconstants.h"
|
||||
#include "designmodewidget.h"
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <QWidget>
|
||||
|
||||
namespace QmlDesigner {
|
||||
namespace Internal {
|
||||
|
||||
DesignModeContext::DesignModeContext(QWidget *widget) : IContext(widget),
|
||||
DesignModeContext::DesignModeContext(DesignModeWidget *widget) : IContext(widget),
|
||||
m_widget(widget)
|
||||
{
|
||||
m_context << Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::C_FORMEDITOR);
|
||||
@@ -56,6 +57,11 @@ QWidget *DesignModeContext::widget()
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
QString DesignModeContext::contextHelpId() const
|
||||
{
|
||||
return m_widget->contextHelpId();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,20 +40,25 @@ QT_END_NAMESPACE
|
||||
namespace QmlDesigner {
|
||||
namespace Internal {
|
||||
|
||||
class DesignModeWidget;
|
||||
|
||||
/**
|
||||
* Bauhaus Design mode context object
|
||||
*/
|
||||
class DesignModeContext : public Core::IContext
|
||||
{
|
||||
public:
|
||||
DesignModeContext(QWidget *widget);
|
||||
DesignModeContext(DesignModeWidget *widget);
|
||||
~DesignModeContext();
|
||||
|
||||
QList<int> context() const;
|
||||
QWidget *widget();
|
||||
|
||||
QString contextHelpId() const;
|
||||
|
||||
private:
|
||||
QList<int> m_context;
|
||||
QWidget *m_widget;
|
||||
DesignModeWidget *m_widget;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -688,5 +688,12 @@ void DesignModeWidget::setCurrentDocumentWidget(DocumentWidget *newDocumentWidge
|
||||
}
|
||||
}
|
||||
|
||||
QString DesignModeWidget::contextHelpId() const
|
||||
{
|
||||
if (m_currentDocumentWidget)
|
||||
return m_currentDocumentWidget->document()->contextHelpId();
|
||||
return QString();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Designer
|
||||
|
||||
@@ -165,8 +165,10 @@ public:
|
||||
~DesignModeWidget();
|
||||
|
||||
// void syncWithTextEdit(bool sync);
|
||||
|
||||
void showEditor(Core::IEditor *editor);
|
||||
void closeEditors(const QList<Core::IEditor*> editors);
|
||||
QString contextHelpId() const;
|
||||
|
||||
QAction *undoAction() const;
|
||||
QAction *redoAction() const;
|
||||
|
||||
Reference in New Issue
Block a user