Rename IContext::HelpIdCallback -> IContext::HelpCallback

It no longer takes an ID but a HelpItem.

Change-Id: I0aa738549fea4fcfd0151adc2dfd642c63f0f60d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2019-01-28 11:47:50 +01:00
parent 418dcfbcbb
commit 282805b66d
27 changed files with 40 additions and 40 deletions

View File

@@ -60,7 +60,7 @@ namespace Internal {
// CMakeEditor
//
void CMakeEditor::contextHelp(const HelpIdCallback &callback) const
void CMakeEditor::contextHelp(const HelpCallback &callback) const
{
int pos = position();

View File

@@ -38,7 +38,7 @@ class CMakeEditor : public TextEditor::BaseTextEditor
Q_OBJECT
public:
void contextHelp(const HelpIdCallback &callback) const override;
void contextHelp(const HelpCallback &callback) const override;
friend class CMakeEditorWidget;
};

View File

@@ -74,8 +74,8 @@ public:
virtual Context context() const { return m_context; }
virtual QWidget *widget() const { return m_widget; }
using HelpIdCallback = std::function<void(const HelpItem &id)>;
virtual void contextHelp(const HelpIdCallback &callback) const { callback(m_contextHelp); }
using HelpCallback = std::function<void(const HelpItem &item)>;
virtual void contextHelp(const HelpCallback &callback) const { callback(m_contextHelp); }
virtual void setContext(const Context &context) { m_context = context; }
virtual void setWidget(QWidget *widget) { m_widget = widget; }

View File

@@ -45,7 +45,7 @@ DesignerContext::DesignerContext(const Core::Context &context,
setWidget(widget);
}
void DesignerContext::contextHelp(const HelpIdCallback &callback) const
void DesignerContext::contextHelp(const HelpCallback &callback) const
{
const QDesignerFormEditorInterface *core = FormEditorW::designerEditor();
callback(core->integration()->contextHelpId());

View File

@@ -37,7 +37,7 @@ public:
QWidget *widget,
QObject *parent = nullptr);
void contextHelp(const HelpIdCallback &callback) const override;
void contextHelp(const HelpCallback &callback) const override;
};
} // namespace Internal

View File

@@ -333,7 +333,7 @@ double FormEditorWidget::containerPadding() const
}
void FormEditorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
void FormEditorWidget::contextHelpId(const Core::IContext::HelpCallback &callback) const
{
if (m_formEditorView)
m_formEditorView->contextHelpId(callback);

View File

@@ -64,7 +64,7 @@ public:
double spacing() const;
double containerPadding() const;
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
void contextHelpId(const Core::IContext::HelpCallback &callback) const;
void setRootItemRect(const QRectF &rect);
QRectF rootItemRect() const;

View File

@@ -661,7 +661,7 @@ void DesignDocument::updateCurrentProject()
viewManager().setNodeInstanceViewProject(currentProject);
}
void DesignDocument::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
void DesignDocument::contextHelpId(const Core::IContext::HelpCallback &callback) const
{
if (view())
view()->contextHelpId(callback);

View File

@@ -77,7 +77,7 @@ public:
Model *currentModel() const;
Model *documentModel() const;
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
void contextHelpId(const Core::IContext::HelpCallback &callback) const;
QList<DocumentMessage> qmlParseWarnings() const;
bool hasQmlParseWarnings() const;
QList<DocumentMessage> qmlParseErrors() const;

View File

@@ -158,7 +158,7 @@ QList<QToolButton *> NavigatorWidget::createToolBarWidgets()
return buttons;
}
void NavigatorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
void NavigatorWidget::contextHelpId(const Core::IContext::HelpCallback &callback) const
{
if (navigatorView())
navigatorView()->contextHelpId(callback);

View File

@@ -48,7 +48,7 @@ public:
void setTreeModel(QAbstractItemModel *model);
QTreeView *treeView() const;
QList<QToolButton *> createToolBarWidgets();
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
void contextHelpId(const Core::IContext::HelpCallback &callback) const;
void disableNavigator();
void enableNavigator();

View File

@@ -152,12 +152,12 @@ WidgetInfo TextEditorView::widgetInfo()
return createWidgetInfo(m_widget, nullptr, "TextEditor", WidgetInfo::CentralPane, 0, tr("Text Editor"), DesignerWidgetFlags::IgnoreErrors);
}
void TextEditorView::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
void TextEditorView::contextHelpId(const Core::IContext::HelpCallback &callback) const
{
AbstractView::contextHelpId(callback);
}
void TextEditorView::qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const
void TextEditorView::qmlJSEditorHelpId(const Core::IContext::HelpCallback &callback) const
{
if (m_widget->textEditor())
m_widget->textEditor()->contextHelp(callback);

View File

@@ -69,9 +69,9 @@ public:
// TextEditorView
WidgetInfo widgetInfo() override;
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const override;
void contextHelpId(const Core::IContext::HelpCallback &callback) const override;
void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const;
void qmlJSEditorHelpId(const Core::IContext::HelpCallback &callback) const;
TextEditor::BaseTextEditor *textEditor();

View File

@@ -94,7 +94,7 @@ void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor)
oldEditor->deleteLater();
}
void TextEditorWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
void TextEditorWidget::contextHelpId(const Core::IContext::HelpCallback &callback) const
{
m_textEditorView->contextHelpId(callback);
}

