Add stylehint to use querying RTL keyboard support.
Change-Id: Ic58ed7cb64cc7fe60b4d431e9f29e389c62265fc Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
This commit is contained in:
parent
cf2b5a7722
commit
e8aa56b74b
@ -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;
|
||||
|
@ -133,7 +133,8 @@ public:
|
||||
ShowIsFullScreen,
|
||||
PasswordMaskDelay,
|
||||
FontSmoothingGamma,
|
||||
StartDragVelocity
|
||||
StartDragVelocity,
|
||||
UseRtlExtensions
|
||||
};
|
||||
|
||||
virtual QVariant styleHint(StyleHint hint) const;
|
||||
|
@ -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
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
bool showIsFullScreen() const;
|
||||
int passwordMaskDelay() const;
|
||||
qreal fontSmoothingGamma() const;
|
||||
bool useRtlExtensions() const;
|
||||
|
||||
private:
|
||||
friend class QGuiApplication;
|
||||
|
@ -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<QWindowCreationContext> &ctx)
|
||||
{
|
||||
d->m_creationContext = ctx;
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "qpagedpaintdevice.h"
|
||||
#include "private/qpagedpaintdevice_p.h"
|
||||
#include "qtextdocumentwriter.h"
|
||||
#include "qstylehints.h"
|
||||
#include "private/qtextcursor_p.h"
|
||||
|
||||
#include <qtextformat.h>
|
||||
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user