diff options
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontengine_win.cpp | 5 | ||||
-rw-r--r-- | src/gui/text/qtextcontrol.cpp | 8 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index fc11387..bb5e041 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -138,8 +138,11 @@ static void resolveGetCharWidthI() { if (resolvedGetCharWidthI) return; + + QSystemLibrary gdi32(QLatin1String("gdi32")); + ptrGetCharWidthI = (PtrGetCharWidthI)gdi32.resolve("GetCharWidthI"); + resolvedGetCharWidthI = true; - ptrGetCharWidthI = (PtrGetCharWidthI)QSystemLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI"); } #endif // !defined(Q_WS_WINCE) 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(); |