QWidgetTextControl: Get rid of dependency on QTextEditPrivate
QWidgetTextControl is a base class for controls of text widgets and widget-specific code should be used in derived classes, so override loadResource() in QTextEditControl. Change-Id: I6d829ead0837419530094d19e0ca53a964413e92 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
941101bd5f
commit
1a9ebfabcd
@ -105,6 +105,14 @@ public:
|
||||
else
|
||||
ed->insertFromMimeData(source);
|
||||
}
|
||||
QVariant loadResource(int type, const QUrl &name) override {
|
||||
auto *ed = qobject_cast<QTextEdit *>(parent());
|
||||
if (!ed)
|
||||
return QWidgetTextControl::loadResource(type, name);
|
||||
|
||||
QUrl resolvedName = ed->d_func()->resolveUrl(name);
|
||||
return ed->loadResource(type, resolvedName);
|
||||
}
|
||||
};
|
||||
|
||||
QTextEditPrivate::QTextEditPrivate()
|
||||
|
@ -57,9 +57,6 @@
|
||||
#include <qtimer.h>
|
||||
#include "private/qtextdocumentlayout_p.h"
|
||||
#include "private/qabstracttextdocumentlayout_p.h"
|
||||
#if QT_CONFIG(textedit)
|
||||
#include "private/qtextedit_p.h"
|
||||
#endif
|
||||
#include "qtextdocument.h"
|
||||
#include "private/qtextdocument_p.h"
|
||||
#include "qtextlist.h"
|
||||
@ -1365,15 +1362,8 @@ process:
|
||||
|
||||
QVariant QWidgetTextControl::loadResource(int type, const QUrl &name)
|
||||
{
|
||||
#if !QT_CONFIG(textedit)
|
||||
Q_UNUSED(type);
|
||||
Q_UNUSED(name);
|
||||
#else
|
||||
if (QTextEdit *textEdit = qobject_cast<QTextEdit *>(parent())) {
|
||||
QUrl resolvedName = textEdit->d_func()->resolveUrl(name);
|
||||
return textEdit->loadResource(type, resolvedName);
|
||||
}
|
||||
#endif
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user