Move keyboard locale and input direction to QInputPanel
Deprecated QGuiApplication::keyboardInputLocale() and keyboardInputDirection(), introduced QInputPanel::locale() and inputDirection(). Change-Id: Ic48c77f10821a949751c73c73f22bd78e2192b9c Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>bb10
parent
a2fd2f90ec
commit
a98741516c
|
|
@ -89,7 +89,7 @@
|
|||
pair; it does not use the system locale database.
|
||||
|
||||
\note For the current keyboard input locale take a look at
|
||||
QApplication::keyboardInputLocale().
|
||||
QInputPanel::locale().
|
||||
|
||||
QLocale's data is based on Common Locale Data Repository v1.8.1.
|
||||
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
California, Berkeley and its contributors.
|
||||
|
||||
\sa QString::arg(), QString::toInt(), QString::toDouble(),
|
||||
QApplication::keyboardInputLocale()
|
||||
QInputPanel::locale()
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@
|
|||
#include <QWindowSystemInterface>
|
||||
#include "private/qwindowsysteminterface_qpa_p.h"
|
||||
#include "private/qwindow_p.h"
|
||||
#include "private/qkeymapper_p.h"
|
||||
#include "private/qcursor_p.h"
|
||||
#include "private/qdnd_p.h"
|
||||
#include <private/qplatformthemefactory_qpa_p.h>
|
||||
|
|
@ -1463,26 +1462,24 @@ uint QGuiApplicationPrivate::currentKeyPlatform()
|
|||
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
|
||||
Returns the current keyboard input locale.
|
||||
Returns the current keyboard input locale. Replaced with QInputPanel::locale()
|
||||
*/
|
||||
QLocale QGuiApplication::keyboardInputLocale()
|
||||
{
|
||||
if (!QGuiApplicationPrivate::checkInstance("keyboardInputLocale"))
|
||||
return QLocale::c();
|
||||
return qt_keymapper_private()->keyboardInputLocale;
|
||||
return qApp ? qApp->inputPanel()->locale() : QLocale::c();
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
|
||||
Returns the current keyboard input direction.
|
||||
Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection()
|
||||
*/
|
||||
Qt::LayoutDirection QGuiApplication::keyboardInputDirection()
|
||||
{
|
||||
if (!QGuiApplicationPrivate::checkInstance("keyboardInputDirection"))
|
||||
return Qt::LeftToRight;
|
||||
return qt_keymapper_private()->keyboardInputDirection;
|
||||
return qApp ? qApp->inputPanel()->inputDirection() : Qt::LeftToRight;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -118,9 +118,8 @@ public:
|
|||
static inline bool isRightToLeft() { return layoutDirection() == Qt::RightToLeft; }
|
||||
static inline bool isLeftToRight() { return layoutDirection() == Qt::LeftToRight; }
|
||||
|
||||
// ### move to QInputPanel
|
||||
static QLocale keyboardInputLocale();
|
||||
static Qt::LayoutDirection keyboardInputDirection();
|
||||
QT_DEPRECATED static QLocale keyboardInputLocale();
|
||||
QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection();
|
||||
|
||||
QStyleHints *styleHints() const;
|
||||
QInputPanel *inputPanel() const;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
#include <qinputpanel.h>
|
||||
#include <private/qinputpanel_p.h>
|
||||
#include "private/qkeymapper_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -247,6 +248,24 @@ bool QInputPanel::isAnimating() const
|
|||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QInputPanel::locale
|
||||
\brief Current input locale.
|
||||
*/
|
||||
QLocale QInputPanel::locale() const
|
||||
{
|
||||
return qt_keymapper_private()->keyboardInputLocale;
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QInputPanel::inputDirection
|
||||
\brief Current input direction.
|
||||
*/
|
||||
Qt::LayoutDirection QInputPanel::inputDirection() const
|
||||
{
|
||||
return qt_keymapper_private()->keyboardInputDirection;
|
||||
}
|
||||
|
||||
/*!
|
||||
Called by the input item to inform the platform input methods when there has been
|
||||
state changes in editor's input method query attributes. When calling the function
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ class Q_GUI_EXPORT QInputPanel : public QObject
|
|||
Q_PROPERTY(QRectF keyboardRectangle READ keyboardRectangle NOTIFY keyboardRectangleChanged)
|
||||
Q_PROPERTY(bool visible READ visible NOTIFY visibleChanged)
|
||||
Q_PROPERTY(bool animating READ isAnimating NOTIFY animatingChanged)
|
||||
Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged)
|
||||
Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged)
|
||||
|
||||
Q_ENUMS(Action)
|
||||
public:
|
||||
|
|
@ -92,6 +94,9 @@ public:
|
|||
|
||||
bool isAnimating() const;
|
||||
|
||||
QLocale locale() const;
|
||||
Qt::LayoutDirection inputDirection() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void show();
|
||||
void hide();
|
||||
|
|
@ -108,6 +113,8 @@ Q_SIGNALS:
|
|||
void keyboardRectangleChanged();
|
||||
void visibleChanged();
|
||||
void animatingChanged();
|
||||
void localeChanged();
|
||||
void inputDirectionChanged(Qt::LayoutDirection newDirection);
|
||||
|
||||
private:
|
||||
friend class QGuiApplication;
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ public:
|
|||
Qt::LayoutDirection layoutDirection() const {
|
||||
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
|
||||
if (m_text.isEmpty())
|
||||
return QGuiApplication::keyboardInputDirection();
|
||||
return qApp->inputPanel()->inputDirection();
|
||||
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
|
||||
}
|
||||
return m_layoutDirection;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@
|
|||
#include <private/qunicodetables_p.h>
|
||||
#include "qtextdocument_p.h"
|
||||
#include <qguiapplication.h>
|
||||
#include <qinputpanel.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
|
|
@ -1408,7 +1409,7 @@ bool QTextEngine::isRightToLeft() const
|
|||
itemize();
|
||||
// this places the cursor in the right position depending on the keyboard layout
|
||||
if (layoutData->string.isEmpty())
|
||||
return QGuiApplication::keyboardInputDirection() == Qt::RightToLeft;
|
||||
return qApp ? qApp->inputPanel()->inputDirection() == Qt::RightToLeft : false;
|
||||
return layoutData->string.isRightToLeft();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
#include "QtWidgets/qstyleoption.h"
|
||||
#include "QtCore/qpointer.h"
|
||||
#include "QtGui/qclipboard.h"
|
||||
#include "QtGui/qinputpanel.h"
|
||||
#include "QtCore/qpoint.h"
|
||||
#include "QtWidgets/qcompleter.h"
|
||||
#include "QtCore/qthread.h"
|
||||
|
|
@ -318,7 +319,7 @@ public:
|
|||
Qt::LayoutDirection layoutDirection() const {
|
||||
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
|
||||
if (m_text.isEmpty())
|
||||
return QApplication::keyboardInputDirection();
|
||||
return qApp->inputPanel()->inputDirection();
|
||||
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
|
||||
}
|
||||
return m_layoutDirection;
|
||||
|
|
|
|||
Loading…
Reference in New Issue