View File

@@ -50,7 +50,7 @@ public:
return m_textEditor.get();
}
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
void contextHelpId(const Core::IContext::HelpCallback &callback) const;
void jumpTextCursorToSelectedModelNode();
void gotoCursorPosition(int line, int column);

View File

@@ -257,7 +257,7 @@ public:
virtual void disableWidget();
virtual void enableWidget();
virtual void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
virtual void contextHelpId(const Core::IContext::HelpCallback &callback) const;
void activateTimeline(const ModelNode &timeline);
void activateTimelineRecording(const ModelNode &timeline);

View File

@@ -96,7 +96,7 @@ public:
void toggleStatesViewExpanded();
void qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const;
void qmlJSEditorHelpId(const Core::IContext::HelpCallback &callback) const;
DesignDocument *currentDesignDocument() const;
bool usesRewriterView(RewriterView *rewriterView);

View File

@@ -577,7 +577,7 @@ void AbstractView::enableWidget()
widgetInfo().widget->setEnabled(true);
}
void AbstractView::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
void AbstractView::contextHelpId(const Core::IContext::HelpCallback &callback) const
{
#ifndef QMLDESIGNER_TEST
QmlDesignerPlugin::instance()->viewManager().qmlJSEditorHelpId(callback);

View File

@@ -424,7 +424,7 @@ void ViewManager::toggleStatesViewExpanded()
d->statesEditorView.toggleStatesViewExpanded();
}
void ViewManager::qmlJSEditorHelpId(const Core::IContext::HelpIdCallback &callback) const
void ViewManager::qmlJSEditorHelpId(const Core::IContext::HelpCallback &callback) const
{
d->textEditorView.qmlJSEditorHelpId(callback);
}

View File

@@ -40,7 +40,7 @@ DesignModeContext::DesignModeContext(QWidget *widget)
setContext(Core::Context(Constants::C_QMLDESIGNER, Constants::C_QT_QUICK_TOOLS_MENU));
}
void DesignModeContext::contextHelp(const HelpIdCallback &callback) const
void DesignModeContext::contextHelp(const HelpCallback &callback) const
{
qobject_cast<DesignModeWidget *>(m_widget)->contextHelpId(callback);
}
@@ -52,7 +52,7 @@ FormEditorContext::FormEditorContext(QWidget *widget)
setContext(Core::Context(Constants::C_QMLFORMEDITOR, Constants::C_QT_QUICK_TOOLS_MENU));
}
void FormEditorContext::contextHelp(const HelpIdCallback &callback) const
void FormEditorContext::contextHelp(const HelpCallback &callback) const
{
qobject_cast<FormEditorWidget *>(m_widget)->contextHelpId(callback);
}
@@ -64,7 +64,7 @@ NavigatorContext::NavigatorContext(QWidget *widget)
setContext(Core::Context(Constants::C_QMLNAVIGATOR, Constants::C_QT_QUICK_TOOLS_MENU));
}
void NavigatorContext::contextHelp(const HelpIdCallback &callback) const
void NavigatorContext::contextHelp(const HelpCallback &callback) const
{
qobject_cast<NavigatorWidget *>(m_widget)->contextHelpId(callback);
}
@@ -76,7 +76,7 @@ TextEditorContext::TextEditorContext(QWidget *widget)
setContext(Core::Context(Constants::C_QMLTEXTEDITOR, Constants::C_QT_QUICK_TOOLS_MENU));
}
void TextEditorContext::contextHelp(const HelpIdCallback &callback) const
void TextEditorContext::contextHelp(const HelpCallback &callback) const
{
qobject_cast<TextEditorWidget *>(m_widget)->contextHelpId(callback);
}

View File

