helloSystem / QKeySequenceOverride

Override the QKeySequence::toString() function in Qt to represent keyboard shortcuts with graphical symbols
2 stars 2 forks source link

Dual qt5/qt6 #9

Closed jsm222 closed 1 year ago

probonopd commented 1 year ago

Thanks @jsm222. This is truly great.

It also means that we'd now have to ship both Qt5 and Qt6 in parallel. Sooner or later we'll have to do that anyway for a while, so there's probably no way around it.

Before I merge this, I'd like to find a way to make the Global Menu also work for Qt6 applications like Scribus and Qt Creator; this probably involves building and shipping QtPlugin for both Qt5 and Qt6.

probonopd commented 1 year ago

Does it really work though? When using

unset QT_QPA_PLATFORMTHEME
export LD_PRELOAD=$(readlink -f libQKeySequenceOverride.so.1.0.0)
scribus # A Qt6 app

I don't see "Ctrl" anymore in the menu, but I don't see the Command symbol either.

jsm222 commented 1 year ago

Does it really work though? When using

unset QT_QPA_PLATFORMTHEME
export LD_PRELOAD=$(readlink -f libQKeySequenceOverride.so.1.0.0)
scribus # A Qt6 app

I don't see "Ctrl" anymore in the menu, but I don't see the Command symbol either.

I cannot reproduce that, Please try with revert of the qmake commit, the build script is crafted with care e.g it uses -undefined-dynamic-load..

probonopd commented 1 year ago

With qmake it doesn't compile for me, this is why I changed it to qmake6. Was that wrong?

This is what happens with qmake:

% qmake ..  

% make      
clang++ -c -pipe -O2 -Wall -Wextra -pthread -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../../QKeySequenceOverride -I. -I../../QKeySequenceOverride -I/usr/local/include/qt5/QtCore -I/usr/local/include/qt5/QtGui -I/usr/local/include/qt5/QtWidgets -I/usr/local/include/qt5 -I. -I/usr/local/include -I/usr/local/include -I/usr/local/lib/qt5/mkspecs/freebsd-clang -o override.o ../override.cpp
../override.cpp:70:18: error: out-of-line definition of 'deallocate' does not match any declaration in 'QArrayData'
void QArrayData::deallocate(QArrayData *data, qsizetype objectSize,
                 ^~~~~~~~~~
1 error generated.
*** Error code 1

Stop.
make: stopped in /tmp/QKeySequenceOverride/build
jsm222 commented 1 year ago

It also means that we'd now have to ship both Qt5 and Qt6 in parallel. Sooner or later we'll have to do that anyway for a while, so there's probably no way around it.

No there are no runtime dependencies for qt6

jsm222 commented 1 year ago

With qmake it doesn't compile for me, this is why I changed it to qmake6. Was that wrong?

This is what happens with qmake:

% qmake ..  

% make      
clang++ -c -pipe -O2 -Wall -Wextra -pthread -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I../../QKeySequenceOverride -I. -I../../QKeySequenceOverride -I/usr/local/include/qt5/QtCore -I/usr/local/include/qt5/QtGui -I/usr/local/include/qt5/QtWidgets -I/usr/local/include/qt5 -I. -I/usr/local/include -I/usr/local/include -I/usr/local/lib/qt5/mkspecs/freebsd-clang -o override.o ../override.cpp
../override.cpp:70:18: error: out-of-line definition of 'deallocate' does not match any declaration in 'QArrayData'
void QArrayData::deallocate(QArrayData *data, qsizetype objectSize,
                 ^~~~~~~~~~
1 error generated.
*** Error code 1

Stop.
make: stopped in /tmp/QKeySequenceOverride/build

You are still including qt5 headers.. anyway just use https://github.com/jsm222/QKeySequenceOverride/blob/dualqt/build.sh and not qmake-qt5 or qmake6

probonopd commented 1 year ago

This is really cool:

ldd build/libQKeySequenceOverride.so.1.0.0 
build/libQKeySequenceOverride.so.1.0.0:
        libc.so.7 => /lib/libc.so.7 (0x801083000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x801492000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x801569000)
        libm.so.5 => /lib/libm.so.5 (0x80158b000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x8015c6000)
        libthr.so.3 => /lib/libthr.so.3 (0x801e00000)

:+1: