diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 3021f6373e..d9e9c75920 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -298,6 +298,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const return qreal(1.7); case StartDragVelocity: return 0; // no limit + case UseRtlExtensions: + return QVariant(false); } return 0; diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index ea13a25bab..8ed48b268a 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -133,7 +133,8 @@ public: ShowIsFullScreen, PasswordMaskDelay, FontSmoothingGamma, - StartDragVelocity + StartDragVelocity, + UseRtlExtensions }; virtual QVariant styleHint(StyleHint hint) const; diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index 194b5d3f71..99e37e4a41 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -112,4 +112,9 @@ qreal QStyleHints::fontSmoothingGamma() const return hint(QPlatformIntegration::FontSmoothingGamma).toReal(); } +bool QStyleHints::useRtlExtensions() const +{ + return hint(QPlatformIntegration::UseRtlExtensions).toBool(); +} + QT_END_NAMESPACE diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h index f15679b7d6..a82af89789 100644 --- a/src/gui/kernel/qstylehints.h +++ b/src/gui/kernel/qstylehints.h @@ -65,6 +65,7 @@ public: bool showIsFullScreen() const; int passwordMaskDelay() const; qreal fontSmoothingGamma() const; + bool useRtlExtensions() const; private: friend class QGuiApplication; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index a988aef589..7da9ae1494 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -335,6 +335,11 @@ unsigned QWindowsContext::systemInfo() const return d->m_systemInfo; } +bool QWindowsContext::useRTLExtensions() const +{ + return d->m_keyMapper.useRTLExtensions(); +} + void QWindowsContext::setWindowCreationContext(const QSharedPointer &ctx) { d->m_creationContext = ctx; diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index e95ea7f3f4..0b18196abe 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -172,6 +172,8 @@ public: // Returns a combination of SystemInfoFlags unsigned systemInfo() const; + bool useRTLExtensions() const; + QWindowsMimeConverter &mimeConverter() const; QWindowsScreenManager &screenManager(); #ifndef Q_OS_WINCE diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index fea7fec1af..55662e1fe2 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -408,6 +408,8 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co if (const int ms = GetDoubleClickTime()) return QVariant(ms); break; + case QPlatformIntegration::UseRtlExtensions: + return QVariant(d->m_context.useRTLExtensions()); } return QPlatformIntegration::styleHint(hint); } diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index fc37501ba3..590a006bad 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -50,6 +50,7 @@ #include "qdrawutil.h" #include "qevent.h" #include "qfontmetrics.h" +#include "qstylehints.h" #include "qmenu.h" #include "qpainter.h" #include "qpixmap.h" @@ -1992,10 +1993,6 @@ void QLineEdit::contextMenuEvent(QContextMenuEvent *event) } } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) - extern bool qt_use_rtl_extensions; -#endif - /*! This function creates the standard context menu which is shown when the user clicks on the line edit with the right mouse button. It is called from the default contextMenuEvent() handler. @@ -2055,11 +2052,7 @@ QMenu *QLineEdit::createStandardContextMenu() d->selectAllAction = action; connect(action, SIGNAL(triggered()), SLOT(selectAll())); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) - if (!d->control->isReadOnly() && qt_use_rtl_extensions) { -#else - if (!d->control->isReadOnly()) { -#endif + if (!d->control->isReadOnly() && qApp->styleHints()->useRtlExtensions()) { popup->addSeparator(); QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, popup); popup->addMenu(ctrlCharacterMenu); diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 3448bf8228..b21d7b837e 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -64,6 +64,7 @@ #include "qpagedpaintdevice.h" #include "private/qpagedpaintdevice_p.h" #include "qtextdocumentwriter.h" +#include "qstylehints.h" #include "private/qtextcursor_p.h" #include @@ -95,12 +96,6 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_CONTEXTMENU -#if defined(Q_WS_WIN) || defined(Q_WS_X11) -extern bool qt_use_rtl_extensions; -#endif -#endif - // could go into QTextCursor... static QTextLine currentTextLine(const QTextCursor &cursor) { @@ -2181,11 +2176,7 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget a->setEnabled(!d->doc->isEmpty()); } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) - if ((d->interactionFlags & Qt::TextEditable) && qt_use_rtl_extensions) { -#else - if (d->interactionFlags & Qt::TextEditable) { -#endif + if ((d->interactionFlags & Qt::TextEditable) && qApp->styleHints()->useRtlExtensions()) { menu->addSeparator(); QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, menu); menu->addMenu(ctrlCharacterMenu);