Skip to content

Commit 728f1e7

Browse files
committed
Qt 6 compile fixes
1 parent 2ce82f3 commit 728f1e7

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

acinclude.m4

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,14 @@ AC_REQUIRE([AC_SYS_LARGEFILE])
101101
102102
if test "x$GCC" = "xyes"; then
103103
CFLAGS="$CFLAGS -std=gnu99 -ffast-math -Wall -pipe"
104-
if test "x$HAVE_DARWIN" = "xyes"; then
105-
CXXFLAGS="$CXXFLAGS -std=gnu++11 -ffast-math -Wall -pipe"
106-
LDFLAGS="$LDFLAGS"
107-
else
108-
CXXFLAGS="$CXXFLAGS -std=gnu++11 -ffast-math -Wall -pipe"
104+
CXXFLAGS="$CXXFLAGS -ffast-math -Wall -pipe"
105+
106+
# use C++17 if possible (Qt 6 requires it)
107+
AUD_CHECK_CXXFLAGS(-std=gnu++17)
108+
if [ "${CFLAGS#gnu++17}" = "$CFLAGS" ] ; then
109+
CFLAGS="$CFLAGS -std=gnu++11"
109110
fi
111+
110112
AUD_CHECK_CFLAGS(-Wtype-limits)
111113
AUD_CHECK_CFLAGS(-Wno-stringop-truncation)
112114
AUD_CHECK_CXXFLAGS(-Woverloaded-virtual)

src/qthotkey/plugin.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@
6060

6161
#include <stdlib.h>
6262

63+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
64+
typedef qintptr filter_result_t;
65+
#else
66+
typedef long filter_result_t;
67+
#endif
68+
6369
namespace GlobalHotkeys
6470
{
6571

@@ -81,7 +87,7 @@ class GlobalHotkeysEventFilter : public QAbstractNativeEventFilter
8187
{
8288
private:
8389
bool nativeEventFilter(const QByteArray & eventType, void * message,
84-
long * result) override;
90+
filter_result_t * result) override;
8591
};
8692

8793
/* global vars */
@@ -454,7 +460,8 @@ void GlobalHotkeys::cleanup()
454460
}
455461

456462
bool GlobalHotkeysEventFilter::nativeEventFilter(const QByteArray & eventType,
457-
void * message, long * result)
463+
void * message,
464+
filter_result_t * result)
458465
{
459466
Q_UNUSED(eventType);
460467
Q_UNUSED(result);

src/qtui/playlist_model.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ QVariant PlaylistModel::alignment(int col) const
7777
case NowPlaying:
7878
return Qt::AlignCenter;
7979
case Length:
80-
return Qt::AlignRight + Qt::AlignVCenter;
80+
return static_cast<Qt::Alignment::Int>(Qt::AlignRight |
81+
Qt::AlignVCenter);
8182
default:
82-
return Qt::AlignLeft + Qt::AlignVCenter;
83+
return static_cast<Qt::Alignment::Int>(Qt::AlignLeft |
84+
Qt::AlignVCenter);
8385
}
8486
}
8587

src/qtui/playlist_tabs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ bool PlaylistTabBar::cancelRename()
293293

294294
void PlaylistTabBar::mousePressEvent(QMouseEvent * e)
295295
{
296-
if (e->button() == Qt::MidButton)
296+
if (e->button() == Qt::MiddleButton)
297297
{
298298
int index = tabAt(e->pos());
299299
if (index >= 0)

src/qtui/settings.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323
#include <libaudcore/i18n.h>
2424
#include <libaudcore/preferences.h>
2525

26-
#include <QApplication>
27-
#include <QDesktopWidget>
28-
2926
const char * const qtui_defaults[] = {
3027
// clang-format off
3128
"infoarea_show_vis", "TRUE",

src/skins-qt/textbox.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void TextBox::render_bitmap (const char * text)
164164

165165
auto ucs4 = QString (text).toUcs4 ();
166166

167-
m_buf_width = aud::max (cw * ucs4.length (), m_width);
167+
m_buf_width = aud::max (cw * (int) ucs4.length (), m_width);
168168
m_buf.capture (new QImage (m_buf_width * config.scale, ch * config.scale,
169169
QImage::Format_RGB32));
170170

0 commit comments

Comments
 (0)