JvanKatwijk / qt-dab

Qt-DAB, a general software DAB (DAB+) decoder with a (slight) focus on showing the signal
http://www.sdr-j.tk
GNU General Public License v2.0
300 stars 62 forks source link

Building with Qt6 #270

Closed gvanem closed 2 years ago

gvanem commented 2 years ago

Building qt-dab -s4 using Qt6 has issues since some enum stuff was moved from QString into Qt name-space. The compile error (from clang-cl):

radio.cpp(2913,35): error: no member named 'SkipEmptyParts' in 'QString'; did you mean 'Qt::SkipEmptyParts'?
        QStringList list = s.split (":", QString::SkipEmptyParts);
                                         ^~~~~~~~~~~~~~~~~~~~~~~
                                         Qt::SkipEmptyParts
f:/gv/Qt/6.2.4/msvc2019_64/include/QtCore\qnamespace.h(153,9): note: 'Qt::SkipEmptyParts' declared here
        SkipEmptyParts = 0x1,
        ^

Similar for QPalette::Background:

radio.cpp(636,34): error: no member named 'Background' in 'QPalette'
        lcdPalette. setColor (QPalette::Background, Qt::white);
                              ~~~~~~~~~~^

I suppose this could be patched into:

--- a/qt-dab-s4/radio.cpp 2022-08-07 22:01:14
+++ b/qt-dab-s4/radio.cpp 2022-08-07 23:21:25
@@ -107,6 +107,12 @@
 #include       "history-handler.h"
 #include       "time-table.h"

+#if QT_VERSION >= 0x060000
+    #define SKIP_EMPTY_PARTS Qt::SkipEmptyParts
+#else
+    #define SKIP_EMPTY_PARTS QString::SkipEmptyParts
+#endif
+
 #ifdef __MINGW32__
 #include <windows.h>
@@ -622,7 +633,7 @@
        muting          = false;
 //
        QPalette lcdPalette;
-       lcdPalette. setColor (QPalette::Background, Qt::white);
+       lcdPalette. setColor (QPALETTE_BG, Qt::white);
@@ -2903,7 +2918,7 @@

 void   RadioInterface::localSelect (const QString &s) {
-       QStringList list = s.split (":", QString::SkipEmptyParts);
+       QStringList list = s.split (":", SKIP_EMPTY_PARTS);
         if (list. length () != 2)
            return;
        localSelect (list. at (0), list. at (1));

@@ -2914,7 +2929,7 @@
 //     likely are less than 16 characters
 //
 void   RadioInterface::scheduleSelect (const QString &s) {
-       QStringList list = s.split (":", QString::SkipEmptyParts);
+       QStringList list = s.split (":", SKIP_EMPTY_PARTS);
         if (list. length () != 2)
            return;
        QString theChannel = list. at (0);
gvanem commented 2 years ago

@JvanKatwijk I see you have patched to Qt::SkipEmptyParts in some places. But other places are missing. But the most serious part is that audio does not work in Qt6 + Windows. Hence closing.