forked from qt-creator/qt-creator
Context Help support for Bauhaus
Task-number: BAUHAUS-451 Reviewed-by: kkoehne
This commit is contained in:
@@ -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
|
} // namespace QmlDesigner
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public:
|
|||||||
bool isModelSyncBlocked() const;
|
bool isModelSyncBlocked() const;
|
||||||
void blockModelSync(bool block);
|
void blockModelSync(bool block);
|
||||||
|
|
||||||
|
QString contextHelpId() const;
|
||||||
QList<RewriterView::Error> qmlErrors() const;
|
QList<RewriterView::Error> qmlErrors() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -29,13 +29,14 @@
|
|||||||
|
|
||||||
#include "designmodecontext.h"
|
#include "designmodecontext.h"
|
||||||
#include "qmldesignerconstants.h"
|
#include "qmldesignerconstants.h"
|
||||||
|
#include "designmodewidget.h"
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
DesignModeContext::DesignModeContext(QWidget *widget) : IContext(widget),
|
DesignModeContext::DesignModeContext(DesignModeWidget *widget) : IContext(widget),
|
||||||
m_widget(widget)
|
m_widget(widget)
|
||||||
{
|
{
|
||||||
m_context << Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::C_FORMEDITOR);
|
m_context << Core::UniqueIDManager::instance()->uniqueIdentifier(Constants::C_FORMEDITOR);
|
||||||
@@ -56,6 +57,11 @@ QWidget *DesignModeContext::widget()
|
|||||||
return m_widget;
|
return m_widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DesignModeContext::contextHelpId() const
|
||||||
|
{
|
||||||
|
return m_widget->contextHelpId();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,20 +40,25 @@ QT_END_NAMESPACE
|
|||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class DesignModeWidget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bauhaus Design mode context object
|
* Bauhaus Design mode context object
|
||||||
*/
|
*/
|
||||||
class DesignModeContext : public Core::IContext
|
class DesignModeContext : public Core::IContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DesignModeContext(QWidget *widget);
|
DesignModeContext(DesignModeWidget *widget);
|
||||||
~DesignModeContext();
|
~DesignModeContext();
|
||||||
|
|
||||||
QList<int> context() const;
|
QList<int> context() const;
|
||||||
QWidget *widget();
|
QWidget *widget();
|
||||||
|
|
||||||
|
QString contextHelpId() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<int> m_context;
|
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 Internal
|
||||||
} // namespace Designer
|
} // namespace Designer
|
||||||
|
|||||||
@@ -165,8 +165,10 @@ public:
|
|||||||
~DesignModeWidget();
|
~DesignModeWidget();
|
||||||
|
|
||||||
// void syncWithTextEdit(bool sync);
|
// void syncWithTextEdit(bool sync);
|
||||||
|
|
||||||
void showEditor(Core::IEditor *editor);
|
void showEditor(Core::IEditor *editor);
|
||||||
void closeEditors(const QList<Core::IEditor*> editors);
|
void closeEditors(const QList<Core::IEditor*> editors);
|
||||||
|
QString contextHelpId() const;
|
||||||
|
|
||||||
QAction *undoAction() const;
|
QAction *undoAction() const;
|
||||||
QAction *redoAction() const;
|
QAction *redoAction() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user