diff options
Diffstat (limited to 'src/gui/text/qtextcontrol.cpp')
-rw-r--r-- | src/gui/text/qtextcontrol.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index aeeef85..5babbc2 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -408,7 +408,6 @@ void QTextControlPrivate::init(Qt::TextFormat format, const QString &text, QText setContent(format, text, document); doc->setUndoRedoEnabled(interactionFlags & Qt::TextEditable); - q->setCursorWidth(-1); } void QTextControlPrivate::setContent(Qt::TextFormat format, const QString &text, QTextDocument *document) @@ -2236,7 +2235,10 @@ int QTextControl::cursorWidth() const { #ifndef QT_NO_PROPERTIES Q_D(const QTextControl); - return d->doc->documentLayout()->property("cursorWidth").toInt(); + int width = d->doc->documentLayout()->property("cursorWidth").toInt(); + if (width == -1) + width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth); + return width; #else return 1; #endif @@ -2248,8 +2250,6 @@ void QTextControl::setCursorWidth(int width) #ifdef QT_NO_PROPERTIES Q_UNUSED(width); #else - if (width == -1) - width = QApplication::style()->pixelMetric(QStyle::PM_TextCursorWidth); d->doc->documentLayout()->setProperty("cursorWidth", width); #endif d->repaintCursor(); |