framework icon indicating copy to clipboard operation
framework copied to clipboard

Add support for Qt6 as well as Qt5

Open dobey opened this issue 1 year ago • 14 comments

This reverts the text-input-v2 support back to text-input-v1 as well, as the pre-built headers from Qt may not be available on all systems in Qt6. To build for Qt6, one needs to pass -Dwith-qt6=ON to cmake.

dobey avatar Dec 19 '23 21:12 dobey

Looking forward to test this in fedora as soon as keyboard is also ported :)

aleasto avatar Jan 06 '24 12:01 aleasto

There is no compositor currently with text-input-v1 support.

EDIT: apparantly I was wrong, kwin does seem to support it still.

bhush9 avatar Jan 09 '24 03:01 bhush9

kwin does seem to support it still.

As does Mir 2.x now too.

dobey avatar Jan 09 '24 21:01 dobey

Hi, I would like to ask about the state of these changes? Getting them merged would help with downstream packaging to provide a Qt6 version.

cordlandwehr avatar Jun 15 '24 11:06 cordlandwehr

I'm having trouble building the Qt6 version, build fails on settingdata.cpp.

@pvuorela Were you building with -Werror or did a newer Qt6 remove some of the deprecated calls? It compiles, but with deprecation warnings, for me, on Debian Testing, which still has 6.4.2.

dobey avatar Jun 18 '24 02:06 dobey

Didn't do any special flags, just enabling qt6. Having Fedora 40 & Qt 6.7.1.

[  1%] Building CXX object CMakeFiles/maliit-common.dir/common/maliit/settingdata.cpp.o
In file included from /usr/include/qt6/QtCore/QMetaType:1,
                 from /home/pvuorela/tila/src/maliit/framework/common/maliit/namespace.h:17,
                 from /home/pvuorela/tila/src/maliit/framework/common/maliit/settingdata.h:15,
                 from /home/pvuorela/tila/src/maliit/framework/common/maliit/settingdata.cpp:12:
/usr/include/qt6/QtCore/qmetatype.h: In instantiation of ‘constexpr bool QtPrivate::checkTypeIsSuitableForMetaType() [with X = QList<Maliit::PreeditTextFormat>]’:
/home/pvuorela/tila/src/maliit/framework/common/maliit/namespace.h:176:1:   required from here
  176 | Q_DECLARE_METATYPE(QList<Maliit::PreeditTextFormat>)
      | ^~~~~~~~~~~~~~~~~~
/usr/include/qt6/QtCore/qmetatype.h:1183:51: error: static assertion failed: Meta Types must be fully defined
 1183 |         static_assert(is_complete<T, void>::value || std::is_void_v<T>,
      |                                             ~~~~~~^~~~~~~~~~~~~~~~~~~~
/usr/include/qt6/QtCore/qmetatype.h:1183:51: note: ‘(((bool)std::integral_constant<bool, false>::value) || ((bool)std::is_void_v<QList<Maliit::PreeditTextFormat> >))’ evaluates to false
/home/pvuorela/tila/src/maliit/framework/common/maliit/settingdata.cpp: In function ‘bool {anonymous}::checkValueDomain(const QVariant&, const QVariant&)’:
/home/pvuorela/tila/src/maliit/framework/common/maliit/settingdata.cpp:20:31: warning: ‘bool QVariant::canConvert(int) const’ is deprecated [-Wdeprecated-declarations]
   20 |         if (!domain.canConvert(QVariant::List))
      |              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/qt6/QtCore/QVariant:1,
                 from /home/pvuorela/tila/src/maliit/framework/common/maliit/settingdata.h:18:

And the canConvert warning part repeating a few times more.

pvuorela avatar Jun 18 '24 10:06 pvuorela

Didn't do any special flags, just enabling qt6

Hrmm. Debian Testing just got 6.6.2, and I don't see the error there with a clean build. I did get it with a dirty build, though. So seems like maybe something getting tripped up with moc perhaps?

Anyway, I think this branch also need to be tweaked to install the shared libs as different library names for qt6 and qt5 as well. Maybe a good time to break ABI and remove the SettingsData stuff too then?

dobey avatar Jun 22 '24 21:06 dobey

Apparently the rather unhelpful compiler was about this https://github.com/maliit/framework/pull/123

With that I got the build a bit forward, eventually failing with

[ 20%] Linking CXX shared library libmaliit-plugins.so
/usr/bin/ld: libmaliit-common.a(settingdata.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value

Seems strange, didn't investigate yet further.

Maybe a good time to break ABI and remove the SettingsData stuff too then?

At least removing the validateSettingValue() could be an option, even if the above error it wasn't really about the settingdata. Or if kept, I'm not sure why is it on the public API at all.

For usage the mimpluginmanager.cpp propagates handleExtendedAttributeUpdate() to both attributeExtensionManager (MAttributeExtensionManager) and sharedAttributeExtensionManager (MSharedAttributeExtensionManager) where only latter used the validation. The attributes are involved in app specific overrides like enter key customization in MInputContext::updateInputMethodExtensions(). But now, is that latter shared thing actually used for anything? I'm spotting mostly mimpluginamanager connecting signals to some handlers on it, but not much else.

pvuorela avatar Jun 24 '24 15:06 pvuorela

Seems strange, didn't investigate yet further.

FWIW got qt6 build through by adding to CMakeLists.txt

set_property(TARGET maliit-common PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET maliit-connection PROPERTY POSITION_INDEPENDENT_CODE ON)

I'm puzzled why Qt5 was fine without it.

pvuorela avatar Jun 24 '24 16:06 pvuorela

@pvuorela as far as I know Qt6 does not set -fPIC unconditionally anymore. a related discussion of those issues e.g. can be found here, https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/222

cordlandwehr avatar Jul 20 '24 09:07 cordlandwehr

@pvuorela as far as I know Qt6 does not set -fPIC unconditionally anymore. a related discussion of those issues e.g. can be found here, https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/222

Ah, that would explain it. Thanks for the link.

@dobey maybe you could add the PIC options and get this merged? Suppose those shouldn't harm even on qt5 version(?)

pvuorela avatar Aug 05 '24 08:08 pvuorela