@@ -39,7 +39,7 @@ class DesignModeContext : public Core::IContext
public:
DesignModeContext(QWidget *widget);
void contextHelp(const Core::IContext::HelpIdCallback &callback) const override;
void contextHelp(const Core::IContext::HelpCallback &callback) const override;
};
class FormEditorContext : public Core::IContext
@@ -48,7 +48,7 @@ class FormEditorContext : public Core::IContext
public:
FormEditorContext(QWidget *widget);
void contextHelp(const Core::IContext::HelpIdCallback &callback) const override;
void contextHelp(const Core::IContext::HelpCallback &callback) const override;
};
class NavigatorContext : public Core::IContext
@@ -57,7 +57,7 @@ class NavigatorContext : public Core::IContext
public:
NavigatorContext(QWidget *widget);
void contextHelp(const Core::IContext::HelpIdCallback &callback) const override;
void contextHelp(const Core::IContext::HelpCallback &callback) const override;
};
class TextEditorContext : public Core::IContext
@@ -66,7 +66,7 @@ class TextEditorContext : public Core::IContext
public:
TextEditorContext(QWidget *widget);
void contextHelp(const Core::IContext::HelpIdCallback &callback) const override;
void contextHelp(const Core::IContext::HelpCallback &callback) const override;
};
}

View File

@@ -554,7 +554,7 @@ void DesignModeWidget::showInternalTextEditor()
m_centralTabWidget->switchTo(viewManager().widget("TextEditor"));
}
void DesignModeWidget::contextHelpId(const Core::IContext::HelpIdCallback &callback) const
void DesignModeWidget::contextHelpId(const Core::IContext::HelpCallback &callback) const
{
if (currentDesignDocument())
currentDesignDocument()->contextHelpId(callback);

View File

@@ -61,7 +61,7 @@ public:
DesignModeWidget();
~DesignModeWidget() override;
void contextHelpId(const Core::IContext::HelpIdCallback &callback) const;
void contextHelpId(const Core::IContext::HelpCallback &callback) const;
void initialize();

View File

@@ -71,7 +71,7 @@ void BaseHoverHandler::setPriority(int priority)
void BaseHoverHandler::contextHelpId(TextEditorWidget *widget,
int pos,
const Core::IContext::HelpIdCallback &callback)
const Core::IContext::HelpCallback &callback)
{
m_isContextHelpRequest = true;
@@ -115,7 +115,7 @@ bool BaseHoverHandler::isContextHelpRequest() const
}
void BaseHoverHandler::propagateHelpId(TextEditorWidget *widget,
const Core::IContext::HelpIdCallback &callback)
const Core::IContext::HelpCallback &callback)
{
const Core::HelpItem contextHelp = lastHelpItemIdentified();
widget->setContextHelpItem(contextHelp);

View File

@@ -47,7 +47,7 @@ public:
void contextHelpId(TextEditorWidget *widget,
int pos,
const Core::IContext::HelpIdCallback &callback);
const Core::IContext::HelpCallback &callback);
using ReportPriority = std::function<void(int priority)>;
void checkPriority(TextEditorWidget *widget, int pos, ReportPriority report);
@@ -73,7 +73,7 @@ protected:
bool isContextHelpRequest() const;
void propagateHelpId(TextEditorWidget *widget, const Core::IContext::HelpIdCallback &callback);
void propagateHelpId(TextEditorWidget *widget, const Core::IContext::HelpCallback &callback);
// identifyMatch() is required to report a priority by using the "report" callback.
// It is recommended to use e.g.

View File

@@ -8005,7 +8005,7 @@ void TextEditorWidgetPrivate::updateCursorPosition()
q->ensureCursorVisible();
}
void BaseTextEditor::contextHelp(const HelpIdCallback &callback) const
void BaseTextEditor::contextHelp(const HelpCallback &callback) const
{
editorWidget()->contextHelpItem(callback);
}
@@ -8016,7 +8016,7 @@ void BaseTextEditor::setContextHelp(const HelpItem &item)
editorWidget()->setContextHelpItem(item);
}
void TextEditorWidget::contextHelpItem(const IContext::HelpIdCallback &callback)
void TextEditorWidget::contextHelpItem(const IContext::HelpCallback &callback)
{
if (!d->m_contextHelpItem.isValid() && !d->m_hoverHandlers.isEmpty()) {
d->m_hoverHandlers.first()->contextHelpId(this,

View File

@@ -131,7 +131,7 @@ public:
bool restoreState(const QByteArray &state) override;
QWidget *toolBar() override;
void contextHelp(const HelpIdCallback &callback) const override; // from IContext
void contextHelp(const HelpCallback &callback) const override; // from IContext
void setContextHelp(const Core::HelpItem &item) override;
int currentLine() const override;
@@ -543,7 +543,7 @@ public:
QChar characterAt(int pos) const;
QString textAt(int from, int to) const;
void contextHelpItem(const Core::IContext::HelpIdCallback &callback);
void contextHelpItem(const Core::IContext::HelpCallback &callback);
void setContextHelpItem(const Core::HelpItem &item);
static TextEditorWidget *currentTextEditorWidget();