Commit 4f52eb37 authored by hjk's avatar hjk Committed by David Schulz
Browse files

Vcs: Pass EditorWidgetCreator as copy to factory



This is an attempt to solve QTCREATORBUG-13218.
This should not be needed.

Change-Id: Icc41d83cb051ace11708645e5de18eae70746122
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 4eed4830
...@@ -54,7 +54,8 @@ using namespace TextEditor; ...@@ -54,7 +54,8 @@ using namespace TextEditor;
namespace VcsBase { namespace VcsBase {
VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters, VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
const EditorWidgetCreator &editorWidgetCreator, // Force copy, see QTCREATORBUG-13218
const EditorWidgetCreator editorWidgetCreator,
QObject *describeReceiver, const char *describeSlot) QObject *describeReceiver, const char *describeSlot)
{ {
setProperty("VcsEditorFactoryName", QByteArray(parameters->id)); setProperty("VcsEditorFactoryName", QByteArray(parameters->id));
...@@ -66,14 +67,14 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters, ...@@ -66,14 +67,14 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
setEditorActionHandlers(TextEditorActionHandler::None); setEditorActionHandlers(TextEditorActionHandler::None);
setDuplicatedSupported(false); setDuplicatedSupported(false);
setDocumentCreator([=]() -> TextDocument* { setDocumentCreator([this, parameters]() -> TextDocument* {
auto document = new TextDocument(parameters->id); auto document = new TextDocument(parameters->id);
// if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE)) // if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE))
document->setMimeType(QLatin1String(parameters->mimeType)); document->setMimeType(QLatin1String(parameters->mimeType));
return document; return document;
}); });
setEditorWidgetCreator([=]() -> TextEditorWidget* { setEditorWidgetCreator([this, parameters, editorWidgetCreator, describeReceiver, describeSlot]() -> TextEditorWidget* {
auto widget = qobject_cast<VcsBaseEditorWidget *>(editorWidgetCreator()); auto widget = qobject_cast<VcsBaseEditorWidget *>(editorWidgetCreator());
widget->setDescribeSlot(describeReceiver, describeSlot); widget->setDescribeSlot(describeReceiver, describeSlot);
widget->setParameters(parameters); widget->setParameters(parameters);
......
...@@ -44,7 +44,7 @@ class VCSBASE_EXPORT VcsEditorFactory : public TextEditor::TextEditorFactory ...@@ -44,7 +44,7 @@ class VCSBASE_EXPORT VcsEditorFactory : public TextEditor::TextEditorFactory
public: public:
VcsEditorFactory(const VcsBaseEditorParameters *parameters, VcsEditorFactory(const VcsBaseEditorParameters *parameters,
const EditorWidgetCreator &editorWidgetCreator, const EditorWidgetCreator editorWidgetCreator,
QObject *describeReceiver, QObject *describeReceiver,
const char *describeSlot); const char *describeSlot);
......
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