recipes-support: introduce maliit-keyboard/framework recipes for qt6

This commit is contained in:
Maxime Roussin-Belanger
2024-06-11 16:33:36 -04:00
parent 643e4702b7
commit 0dbc8c3e17
10 changed files with 590 additions and 48 deletions

View File

@@ -1,41 +0,0 @@
# SPDX-FileCopyrightText: 2020 Andreas Cord-Landwehr <cordlandwehr@kde.org>
#
# SPDX-License-Identifier: MIT
LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://LICENSE.LGPL;md5=5c917f6ce94ceb8d8d5e16e2fca5b9ad"
SRC_URI = " \
git://github.com/maliit/framework.git;nobranch=1;protocol=https \
"
S = "${WORKDIR}/git"
DEPENDS += " \
qtbase \
qtdeclarative \
qtmultimedia \
qtwayland \
qtwayland-native \
glibc \
glib-2.0-native \
wayland \
"
inherit qt6-cmake
inherit pkgconfig
EXTRA_OECMAKE += " \
-Denable-docs=OFF \
-Denable-tests=OFF \
-Denable-dbus-activation=ON \
-DQT5_PLUGINS_INSTALL_DIR=${OE_QMAKE_PATH_PLUGINS} \
"
FILES:${PN} += " \
${libdir}/plugins \
${datadir}/dbus-1/ \
"
FILES:${PN}-dev += " \
${libdir}/qt5/mkspecs \
"

View File

@@ -0,0 +1,47 @@
# SPDX-FileCopyrightText: 2020 Andreas Cord-Landwehr <cordlandwehr@kde.org>
# SPDX-FileCopyrightText: 2024 Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
#
# SPDX-License-Identifier: MIT
LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://LICENSE.LGPL;md5=5c917f6ce94ceb8d8d5e16e2fca5b9ad"
SRC_URI = "git://github.com/maliit/framework.git;branch=qt6-support;protocol=https \
file://0001-common-namespace-add-missing-include-QList.patch \
file://0002-maliitpluginsconfig-fix-for-qt6.patch \
file://0003-shellintegration-qwaylandinputpanelshellintegration-.patch \
"
S = "${WORKDIR}/git"
DEPENDS += " \
qtbase \
qtdeclarative \
qtmultimedia \
qtwayland \
qtwayland-native \
glibc \
glib-2.0-native \
wayland \
"
inherit qt6-cmake
inherit pkgconfig
EXTRA_OECMAKE += " \
-Dwith-qt6=ON \
-Denable-docs=OFF \
-Denable-tests=OFF \
-Denable-dbus-activation=ON \
-DQtWaylandScanner_EXECUTABLE=${RECIPE_SYSROOT_NATIVE}/${libexecdir}/qtwaylandscanner \
-DQT_PLUGINS_INSTALL_DIR=${QT6_INSTALL_PLUGINSDIR} \
-DQT_MKSPECS_INSTALL_DIR=${QT6_INSTALL_MKSPECSDIR} \
"
FILES:${PN} += " \
${libdir}/plugins \
${datadir}/dbus-1/ \
"
FILES:${PN}-dev += " \
${libdir}/mkspecs \
"

View File

