diff --git a/dist/changes-5.9.0 b/dist/changes-5.9.0 new file mode 100644 index 0000000000000000000000000000000000000000..5fbf85e519596bcf667d996b2a6e1d9012662e82 --- /dev/null +++ b/dist/changes-5.9.0 @@ -0,0 +1,34 @@ +Qt 5.9 introduces many new features and improvements as well as bugfixes +over the 5.8.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* New Features * +**************************************************************************** + + - Changed behavior of shift handler to only activate + caps lock if the shift key is double-clicked. + - Added support for selection handles for the dedicated VKB. + - [QTBUG-54254] Add support for external keyboard layouts, which allows + overriding and exclusion of the built-in keyboard layouts + - Add new property InputContext.uppercase, which is set to + true when either InputContext.shift or InputContext.capsLock is true + - Added language selection popup for faster selection of + input language. + - Automatically hide word candidate list when inactive. + - Added support for automatic selection of the only remaining + word in the suggestion list. + - Added full screen input mode for super wide screens. diff --git a/examples/virtualkeyboard/basic/basic.pro b/examples/virtualkeyboard/basic/basic.pro index 2e0c6f6869fbab11d589ee4e125672b20c8abed3..b91df554f6c06214cf889ceba662d695901bc5d2 100644 --- a/examples/virtualkeyboard/basic/basic.pro +++ b/examples/virtualkeyboard/basic/basic.pro @@ -29,7 +29,7 @@ disable-xcb { CONFIG += disable-desktop } -disable-desktop|!isEmpty(CROSS_COMPILE)|qnx { +disable-desktop|android-embedded|!isEmpty(CROSS_COMPILE)|qnx { DEFINES += MAIN_QML=\\\"basic-b2qt.qml\\\" } else { DEFINES += MAIN_QML=\\\"Basic.qml\\\" diff --git a/qtvirtualkeyboard.pro b/qtvirtualkeyboard.pro index 2f211cd49206eb7ef55eb21169b3ab38153bf05c..8af5ef4ba1a673c9033ff093c6a497136af2078c 100644 --- a/qtvirtualkeyboard.pro +++ b/qtvirtualkeyboard.pro @@ -1,3 +1,3 @@ OTHER_FILES += README.md - +requires(qtHaveModule(quick)) load(qt_parts) diff --git a/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro b/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro index ffa17bfd0dbba1c4cae196069a79b61a63f12779..485ee5dc19cc3adf63bf95d9302d9cc1c493b150 100644 --- a/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro +++ b/src/virtualkeyboard/3rdparty/pinyin/pinyin.pro @@ -54,4 +54,6 @@ load(qt_helper_lib) win32 { CONFIG += qt QT = core +} else { + LIBS += -pthread } diff --git a/src/virtualkeyboard/content/components/ChangeLanguageKey.qml b/src/virtualkeyboard/content/components/ChangeLanguageKey.qml index ba4becdefa9eb0d626cb1c93bf70764bffad8559..b14e70f46187a2112b45db2e6e07bbeeb2d806c2 100644 --- a/src/virtualkeyboard/content/components/ChangeLanguageKey.qml +++ b/src/virtualkeyboard/content/components/ChangeLanguageKey.qml @@ -47,7 +47,7 @@ import QtQuick.VirtualKeyboard.Styles 2.1 \li Toggle mode \endlist - The popup mode is enabled by \l {KeyboardStyle.languagePopupListEnabled} property. + The popup mode is enabled by the \l {KeyboardStyle::languagePopupListEnabled} property. If enabled, a key press will open a popup list with available languages. Otherwise it will cycle to the next available input language. */ diff --git a/src/virtualkeyboard/desktopinputpanel.cpp b/src/virtualkeyboard/desktopinputpanel.cpp index aad97e667278abc4ccd3f54cdc29d58fafbcbc35..e9a8836a2221b74195fb1586aa155d38998df40a 100644 --- a/src/virtualkeyboard/desktopinputpanel.cpp +++ b/src/virtualkeyboard/desktopinputpanel.cpp @@ -152,7 +152,8 @@ void DesktopInputPanel::createView() } d->view->setColor(QColor(Qt::transparent)); d->view->setSource(QUrl("qrc:///QtQuick/VirtualKeyboard/content/InputPanel.qml")); - connect(qGuiApp, SIGNAL(aboutToQuit()), SLOT(destroyView())); + if (QGuiApplication *app = qGuiApp) + connect(app, SIGNAL(aboutToQuit()), SLOT(destroyView())); } } diff --git a/src/virtualkeyboard/desktopinputselectioncontrol.cpp b/src/virtualkeyboard/desktopinputselectioncontrol.cpp index ec7f962e1074422af8eedfb950ce37f20d915c27..7ecf0f6cb416ed6fcea3c8ce983a77565403be84 100644 --- a/src/virtualkeyboard/desktopinputselectioncontrol.cpp +++ b/src/virtualkeyboard/desktopinputselectioncontrol.cpp @@ -180,7 +180,10 @@ void DesktopInputSelectionControl::createHandles() m_cursorSelectionHandle.reset(new InputSelectionHandle(this, focusWindow)); reloadGraphics(); - connect(QCoreApplication::instance(), &QCoreApplication::aboutToQuit, this, &DesktopInputSelectionControl::destroyHandles); + if (QCoreApplication *app = QCoreApplication::instance()) { + connect(app, &QCoreApplication::aboutToQuit, + this, &DesktopInputSelectionControl::destroyHandles); + } } } diff --git a/src/virtualkeyboard/desktopinputselectioncontrol.h b/src/virtualkeyboard/desktopinputselectioncontrol.h index b138c93739fcc894a2d8e47906d03b39ea11087d..9a5ec468c70c79dfda2dca019a63f3e81f76d422 100644 --- a/src/virtualkeyboard/desktopinputselectioncontrol.h +++ b/src/virtualkeyboard/desktopinputselectioncontrol.h @@ -44,6 +44,8 @@ class InputSelectionHandle; class DesktopInputSelectionControl : public QObject { + Q_OBJECT + public: DesktopInputSelectionControl(QObject *parent, InputContext *inputContext); ~DesktopInputSelectionControl() {} diff --git a/src/virtualkeyboard/doc/src/deployment-guide.qdoc b/src/virtualkeyboard/doc/src/deployment-guide.qdoc index 516c00a30f93d90fd54b7653fab42e19e470f9bc..c3729d8499d809e3968928995fd3bcc536667f63 100644 --- a/src/virtualkeyboard/doc/src/deployment-guide.qdoc +++ b/src/virtualkeyboard/doc/src/deployment-guide.qdoc @@ -75,17 +75,22 @@ for using the plugin: \li \c Desktop: Qt Virtual Keyboard is integrated with Qt 5 and requires no changes to existing applications. The Qt Virtual Keyboard input method is available to all of the Qt 5 applications in the system. + + In this integration method, the keyboard is shown in a dedicated + top-level window. \li \c Application: Qt Virtual Keyboard is integrated with Qt 5, but requires changes to particular applications using Qt Virtual Keyboard. This method is mandatory in a Boot2Qt environment, but can be used in desktop applications too. + + In this integration method, the keyboard is shown in the same Qt Quick + scene as the application. \endlist The integration method is automatically selected by the project files. However, in desktop environments, it is possible to override the desktop -integration method and use the application integration method instead. -This happens by adding the \c CONFIG+=disable-desktop to the \c qmake -command line. +integration method and use the application integration method instead, +by adding \c CONFIG+=disable-desktop to the \c qmake command line. \note The desktop integration method is not currently available in Boot2Qt environments. diff --git a/src/virtualkeyboard/enterkeyaction.h b/src/virtualkeyboard/enterkeyaction.h index 5fa9d6d0ad21dc63d9549a9c92cb136e7f41f270..b78e09ec4a3ea641408d173f4aaa67ffc9bd461c 100644 --- a/src/virtualkeyboard/enterkeyaction.h +++ b/src/virtualkeyboard/enterkeyaction.h @@ -39,7 +39,6 @@ class EnterKeyActionAttachedType; class EnterKeyAction : public QObject { Q_OBJECT - Q_ENUMS(Id) public: enum Id { @@ -51,6 +50,8 @@ public: Done }; + Q_ENUM(Id) + public: static EnterKeyActionAttachedType *qmlAttachedProperties(QObject *object); }; diff --git a/src/virtualkeyboard/hunspellworker.cpp b/src/virtualkeyboard/hunspellworker.cpp index ff937578c077a729af5f195a8bbea1ae7470e7d6..ec418f50f3c63a3c0c611a42cb8f6fedafcdf00d 100644 --- a/src/virtualkeyboard/hunspellworker.cpp +++ b/src/virtualkeyboard/hunspellworker.cpp @@ -32,6 +32,7 @@ #include <QVector> #include <QTextCodec> #include <QFileInfo> +#include <QRegExp> #include <QTime> namespace QtVirtualKeyboard { @@ -78,9 +79,9 @@ void HunspellLoadDictionaryTask::run() QString affPath; QString dicPath; for (const QString &searchPath : searchPaths) { - affPath = QStringLiteral("%1/%2.aff").arg(searchPath).arg(locale); + affPath = QStringLiteral("%1/%2.aff").arg(searchPath, locale); if (QFileInfo::exists(affPath)) { - dicPath = QStringLiteral("%1/%2.dic").arg(searchPath).arg(locale); + dicPath = QStringLiteral("%1/%2.dic").arg(searchPath, locale); if (QFileInfo::exists(dicPath)) break; dicPath.clear(); diff --git a/src/virtualkeyboard/hunspellworker.h b/src/virtualkeyboard/hunspellworker.h index 71025b9184af49dcd8f7c8505ed7417098007ece..43fb07e4ebcc28c49e98297ee95b70c0c7f5f159 100644 --- a/src/virtualkeyboard/hunspellworker.h +++ b/src/virtualkeyboard/hunspellworker.h @@ -147,7 +147,7 @@ private: QSemaphore taskSema; QMutex taskLock; Hunhandle *hunspell; - bool abort; + QAtomicInteger<bool> abort; }; } // namespace QtVirtualKeyboard diff --git a/src/virtualkeyboard/inputcontext.cpp b/src/virtualkeyboard/inputcontext.cpp index 6bdd04207aa20742cf84ceda14145bf7feee86e8..b0a81f3236a431ac7ef37e26a7abf9d0016dbed3 100644 --- a/src/virtualkeyboard/inputcontext.cpp +++ b/src/virtualkeyboard/inputcontext.cpp @@ -732,8 +732,15 @@ void InputContext::update(Qt::InputMethodQueries queries) Qt::InputMethodHints inputMethodHints = Qt::InputMethodHints(imQueryEvent.value(Qt::ImHints).toInt()); const int cursorPosition = imQueryEvent.value(Qt::ImCursorPosition).toInt(); const int anchorPosition = imQueryEvent.value(Qt::ImAnchorPosition).toInt(); - QRectF anchorRectangle = qApp->inputMethod()->anchorRectangle(); - QRectF cursorRectangle = qApp->inputMethod()->cursorRectangle(); + QRectF anchorRectangle; + QRectF cursorRectangle; + if (const QGuiApplication *app = qApp) { + anchorRectangle = app->inputMethod()->anchorRectangle(); + cursorRectangle = app->inputMethod()->cursorRectangle(); + } else { + anchorRectangle = d->anchorRectangle; + cursorRectangle = d->cursorRectangle; + } QString surroundingText = imQueryEvent.value(Qt::ImSurroundingText).toString(); QString selectedText = imQueryEvent.value(Qt::ImCurrentSelection).toString(); diff --git a/src/virtualkeyboard/inputengine.h b/src/virtualkeyboard/inputengine.h index c7ef5fd6bd921a9a5d84a4b21e17064b2278dc41..ce0122ac73fc854b43c740e58a46ae0caf0bff20 100644 --- a/src/virtualkeyboard/inputengine.h +++ b/src/virtualkeyboard/inputengine.h @@ -46,9 +46,6 @@ class InputEngine : public QObject Q_OBJECT Q_DISABLE_COPY(InputEngine) Q_DECLARE_PRIVATE(InputEngine) - Q_ENUMS(TextCase) - Q_ENUMS(InputMode) - Q_ENUMS(PatternRecognitionMode) Q_FLAGS(ReselectFlags) Q_PROPERTY(Qt::Key activeKey READ activeKey NOTIFY activeKeyChanged) Q_PROPERTY(Qt::Key previousKey READ previousKey NOTIFY previousKeyChanged) @@ -87,6 +84,10 @@ public: WordAfterCursor = 0x2, WordAtCursor = WordBeforeCursor | WordAfterCursor }; + + Q_ENUM(TextCase) + Q_ENUM(InputMode) + Q_ENUM(PatternRecognitionMode) Q_DECLARE_FLAGS(ReselectFlags, ReselectFlag) public: diff --git a/src/virtualkeyboard/inputselectionhandle.h b/src/virtualkeyboard/inputselectionhandle.h index fa2f1e139b4a21b4094490a2da10911d7a66a60f..e4c3e91063ca976a421b83da06e931b5754208bf 100644 --- a/src/virtualkeyboard/inputselectionhandle.h +++ b/src/virtualkeyboard/inputselectionhandle.h @@ -42,13 +42,15 @@ class DesktopInputSelectionControl; class InputSelectionHandle : public QRasterWindow { + Q_OBJECT + public: InputSelectionHandle(DesktopInputSelectionControl *control, QWindow *eventWindow); void applyImage(const QSize &windowSize); protected: void paintEvent(QPaintEvent *pe) Q_DECL_OVERRIDE; - bool event(QEvent *event); + bool event(QEvent *event) Q_DECL_OVERRIDE; private: DesktopInputSelectionControl *m_control; diff --git a/src/virtualkeyboard/lipiworker.h b/src/virtualkeyboard/lipiworker.h index 3f84ec9f2b60275920eba4c712c649361a2c39d7..676a23412a8627f1ced70dd21ae3df788d6dd489 100644 --- a/src/virtualkeyboard/lipiworker.h +++ b/src/virtualkeyboard/lipiworker.h @@ -140,7 +140,7 @@ private: QSemaphore taskSema; QMutex taskLock; LTKShapeRecognizer *shapeRecognizer; - bool abort; + QAtomicInteger<bool> abort; }; } // namespace QtVirtualKeyboard diff --git a/src/virtualkeyboard/selectionlistmodel.cpp b/src/virtualkeyboard/selectionlistmodel.cpp index 4aa099273ff230dfe0d66c65cb0e5b39e9dbbe63..7606a1c6280f6eac10cd1695986b3bcdf4dafd36 100644 --- a/src/virtualkeyboard/selectionlistmodel.cpp +++ b/src/virtualkeyboard/selectionlistmodel.cpp @@ -246,7 +246,7 @@ void SelectionListModel::selectionListChanged(int type) if (newCount) { int changedCount = qMin(oldCount, newCount); if (changedCount) - dataChanged(index(0), index(changedCount - 1)); + emit dataChanged(index(0), index(changedCount - 1)); if (oldCount > newCount) { beginRemoveRows(QModelIndex(), newCount, oldCount - 1); d->rowCount = newCount; diff --git a/src/virtualkeyboard/selectionlistmodel.h b/src/virtualkeyboard/selectionlistmodel.h index 47153558f58b6d991b85ce68c61d7f1c887fc617..f129637bf8d20f2b82c64c15cada1cd02f41422e 100644 --- a/src/virtualkeyboard/selectionlistmodel.h +++ b/src/virtualkeyboard/selectionlistmodel.h @@ -41,8 +41,6 @@ class SelectionListModelPrivate; class SelectionListModel : public QAbstractListModel { Q_OBJECT - Q_ENUMS(Type) - Q_ENUMS(Role) Q_DECLARE_PRIVATE(SelectionListModel) Q_PROPERTY(int count READ count NOTIFY countChanged) @@ -59,6 +57,9 @@ public: WordCompletionLengthRole = Qt::UserRole + 1 }; + Q_ENUM(Type) + Q_ENUM(Role) + ~SelectionListModel(); void setDataSource(AbstractInputMethod *dataSource, Type type); AbstractInputMethod *dataSource() const; diff --git a/src/virtualkeyboard/shifthandler.cpp b/src/virtualkeyboard/shifthandler.cpp index c40fd78eb3a25c089c6fd169aedd686300376ea7..376410e3fc12e11dfab8e904f52be1f3a8a44381 100644 --- a/src/virtualkeyboard/shifthandler.cpp +++ b/src/virtualkeyboard/shifthandler.cpp @@ -259,7 +259,8 @@ void ShiftHandler::autoCapitalize() void ShiftHandler::restart() { Q_D(ShiftHandler); - if (!qGuiApp->inputMethod()->isVisible()) { + const QGuiApplication *app = qGuiApp; + if (!app || !app->inputMethod()->isVisible()) { d->resetWhenVisible = true; return; } @@ -282,7 +283,11 @@ void ShiftHandler::localeChanged() void ShiftHandler::inputMethodVisibleChanged() { Q_D(ShiftHandler); - if (d->resetWhenVisible && qGuiApp->inputMethod()->isVisible()) { + if (!d->resetWhenVisible) + return; + + const QGuiApplication *app = qGuiApp; + if (app && app->inputMethod()->isVisible()) { d->resetWhenVisible = false; reset(); } diff --git a/src/virtualkeyboard/styles/KeyboardStyle.qml b/src/virtualkeyboard/styles/KeyboardStyle.qml index f0095146218008c8d41aeaefcf7c43138ed38c03..1d1c8222cb76010b5b9d34a53a674967195fc5b8 100644 --- a/src/virtualkeyboard/styles/KeyboardStyle.qml +++ b/src/virtualkeyboard/styles/KeyboardStyle.qml @@ -521,7 +521,7 @@ QtObject { This property holds the selected text color for the full screen input field. - The default color is set to \l full screenInputColor. + The default color is set to \c fullScreenInputColor. */ property color fullScreenInputSelectedTextColor: fullScreenInputColor } diff --git a/src/virtualkeyboard/styles/styles_plugin.h b/src/virtualkeyboard/styles/styles_plugin.h index f401fdb9188779fce14bcd273abada2472505c01..9673a23af430beb24dc4dff2ca04611a5b852d02 100644 --- a/src/virtualkeyboard/styles/styles_plugin.h +++ b/src/virtualkeyboard/styles/styles_plugin.h @@ -32,12 +32,20 @@ #include <QQmlExtensionPlugin> +static void initResources() +{ +#ifdef QT_STATIC + Q_INIT_RESOURCE(qmake_QtQuick_VirtualKeyboard_Styles); +#endif +} + class QtVirtualKeyboardStylesPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) public: + QtVirtualKeyboardStylesPlugin(QObject *parent = 0) : QQmlExtensionPlugin(parent) { initResources(); } void registerTypes(const char *uri); void initializeEngine(QQmlEngine *engine, const char *uri); }; diff --git a/src/virtualkeyboard/t9writeworker.h b/src/virtualkeyboard/t9writeworker.h index 9a6994ae04fde14aeea900df82c0e87d03833286..23a4cf026615891b4caf68d46a722d4974196474 100644 --- a/src/virtualkeyboard/t9writeworker.h +++ b/src/virtualkeyboard/t9writeworker.h @@ -175,7 +175,7 @@ private: QSemaphore taskSema; QMutex taskLock; DECUMA_SESSION *decumaSession; - bool abort; + QAtomicInteger<bool> abort; }; } // namespace QtVirtualKeyboard diff --git a/src/virtualkeyboard/trace.cpp b/src/virtualkeyboard/trace.cpp index 683858af241d3682889f45a3d17ec1a165400082..e74793e1206eedfaa6bb5702bcc5d55fb52cbfab 100644 --- a/src/virtualkeyboard/trace.cpp +++ b/src/virtualkeyboard/trace.cpp @@ -104,10 +104,10 @@ public: Trace objects are owned by their creator, which is the input method in normal case. This means the objects are constructed in the - \l {InputMethod.traceBegin()} (QML) method. + \l {InputMethod::traceBegin()}{InputMethod.traceBegin()} (QML) method. By definition, the trace object can be destroyed at earliest in the - \l {InputMethod.traceEnd()} (QML) method. + \l {InputMethod::traceEnd()}{InputMethod.traceEnd()} (QML) method. */ /*! @@ -166,10 +166,10 @@ public: Trace objects are owned by their creator, which is the input method in normal case. This means the objects are constructed in the - \l {InputMethod.traceBegin()} (QML) method. + \l {InputMethod::traceBegin()}{InputMethod.traceBegin()} (QML) method. By definition, the trace object can be destroyed at earliest in the - \l {InputMethod.traceEnd()} (QML) method. + \l {InputMethod::traceEnd()}{InputMethod.traceEnd()} (QML) method. */ /*! \internal */ diff --git a/src/virtualkeyboard/virtualkeyboard.pro b/src/virtualkeyboard/virtualkeyboard.pro index 899476bfacce43c596106171f5c3ca6ab14b460e..25b1586f79299fbd3b16168f9dc6107c50d88014 100644 --- a/src/virtualkeyboard/virtualkeyboard.pro +++ b/src/virtualkeyboard/virtualkeyboard.pro @@ -216,7 +216,7 @@ OTHER_FILES += \ content/components/*.qml \ qtvirtualkeyboard.json -!disable-desktop:isEmpty(CROSS_COMPILE):!qnx { +!disable-desktop:isEmpty(CROSS_COMPILE):!android-embedded:!qnx { SOURCES += desktopinputpanel.cpp inputview.cpp HEADERS += desktopinputpanel.h inputview.h DEFINES += QT_VIRTUALKEYBOARD_DESKTOP @@ -330,7 +330,7 @@ lipi-toolkit { -lltkcommon$$qtPlatformTargetSuffix() \ -lltkutil$$qtPlatformTargetSuffix() win32: LIBS += Advapi32.lib - else: LIBS += -ldl + else: QMAKE_USE += libdl ltk_projects.files = $$PWD/3rdparty/lipi-toolkit/projects ltk_projects.path = $$[QT_INSTALL_DATA]/qtvirtualkeyboard/lipi_toolkit INSTALLS += ltk_projects diff --git a/src/virtualkeyboard/virtualkeyboardsettings.cpp b/src/virtualkeyboard/virtualkeyboardsettings.cpp index 12f85cc2856d4c08023289c350cdbb2601c43fea..7280903cbc727cf4c3ae98b1e6953d2015fc9fea 100644 --- a/src/virtualkeyboard/virtualkeyboardsettings.cpp +++ b/src/virtualkeyboard/virtualkeyboardsettings.cpp @@ -33,6 +33,7 @@ #include <QQmlEngine> #include <QFileInfo> #include <QDir> +#include <QRegExp> #include <QtCore/private/qobject_p.h> namespace QtVirtualKeyboard { diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 2d2a861840dfe44842574332714db26918854af9..3a406734bf3fdcee1b5d3589000a8ce23912cfae 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -5,3 +5,6 @@ SUBDIRS += \ styles \ layoutfilesystem \ layoutresources \ + +# QTBUG-60268 +boot2qt: SUBDIRS = ""