mappu / miqt

MIT-licensed Qt bindings for Go
MIT License
288 stars 11 forks source link

Qt6.8 remove operator== for many class #84

Closed zhangqi2023 closed 1 week ago

zhangqi2023 commented 1 week ago

Take QDir for example:

#if QT_CORE_REMOVED_SINCE(6, 8)
    bool operator==(const QDir &dir) const;
    inline bool operator!=(const QDir &dir) const { return !operator==(dir); }
#endif
BrycensRanch commented 1 week ago

Is that why I can't build the example anymore?

❯ go run -v .
github.com/mappu/miqt/qt6
# github.com/mappu/miqt/qt6
gen_qabstractitemmodel.cpp:175:15: error: no member named 'operator==' in 'QModelIndex'
gen_qabstractitemmodel.cpp:179:15: error: no member named 'operator!=' in 'QModelIndex'
gen_qabstractitemmodel.cpp:183:15: error: no member named 'operator<' in 'QModelIndex'
gen_qabstractitemmodel.cpp:207:15: error: no member named 'operator<' in 'QPersistentModelIndex'
gen_qabstractitemmodel.cpp:211:15: error: no member named 'operator==' in 'QPersistentModelIndex'
gen_qabstractitemmodel.cpp:215:15: error: no member named 'operator!=' in 'QPersistentModelIndex'
gen_qabstractitemmodel.cpp:227:15: error: no member named 'operator==' in 'QPersistentModelIndex'
gen_qabstractitemmodel.cpp:231:15: error: no member named 'operator!=' in 'QPersistentModelIndex'

the example I ran:

package main

import (
    "fmt"
    "os"

    qt "github.com/mappu/miqt/qt6"
)

func main() {

    qt.NewQApplication(os.Args)

    btn := qt.NewQPushButton3("Hello world!")
    btn.SetFixedWidth(320)

    var counter int = 0

    btn.OnPressed(func() {
        counter++
        btn.SetText(fmt.Sprintf("You have clicked the button %d time(s)", counter))
    })

    btn.Show()

    qt.QApplication_Exec()

    fmt.Println("OK!")
}

My environment:

❯ fastfetch -l none
romvnly@Shadow-PH315-54
-----------------------
OS: Fedora Linux 42 (KDE Plasma) x86_64
Host: Predator PH315-54 (V1.15)
Kernel: Linux 6.11.9-300_tkg_icelake_preempt.fc41.x86_64
Uptime: 23 hours, 28 mins
Packages: 4985 (rpm), 48 (nix-default), 60 (flatpak-system), 34 (flatpak-user), 10 (snap), 16 (brew)
Shell: bash 5.2.37
DE: KDE Plasma 6.2.3
WM: KWin (Wayland)
CPU: 11th Gen Intel(R) Core(TM) i7-11800H (16) @ 4.60 GHz
GPU 1: NVIDIA GeForce RTX 3060 Mobile / Max-Q
GPU 2: Intel UHD Graphics @ 1.45 GHz [Integrated]
Memory: 11.47 GiB / 15.38 GiB (75%)
Swap: 15.65 GiB / 22.35 GiB (70%)

My related installed packages:

❯ dnf list --installed | grep qt6
accounts-qml-module-qt6.x86_64                                         0.7^20231216.05e79eb-4.fc41             <unknown>
gstreamer1-plugins-good-qt6.x86_64                                     1.24.9-1.fc42                           rawhide
kaccounts-integration-qt6.x86_64                                       24.08.3-1.fc42                          rawhide
kcolorpicker-qt6.x86_64                                                0.3.0-4.fc41                            <unknown>
kimageannotator-qt6.x86_64                                             0.7.0-5.fc41                            <unknown>
kquickimageeditor-qt6.x86_64                                           0.3.0-4.fc41                            <unknown>
ksanecore-qt6.x86_64                                                   24.08.3-1.fc42                          rawhide
ktextaddons-qt6.x86_64                                                 1.5.4-2.fc41                            <unknown>
libaccounts-qt6.x86_64                                                 1.16^20231010.211051.29fd38e-5.fc41     <unknown>
libadwaita-qt6.x86_64                                                  1.4.2-8.fc41                            <unknown>
libkexiv2-qt6.x86_64                                                   24.08.3-1.fc42                          rawhide
mlt-qt6.x86_64                                                         7.28.0-4.fc42                           rawhide
phonon-qt6.x86_64                                                      4.12.0-7.fc41                           <unknown>
phonon-qt6-backend-vlc.x86_64                                          0.12.0-4.fc41                           <unknown>
plasma-breeze-qt6.x86_64                                               6.2.3-1.fc42                            rawhide
polkit-qt6-1.x86_64                                                    0.200.0-2.fc41                          <unknown>
poppler-qt6.x86_64                                                     24.08.0-1.fc42                          <unknown>
pulseaudio-qt-qt6.x86_64                                               1.6.1-1.fc42                            rawhide
python-pyqt6-rpm-macros.noarch                                         6.8.0-0.1.fc42                          rawhide
python3-pyqt6.x86_64                                                   6.8.0-0.1.fc42                          rawhide
python3-pyqt6-base.x86_64                                              6.8.0-0.1.fc42                          rawhide
python3-pyqt6-sip.x86_64                                               13.8.0-1.fc41                           <unknown>
python3-pyqt6-webengine.x86_64                                         6.7.0-3.fc41                            <unknown>
qaccessibilityclient-qt6.x86_64                                        0.6.0-2.fc41                            <unknown>
qca-qt6.x86_64                                                         2.3.8-2.fc41                            <unknown>
qca-qt6-ossl.x86_64                                                    2.3.8-2.fc41                            <unknown>
qcoro-qt6.x86_64                                                       0.10.0-7.fc42                           rawhide
qgpgme-qt6.x86_64                                                      1.24.0-1.fc42                           rawhide
qt6-designer.x86_64                                                    6.8.0-1.fc42                            rawhide
qt6-doc-devel.noarch                                                   6.7.0-3.fc41                            <unknown>
qt6-doctools.x86_64                                                    6.8.0-1.fc42                            rawhide
qt6-filesystem.x86_64                                                  6.8.0-1.fc42                            rawhide
qt6-linguist.x86_64                                                    6.8.0-1.fc42                            rawhide
qt6-qt5compat.x86_64                                                   6.8.0-1.fc42                            rawhide
qt6-qtbase.x86_64                                                      6.8.0-4.fc42                            rawhide
qt6-qtbase-common.noarch                                               6.8.0-4.fc42                            rawhide
qt6-qtbase-devel.x86_64                                                6.8.0-4.fc42                            rawhide
qt6-qtbase-gui.x86_64                                                  6.8.0-4.fc42                            rawhide
qt6-qtbase-ibase.x86_64                                                6.8.0-4.fc42                            rawhide
qt6-qtbase-mysql.x86_64                                                6.8.0-4.fc42                            rawhide
qt6-qtbase-odbc.x86_64                                                 6.8.0-4.fc42                            rawhide
qt6-qtbase-postgresql.x86_64                                           6.8.0-4.fc42                            rawhide
qt6-qtcharts.x86_64                                                    6.8.0-1.fc42                            rawhide
qt6-qtconnectivity.x86_64                                              6.8.0-1.fc42                            rawhide
qt6-qtdeclarative.x86_64                                               6.8.0-3.fc42                            rawhide
qt6-qtimageformats.x86_64                                              6.8.0-1.fc42                            rawhide
qt6-qtmultimedia.x86_64                                                6.8.0-1.fc42                            rawhide
qt6-qtnetworkauth.x86_64                                               6.8.0-1.fc42                            rawhide
qt6-qtpdf.x86_64                                                       6.8.0-1.fc42                            rawhide
qt6-qtpositioning.x86_64                                               6.8.0-1.fc42                            rawhide
qt6-qtquick3d.x86_64                                                   6.8.0-1.fc42                            rawhide
qt6-qtquicktimeline.x86_64                                             6.8.0-1.fc42                            rawhide
qt6-qtremoteobjects.x86_64                                             6.8.0-1.fc42                            rawhide
qt6-qtsensors.x86_64                                                   6.8.0-1.fc42                            rawhide
qt6-qtserialport.x86_64                                                6.8.0-1.fc42                            rawhide
qt6-qtshadertools.x86_64                                               6.8.0-1.fc42                            rawhide
qt6-qtspeech.x86_64                                                    6.8.0-1.fc42                            rawhide
qt6-qtspeech-flite.x86_64                                              6.8.0-1.fc42                            rawhide
qt6-qtspeech-speechd.x86_64                                            6.8.0-1.fc42                            rawhide
qt6-qtsvg.x86_64                                                       6.8.0-1.fc42                            rawhide
qt6-qttools.x86_64                                                     6.8.0-1.fc42                            rawhide
qt6-qttools-common.noarch                                              6.8.0-1.fc42                            rawhide
qt6-qttools-devel.x86_64                                               6.8.0-1.fc42                            rawhide
qt6-qttools-libs-designer.x86_64                                       6.8.0-1.fc42                            rawhide
qt6-qttools-libs-designercomponents.x86_64                             6.8.0-1.fc42                            rawhide
qt6-qttools-libs-help.x86_64                                           6.8.0-1.fc42                            rawhide
qt6-qttranslations.noarch                                              6.8.0-1.fc42                            rawhide
qt6-qtvirtualkeyboard.x86_64                                           6.8.0-1.fc42                            rawhide
qt6-qtwayland.x86_64                                                   6.8.0-2.fc42                            rawhide
qt6-qtwebchannel.x86_64                                                6.8.0-1.fc42                            rawhide
qt6-qtwebengine.x86_64                                                 6.8.0-1.fc42                            rawhide
qt6-qtwebsockets.x86_64                                                6.8.0-1.fc42                            rawhide
qt6-qtwebview.x86_64                                                   6.8.0-1.fc42                            rawhide
qt6-rpm-macros.noarch                                                  6.8.0-1.fc42                            rawhide
qt6-srpm-macros.noarch                                                 6.8.0-1.fc42                            rawhide
qt6pas.x86_64                                                          6.2.8-30601.fc42                        <unknown>
qtkeychain-qt6.x86_64                                                  0.14.3-3.fc41                           <unknown>
signon-qt6.x86_64                                                      8.60^20240205.c8ad982-2.fc41            <unknown>
mappu commented 1 week ago

I can confirm the problem on Fedora 41 with Qt 6.8.

Many operator== overloads were changed from class methods into global methods. In C++, writing a == b works for either, and is unaffected by this change. But because MIQT generated code like a->operator==(b), it was affected.

I'll change MIQT to use the a == b format in such cases.

mappu commented 1 week ago

Qt 6.8 is now working on Fedora 41. Please upgrade to master and try it out.

In future, Qt 6.8 will be tested in CI automatically so that it keeps working.