@@ -0,0 +1,25 @@
From 34123084a3bf65c9bd4606d46f69f47328e469bc Mon Sep 17 00:00:00 2001
From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
Date: Tue, 11 Jun 2024 14:00:25 -0400
Subject: [PATCH] common: namespace: add missing include QList
Otherwise Q_DECLARE_METATYPE can't see the QList type and complains
about incomplete type
Upstream-Status: Submitted [https://github.com/maliit/framework/pull/122]
---
common/maliit/namespace.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/maliit/namespace.h b/common/maliit/namespace.h
index 2e47b17..a4f2750 100644
--- a/common/maliit/namespace.h
+++ b/common/maliit/namespace.h
@@ -16,6 +16,7 @@
#include <QMetaType>
#include <QSharedPointer>
+#include <QList>
//! \ingroup common
namespace Maliit {

View File

@@ -0,0 +1,27 @@
From a09406e971d113aa4a8103bee52a563cf53e59f8 Mon Sep 17 00:00:00 2001
From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
Date: Tue, 11 Jun 2024 14:00:25 -0400
Subject: [PATCH] maliitpluginsconfig: fix for qt6
Upstream-Status: Submitted [https://github.com/maliit/framework/pull/122]
---
src/MaliitPluginsConfig.cmake.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/MaliitPluginsConfig.cmake.in b/src/MaliitPluginsConfig.cmake.in
index e9178da..85f99a4 100644
--- a/src/MaliitPluginsConfig.cmake.in
+++ b/src/MaliitPluginsConfig.cmake.in
@@ -1,7 +1,7 @@
include(CMakeFindDependencyMacro)
-find_dependency(Qt5Core @Qt5Core_VERSION@)
-find_dependency(Qt5Gui @Qt5Gui_VERSION@)
-find_dependency(Qt5Quick @Qt5Quick_VERSION@)
+find_dependency(Qt6Core @Qt6Core_VERSION@)
+find_dependency(Qt6Gui @Qt6Gui_VERSION@)
+find_dependency(Qt6Quick @Qt6Quick_VERSION@)
-include("${CMAKE_CURRENT_LIST_DIR}/MaliitPluginsTargets.cmake")
\ No newline at end of file
+include("${CMAKE_CURRENT_LIST_DIR}/MaliitPluginsTargets.cmake")

View File

@@ -0,0 +1,101 @@
From a73944bdb4e9019b91ec14bdd3f8861334c2c35c Mon Sep 17 00:00:00 2001
From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
Date: Tue, 11 Jun 2024 14:00:26 -0400
Subject: [PATCH] shellintegration: qwaylandinputpanelshellintegration: migrate
for qt6
Upstream-Status: Submitted [https://github.com/maliit/framework/pull/122]
---
.../qwaylandinputpanelshellintegration.cpp | 17 +++------------
.../qwaylandinputpanelshellintegration.h | 21 +++++++------------
2 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.cpp b/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.cpp
index a35b7ac..3cfcce9 100644
--- a/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.cpp
+++ b/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.cpp
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2017 Jan Arne Petersen
*
* This library is free software; you can redistribute it and/or
@@ -14,15 +14,8 @@
#include "qwaylandinputpanelsurface.h"
-QT_BEGIN_NAMESPACE
-
-namespace QtWaylandClient
-{
-
QWaylandInputPanelShellIntegration::QWaylandInputPanelShellIntegration()
- : QWaylandShellIntegration()
-{
-}
+ : QWaylandShellIntegrationTemplate(1) {}
QWaylandInputPanelShellIntegration::~QWaylandInputPanelShellIntegration()
{
@@ -30,7 +23,7 @@ QWaylandInputPanelShellIntegration::~QWaylandInputPanelShellIntegration()
bool QWaylandInputPanelShellIntegration::initialize(QWaylandDisplay *display)
{
- auto result = QWaylandShellIntegration::initialize(display);
+ auto result = QWaylandShellIntegrationTemplate::initialize(display);
const auto globals = display->globals();
for (auto global: globals) {
if (global.interface == QLatin1String("zwp_input_panel_v1")) {
@@ -48,7 +41,3 @@ QWaylandInputPanelShellIntegration::createShellSurface(QWaylandWindow *window)
return new QWaylandInputPanelSurface(ip_surface, window);
}
-
-}
-
-QT_END_NAMESPACE
\ No newline at end of file
diff --git a/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.h b/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.h
index dccf81a..3aefda1 100644
--- a/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.h
+++ b/src/qt/plugins/shellintegration/qwaylandinputpanelshellintegration.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2017 Jan Arne Petersen
*
* This library is free software; you can redistribute it and/or
@@ -11,17 +11,16 @@
#ifndef QWAYLANDINPUTPANELSHELLINTEGRATION_H
#define QWAYLANDINPUTPANELSHELLINTEGRATION_H
-#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
-
#include "qwayland-input-method-unstable-v1.h"
+#include <QtWaylandClient/private/qwayland-text-input-unstable-v1.h>
+#include <QtWaylandClient/private/qwaylandclientshellapi_p.h>
-QT_BEGIN_NAMESPACE
+using namespace QtWaylandClient;
-namespace QtWaylandClient
-{
-
-class QWaylandInputPanelShellIntegration: public QWaylandShellIntegration
-{
+class QWaylandInputPanelShellIntegration
+ : public QWaylandShellIntegrationTemplate<
+ QWaylandInputPanelShellIntegration>,
+ public QtWayland::zwp_text_input_manager_v1 {
public:
QWaylandInputPanelShellIntegration();
~QWaylandInputPanelShellIntegration() override;
@@ -33,8 +32,4 @@ private:
QScopedPointer<QtWayland::zwp_input_panel_v1> m_panel;
};
-}
-
-QT_END_NAMESPACE
-
#endif //QWAYLANDINPUTPANELSHELLINTEGRATION_H

View File

@@ -2,4 +2,4 @@
# SPDX-License-Identifier: CC0-1.0
require ${BPN}.inc
SRCREV = "ad906cad4acd8a81f62ea34f70e81a2bd4f7e926"
SRCREV = "031a368a87e8aa8db62794a9be6139c27baafc26"

View File

@@ -1,18 +1,23 @@
# SPDX-FileCopyrightText: 2020 Andreas Cord-Landwehr <cordlandwehr@kde.org>
# SPDX-FileCopyrightText: 2024 Maxime Roussin-Bélanger <maxime.roussinbelanger@gmail.com>
#
# SPDX-License-Identifier: MIT
LICENSE = "GPL-3.0-only"
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
SRC_URI = " \
git://github.com/maliit/keyboard.git;nobranch=1;protocol=https \
SRC_URI = "git://github.com/maliit/keyboard.git;nobranch=1;protocol=https \
file://0001-qml-Fix-for-qt6.patch \
file://0001-cmake-add-Qt6-support.patch \
"
S = "${WORKDIR}/git"
DEPENDS += " \
maliit-framework-qt5 \
maliit-framework-qt6 \
qtbase \
qtdeclarative \
qtdeclarative-native \
qt5compat \
qtmultimedia \
glibc \
hunspell \
@@ -25,7 +30,11 @@ inherit qt6-cmake
inherit gsettings
inherit pkgconfig
EXTRA_OECMAKE += "-Denable-presage=OFF"
EXTRA_OECMAKE += " \
-Denable-tests=OFF \
-Denable-presage=OFF \
-Dwith-qt6=ON \
"
FILES:${PN} += " \
${datadir}/glib-2.0/schemas/org.maliit.keyboard.maliit.gschema.xml \

View File

@@ -0,0 +1,339 @@
From 4386f2ae8cb329077b7767d9121abba5ee38ed7b Mon Sep 17 00:00:00 2001
From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
Date: Sun, 16 Jun 2024 22:52:25 -0400
Subject: [PATCH] cmake: add Qt6 support
---
CMakeLists.txt | 47 ++++++++++++-------
plugins/pinyin/src/pinyinadapter.cpp | 3 +-
plugins/westernsupport/spellchecker.cpp | 12 +++--
.../westernlanguagefeatures.cpp | 2 +-
src/lib/models/key.h | 2 +-
src/lib/models/layout.cpp | 4 +-
src/lib/models/wordribbon.cpp | 4 +-
src/plugin/keyboardsettings.cpp | 1 +
src/view/abstracttexteditor.cpp | 26 +++++-----
9 files changed, 58 insertions(+), 43 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 36a4e8f6..88bc641e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,15 +5,11 @@ project(maliit-keyboard VERSION 2.3.1)
option(enable-presage "Use presage to calculate word candidates (maliit-keyboard-plugin only)" ON)
option(enable-hunspell "Use hunspell for error correction (maliit-keyboard-plugin only)" ON)
option(enable-tests "Build tests" ON)
+option(with-qt6 "Built with Qt 6 instead of Qt 5" OFF)
# Install paths
include(GNUInstallDirs)
-if(NOT DEFINED QT5_QML_INSTALL_DIR)
- set(QT5_QML_INSTALL_DIR "${LIB_INSTALL_DIR}/qt5/qml" CACHE PATH
- "Installation directory for Qt 5 QML plugins [LIB_INSTALL_DIR/qt5/qml]")
-endif()
-
set(HUNSPELL_DICT_PATH "/usr/share/hunspell" CACHE PATH "Directory containing hunspell dictionary files")
set(MALIIT_KEYBOARD_QML_DIR "${CMAKE_INSTALL_LIBDIR}/maliit/keyboard2/qml" CACHE PATH "Directory containing maliit-keyboard QML files")
set(MALIIT_KEYBOARD_DATA_DIR "${CMAKE_INSTALL_DATADIR}/maliit/keyboard2" CACHE PATH "Directory containing maliit-keyboard data files")
@@ -29,11 +25,23 @@ find_package(MaliitPlugins 0.99.1 REQUIRED)
find_package(GLib2 REQUIRED)
find_package(GIO REQUIRED)
-find_package(Qt5DBus)
+if(with-qt6)
+ find_package(Qt6 6.0 REQUIRED COMPONENTS Core DBus Gui Quick QuickControls2 Core5Compat Multimedia)
+endif()
+
+if(Qt6_FOUND)
+ set(QT_VERSION_MAJOR 6)
+else()
+ find_package(Qt5 REQUIRED COMPONENTS Core DBus Gui Quick Multimedia Feedback)
+ set(QT_VERSION_MAJOR 5)
+endif()
+
+
+if(NOT DEFINED QT_QML_INSTALL_DIR)
+ set(QT_QML_INSTALL_DIR "${LIB_INSTALL_DIR}/qt${QT_VERSION_MAJOR}/qml" CACHE PATH
+ "Installation directory for Qt ${QT_VERSION_MAJOR} QML plugins [LIB_INSTALL_DIR/qt${QT_VERSION_MAJOR}/qml]")
+endif()
-find_package(Qt5QuickControls2 REQUIRED)
-find_package(Qt5Multimedia)
-find_package(Qt5Feedback)
find_package(Intl REQUIRED)
find_package(AnthyUnicode)
@@ -86,7 +94,7 @@ set(WESTERNSUPPORT_SOURCES
# TODO install logic/languageplugininterface.h and logic/abstractplugininterface.h as HEADERS
-set(maliit-keyboard-libraries Qt5::Core)
+set(maliit-keyboard-libraries Qt::Core)
set(maliit-keyboard-definitions HUNSPELL_DICT_PATH="${HUNSPELL_DICT_PATH}"
MALIIT_GETTEXT_PACKAGE="${PROJECT_NAME}"
MALIIT_LOCALE_DIR="${CMAKE_INSTALL_LOCALEDIR}/locale"
@@ -122,7 +130,7 @@ if(enable-hunspell)
endif()
add_library(maliit-keyboard-lib STATIC ${MALIIT_KEYBOARD_LIB_SOURCES})
-target_link_libraries(maliit-keyboard-lib Qt5::Core Maliit::Plugins)
+target_link_libraries(maliit-keyboard-lib Qt::Core Maliit::Plugins)
target_include_directories(maliit-keyboard-lib PUBLIC src/lib)
target_compile_definitions(maliit-keyboard-lib PRIVATE ${maliit-keyboard-definitions})
@@ -146,7 +154,7 @@ set(QGSETTINGS_SOURCES
src/3rdparty/QGSettings/util.h)
add_library(gsettings-qt STATIC ${QGSETTINGS_SOURCES})
-target_link_libraries(gsettings-qt Qt5::Core ${GIO_LIBRARIES})
+target_link_libraries(gsettings-qt Qt::Core ${GIO_LIBRARIES})
target_include_directories(gsettings-qt PUBLIC ${GIO_INCLUDE_DIRS} src/3rdparty)
target_compile_definitions(gsettings-qt PRIVATE -DQT_NO_KEYWORDS)
@@ -170,9 +178,9 @@ set(MALIIT_KEYBOARD_COMMON_SOURCES
src/plugin/device.h)
add_library(maliit-keyboard-common STATIC ${MALIIT_KEYBOARD_COMMON_SOURCES})
-target_link_libraries(maliit-keyboard-common Qt5::DBus Qt5::QuickControls2 Maliit::Plugins maliit-keyboard-lib maliit-keyboard-view gsettings-qt Qt5::Multimedia ${Intl_LIBRARIES})
+target_link_libraries(maliit-keyboard-common Qt::DBus Qt::QuickControls2 Maliit::Plugins maliit-keyboard-lib maliit-keyboard-view gsettings-qt Qt::Multimedia ${Intl_LIBRARIES})
if (Qt5Feedback_FOUND)
- target_link_libraries(maliit-keyboard-common Qt5::Feedback)
+ target_link_libraries(maliit-keyboard-common Qt::Feedback)
target_compile_definitions(maliit-keyboard-common PUBLIC HAVE_QT5_FEEDBACK)
endif()
target_compile_definitions(maliit-keyboard-common PRIVATE ${maliit-keyboard-definitions})
@@ -285,7 +293,7 @@ function(abstract_language_plugin _language _full_language)
endif()
add_library(${_target}plugin MODULE ${PLUGIN_SOURCES})
set_target_properties(${_target}plugin PROPERTIES OUTPUT_NAME ${_language}plugin)
- target_link_libraries(${_target}plugin Qt5::Core Maliit::Plugins maliit-keyboard-common ${abstract_language_plugin_LIBRARIES})
+ target_link_libraries(${_target}plugin Qt::Core Maliit::Plugins maliit-keyboard-common ${abstract_language_plugin_LIBRARIES})
target_include_directories(${_target}plugin PRIVATE src/lib/logic ${abstract_language_plugin_INCLUDE_DIRS})
target_compile_definitions(${_target}plugin PRIVATE ${abstract_language_plugin_DEFINITIONS})
install(TARGETS ${_target}plugin
@@ -419,8 +427,11 @@ add_subdirectory(po)
# TODO add all tests
if(enable-tests)
enable_testing()
-
- find_package(Qt5Test)
+ if(Qt6_FOUND)
+ find_package(Qt6 6.0 REQUIRED COMPONENTS Test)
+ else()
+ find_package(Qt5 5.14 REQUIRED COMPONENTS Test)
+ endif()
add_library(test-utils STATIC
tests/unittests/common/inputmethodhostprobe.cpp
@@ -428,7 +439,7 @@ if(enable-tests)
tests/unittests/common/utils.cpp
tests/unittests/common/utils.h)
- target_link_libraries(test-utils PUBLIC Maliit::Plugins Qt5::Core Qt5::Gui Qt5::Test westernsupport)
+ target_link_libraries(test-utils PUBLIC Maliit::Plugins Qt::Core Qt::Gui Qt::Test westernsupport)
target_include_directories(test-utils PUBLIC tests/unittests tests/unittests/common src src/lib)
function(create_test name)
diff --git a/plugins/pinyin/src/pinyinadapter.cpp b/plugins/pinyin/src/pinyinadapter.cpp
index f31a00c8..ac81ba0d 100644
--- a/plugins/pinyin/src/pinyinadapter.cpp
+++ b/plugins/pinyin/src/pinyinadapter.cpp
@@ -25,10 +25,9 @@
#include <string>
#include <string.h>
+#include <QCoreApplication>
#include <QDebug>
#include <QLoggingCategory>
-#include <QCoreApplication>
-#include <QRegExp>
#define MAX_SUGGESTIONS 100
diff --git a/plugins/westernsupport/spellchecker.cpp b/plugins/westernsupport/spellchecker.cpp
index d55eeb35..f7563027 100644
--- a/plugins/westernsupport/spellchecker.cpp
+++ b/plugins/westernsupport/spellchecker.cpp
@@ -52,12 +52,12 @@ private:
};
#endif
-#include <QFile>
-#include <QTextStream>
-#include <QTextCodec>
-#include <QStringList>
#include <QDebug>
#include <QDir>
+#include <QFile>
+#include <QStringList>
+#include <QTextStream>
+#include <QtCore5Compat/QTextCodec>
//! \class SpellChecker
//! Checks spelling and suggest words. Currently Spellchecker is
@@ -304,7 +304,9 @@ bool SpellChecker::setLanguage(const QString &language)
d->aff_file = dictPath() + QDir::separator() + affMatches[0];
d->dic_file = dictPath() + QDir::separator() + dicMatches[0];
- d->user_dictionary_file = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QDir::separator() + language + "_userDictionary.dic";
+ d->user_dictionary_file =
+ QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
+ QDir::separator() + language + "_userDictionary.dic";
qDebug() << "spellechecker.cpp in setLanguage() aff_file=" << d->aff_file << "dic_file=" << d->dic_file << "user dictionary=" << d->user_dictionary_file;
diff --git a/plugins/westernsupport/westernlanguagefeatures.cpp b/plugins/westernsupport/westernlanguagefeatures.cpp
index 6ed6d0e8..c525678e 100644
--- a/plugins/westernsupport/westernlanguagefeatures.cpp
+++ b/plugins/westernsupport/westernlanguagefeatures.cpp
@@ -58,7 +58,7 @@ bool WesternLanguageFeatures::activateAutoCaps(const QString &preedit) const
return false;
}
- if (sentenceBreak.contains(preedit.mid(preedit.length() - 2, 1)) && preedit.at(preedit.count() - 1).isSpace()) {
+ if (sentenceBreak.contains(preedit.mid(preedit.length() - 2, 1)) && preedit.at(preedit.size() - 1).isSpace()) {
return true;
}
diff --git a/src/lib/models/key.h b/src/lib/models/key.h
index 5695cc1c..1f4380ba 100644
--- a/src/lib/models/key.h
+++ b/src/lib/models/key.h
@@ -94,7 +94,7 @@ private:
QString m_command_sequence;
public:
- explicit Key();
+ Key();
// read-only properties:
bool valid() const;
diff --git a/src/lib/models/layout.cpp b/src/lib/models/layout.cpp
index 304064e5..375cf840 100644
--- a/src/lib/models/layout.cpp
+++ b/src/lib/models/layout.cpp
@@ -257,7 +257,7 @@ int Layout::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent)
Q_D(const Layout);
- return d->key_area.keys().count();
+ return d->key_area.keys().size();
}
@@ -267,7 +267,7 @@ QVariant Layout::data(const QModelIndex &index,
Q_D(const Layout);
const QVector<Key> &keys(d->key_area.keys());
- const Key &key(index.row() < keys.count()
+ const Key &key(index.row() < keys.size()
? keys.at(index.row())
: Key());
diff --git a/src/lib/models/wordribbon.cpp b/src/lib/models/wordribbon.cpp
index ba341535..ae6685e8 100644
--- a/src/lib/models/wordribbon.cpp
+++ b/src/lib/models/wordribbon.cpp
@@ -119,7 +119,7 @@ bool operator!=(const WordRibbon &lhs,
QVariant WordRibbon::data(const QModelIndex &index, int role) const
{
- if (index.row() < 0 || index.row() > m_candidates.count())
+ if (index.row() < 0 || index.row() > m_candidates.size())
return QVariant();
switch (role) {
@@ -182,7 +182,7 @@ void WordRibbon::onWordCandidatesChanged(const WordCandidateList &candidates)
qDebug() << "word ribbon: candidates changed";
clearCandidates();
- for (int index = 0; index < candidates.count(); ++index) {
+ for (int index = 0; index < candidates.size(); ++index) {
WordCandidate word_candidate(candidates.at(index));
appendCandidate(word_candidate);
}
diff --git a/src/plugin/keyboardsettings.cpp b/src/plugin/keyboardsettings.cpp
index f64af95f..c0a1bc72 100644
--- a/src/plugin/keyboardsettings.cpp
+++ b/src/plugin/keyboardsettings.cpp
@@ -31,6 +31,7 @@
#include <QDebug>
#include <QGSettings/QGSettings>
+#include <QVariant>
using namespace MaliitKeyboard;
diff --git a/src/view/abstracttexteditor.cpp b/src/view/abstracttexteditor.cpp
index bf7a69e1..e3db6441 100644
--- a/src/view/abstracttexteditor.cpp
+++ b/src/view/abstracttexteditor.cpp
@@ -34,6 +34,7 @@
#include "logic/abstractlanguagefeatures.h"
#include <QElapsedTimer>
+#include <QRegularExpression>
namespace MaliitKeyboard {
@@ -392,7 +393,7 @@ void AbstractTextEditor::onKeyReleased(const Key &key)
if (d->preedit_enabled) {
if (!enablePreeditAtInsertion &&
- (d->text->surroundingRight().left(1).contains(QRegExp(R"([\w])")) || email_detected)) {
+ (d->text->surroundingRight().left(1).contains(QRegularExpression(R"([\w])")) || email_detected)) {
// We're editing in the middle of a word or entering an email address, so just insert characters directly
d->text->appendToPreedit(text);
commitPreedit();
@@ -536,14 +537,14 @@ void AbstractTextEditor::onKeyReleased(const Key &key)
// a separator, and there isn't a separator immediately prior to a ')'
else if (look_for_a_double_space
&& not stopSequence.isEmpty()
- && textOnLeft.count() >= 2
- && textOnLeft.at(textOnLeft.count() - 1).isSpace()
- && !textOnLeft.at(textOnLeft.count() - 2).isSpace()
- && textOnLeftTrimmed.count() > 0
- && !d->word_engine->languageFeature()->isSeparator(textOnLeftTrimmed.at(textOnLeftTrimmed.count() - 1))
+ && textOnLeft.size() >= 2
+ && textOnLeft.at(textOnLeft.size() - 1).isSpace()
+ && !textOnLeft.at(textOnLeft.size() - 2).isSpace()
+ && textOnLeftTrimmed.size() > 0
+ && !d->word_engine->languageFeature()->isSeparator(textOnLeftTrimmed.at(textOnLeftTrimmed.size() - 1))
&& !(textOnLeftTrimmed.endsWith(QLatin1String(")"))
- && textOnLeftTrimmed.count() > 1
- && d->word_engine->languageFeature()->isSeparator(textOnLeftTrimmed.at(textOnLeftTrimmed.count() - 2)))) {
+ && textOnLeftTrimmed.size() > 1
+ && d->word_engine->languageFeature()->isSeparator(textOnLeftTrimmed.at(textOnLeftTrimmed.size() - 2)))) {
removeTrailingWhitespaces();
if (!d->word_engine->languageFeature()->commitOnSpace()) {
// Commit when inserting a fullstop if we don't insert on spaces
@@ -1180,7 +1181,7 @@ void AbstractTextEditor::sendKeySequence(const QString &action, const QKeySequen
const int modifiers = actionSequence[i] & AllModifiers;
QString text("");
if (modifiers == Qt::NoModifier || modifiers == Qt::ShiftModifier) {
- text = QString(key);
+ text = QString::number(key);
}
sendKeyPressAndReleaseEvents(key, static_cast<Qt::KeyboardModifiers>(modifiers), text);
}
@@ -1240,15 +1241,16 @@ void AbstractTextEditor::checkPreeditReentry(bool uncommittedDelete)
} else {
lastChar = text()->surrounding().at(currentOffset-1);
}
- if(!QRegExp(R"(\W+)").exactMatch(lastChar) && !d->word_engine->languageFeature()->isSymbol(lastChar)) {
- QStringList leftWords = text()->surroundingLeft().trimmed().split(QRegExp(R"([\s\d]+)"));
+ if (!QRegularExpression(R"(\W+)").match(lastChar).hasMatch() &&
+ !d->word_engine->languageFeature()->isSymbol(lastChar)) {
+ QStringList leftWords = text()->surroundingLeft().trimmed().split(QRegularExpression (R"([\s\d]+)"));
int trimDiff = text()->surroundingLeft().size() - text()->surroundingLeft().trimmed().size();
if(leftWords.last().isEmpty()) {
// If removed char was punctuation trimming will result in an empty entry
leftWords.removeLast();
trimDiff += 1;
}
- if(d->text->surroundingRight().left(1).contains(QRegExp(R"([\w])"))) {
+ if(d->text->surroundingRight().left(1).contains(QRegularExpression (R"([\w])"))) {
// Don't enter pre-edit in the middle of a word
return;
}

View File

@@ -0,0 +1,35 @@
From 546bba3179f76d18131b6d9feae93ffac6f1605c Mon Sep 17 00:00:00 2001
From: Maxime Roussin-Belanger <maxime.roussinbelanger@gmail.com>
Date: Tue, 11 Jun 2024 13:06:12 -0400
Subject: [PATCH] qml: Fix for qt6
---
qml/Keyboard.qml | 2 +-
qml/keys/ActionsToolbarButton.qml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/qml/Keyboard.qml b/qml/Keyboard.qml
index e5a8a008..a603e285 100644
--- a/qml/Keyboard.qml
+++ b/qml/Keyboard.qml
@@ -30,7 +30,7 @@
import QtQuick 2.4
import QtQuick.Controls 2.4
-import QtGraphicalEffects 1.0
+import Qt5Compat.GraphicalEffects
import MaliitKeyboard 2.0
diff --git a/qml/keys/ActionsToolbarButton.qml b/qml/keys/ActionsToolbarButton.qml
index dbec6d03..e2a79171 100644
--- a/qml/keys/ActionsToolbarButton.qml
+++ b/qml/keys/ActionsToolbarButton.qml
@@ -1,6 +1,6 @@
import QtQuick 2.9
import QtQuick.Controls 2.9
-import QtGraphicalEffects 1.0
+import Qt5Compat.GraphicalEffects
import MaliitKeyboard 2.0

View File

@@ -2,4 +2,4 @@
# SPDX-License-Identifier: CC0-1.0
require ${BPN}.inc
SRCREV = "ae81a17b07f22d3b0d57997f0dfea1e8e91aa25f"
SRCREV = "9673c8e8bd64e091df6a07346919e476285fb04f"