diff options
author | J-P Nurmi <j-p.nurmi@nokia.com> | 2012-08-17 10:49:36 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-18 10:58:37 +0200 |
commit | 468c22f6732b5755b68f658dbd7a9c4e9e9601d1 (patch) | |
tree | a7c3a24abd3d2589d5de4ae5b202b0e99e88a82f /src | |
parent | 129c9842ce1f558e2b0ae6165107784b39139a13 (diff) |
Register QTextDocument* as a meta type to fix QTextEdit::document type
Change-Id: I666845049749bfa6f88b764eefaefb0dcf05cb3f
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextdocument_p.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qtextedit.h | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index f76bb51ce1..fb02ad6686 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -320,7 +320,7 @@ QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent) : QObject(*new QSyntaxHighlighterPrivate, parent) { if (parent->inherits("QTextEdit")) { - QTextDocument *doc = qobject_cast<QTextDocument *>(parent->property("document").value<QObject *>()); + QTextDocument *doc = parent->property("document").value<QTextDocument *>(); if (doc) setDocument(doc); } diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index d4ea9827ce..991ede3c6b 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -231,6 +231,8 @@ void QTextDocumentPrivate::init() undoEnabled = undoState; modified = false; modifiedState = 0; + + qRegisterMetaType<QTextDocument *>(); } void QTextDocumentPrivate::clear() diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h index d98531bff4..ab0a5aeb7c 100644 --- a/src/widgets/widgets/qtextedit.h +++ b/src/widgets/widgets/qtextedit.h @@ -86,7 +86,7 @@ class Q_WIDGETS_EXPORT QTextEdit : public QAbstractScrollArea Q_PROPERTY(bool acceptRichText READ acceptRichText WRITE setAcceptRichText) Q_PROPERTY(int cursorWidth READ cursorWidth WRITE setCursorWidth) Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags) - Q_PROPERTY(QObject *document READ document) + Q_PROPERTY(QTextDocument *document READ document WRITE setDocument) public: enum LineWrapMode { NoWrap, |