Fixes: Show help as in standalone Designer (currentProperty).

Task: 235520
Details: Use new integration API #ifdefed for 4.5.1 onwards.
This commit is contained in:
Friedemann Kleint
2009-02-18 11:00:25 +01:00
parent f3141d99c4
commit 1b32bf5b02
2 changed files with 16 additions and 3 deletions

View File

@@ -49,6 +49,7 @@
#include <QtDesigner/QDesignerWidgetDataBaseInterface> #include <QtDesigner/QDesignerWidgetDataBaseInterface>
#include <qt_private/formwindowbase_p.h> #include <qt_private/formwindowbase_p.h>
#include <qt_private/qtresourcemodel_p.h> #include <qt_private/qtresourcemodel_p.h>
#include <qt_private/qdesigner_integration_p.h>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QDir> #include <QtCore/QDir>
@@ -330,9 +331,17 @@ void FormWindowEditor::activate()
QString FormWindowEditor::contextHelpId() const QString FormWindowEditor::contextHelpId() const
{ {
// TODO [13.2.09]: Replace this by QDesignerIntegrations context help Id const QDesignerFormEditorInterface *core = FormEditorW::instance()->designerEditor();
// in the upcoming version of Qt #if QT_VERSION > 0x040500
QDesignerFormEditorInterface *core = FormEditorW::instance()->designerEditor(); // Present from Qt 4.5.1 onwards. This will show the class documentation
// scrolled to the current property.
const qdesigner_internal::QDesignerIntegration *integration =
qobject_cast<const qdesigner_internal::QDesignerIntegration*>(core->integration());
if (integration)
return integration->contextHelpId();
return QString();
#else
// Pre 4.5.1. This will show the class documentation.
QObject *o = core->propertyEditor()->object(); QObject *o = core->propertyEditor()->object();
if (!o) if (!o)
return QString(); return QString();
@@ -347,5 +356,7 @@ QString FormWindowEditor::contextHelpId() const
className = QLatin1String("QSpacerItem"); className = QLatin1String("QSpacerItem");
else if (className == QLatin1String("QLayoutWidget")) else if (className == QLatin1String("QLayoutWidget"))
className = QLatin1String("QLayout"); className = QLatin1String("QLayout");
return className; return className;
#endif
} }

View File

@@ -95,6 +95,8 @@ public:
bool isResourceEditingEnabled() const; bool isResourceEditingEnabled() const;
bool isSlotNavigationEnabled() const; bool isSlotNavigationEnabled() const;
QString contextHelpId() const;
protected: protected:
void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour); // PromptAndReload by default void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour); // PromptAndReload by default