Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Qt6 #17167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,6 @@ param.sfo

# Visual Studio Code
.vscode/

# Clazy
*.clazy.yaml
12 changes: 11 additions & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ ifeq ($(HAVE_NOUNUSED_VARIABLE), 1)
DEF_FLAGS += $(NOUNUSED_VARIABLE_CFLAGS)
endif

ifeq ($(HAVE_CXX11), 1)
ifeq ($(HAVE_QT6), 1)
CXXFLAGS += $(CXX17_CFLAGS)
else ifeq ($(HAVE_CXX11), 1)
CXXFLAGS += $(CXX11_CFLAGS)
endif

Expand Down Expand Up @@ -531,10 +533,18 @@ ifeq ($(HAVE_QT), 1)
endif

DEFINES += -DHAVE_MAIN
ifeq ($(HAVE_QT6), 1)
CXXFLAGS += -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 $(QT6CORE_CFLAGS) $(QT6GUI_CFLAGS) $(QT6WIDGETS_CFLAGS) $(QT6CONCURRENT_CFLAGS) $(QT6NETWORK_CFLAGS)
#DEF_FLAGS += $(QT6WEBENGINE_CFLAGS)
LIBS += $(QT6CORE_LIBS) $(QT6GUI_LIBS) $(QT6WIDGETS_LIBS) $(QT6CONCURRENT_LIBS) $(QT6NETWORK_LIBS)
#LIBS += $(QT6WEBENGINE_LIBS)
else
DEF_FLAGS += $(QT5CORE_CFLAGS) $(QT5GUI_CFLAGS) $(QT5WIDGETS_CFLAGS) $(QT5CONCURRENT_CFLAGS) $(QT5NETWORK_CFLAGS)
#DEF_FLAGS += $(QT5WEBENGINE_CFLAGS)
LIBS += $(QT5CORE_LIBS) $(QT5GUI_LIBS) $(QT5WIDGETS_LIBS) $(QT5CONCURRENT_LIBS) $(QT5NETWORK_LIBS)
#LIBS += $(QT5WEBENGINE_LIBS)
endif

NEED_CXX_LINKER = 1

ifneq ($(findstring Linux,$(OS)),)
Expand Down
65 changes: 47 additions & 18 deletions qb/config.libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if [ "$HAVE_C99" = 'no' ]; then
fi

check_switch cxx CXX11 -std=c++11 ''
check_switch cxx CXX17 -std=c++17 ''
check_switch '' NOUNUSED -Wno-unused-result ''
check_switch '' NOUNUSED_VARIABLE -Wno-unused-variable ''

Expand Down Expand Up @@ -277,30 +278,58 @@ if [ "$HAVE_SDL2" = 'yes' ] && [ "$HAVE_SDL" = 'yes' ]; then
fi

check_enabled CXX11 CXX C++ 'C++11 support is' false
check_enabled CXX17 CXX C++ 'C++17 support is' false

check_platform Haiku DISCORD 'Discord is' false
check_enabled CXX DISCORD discord 'The C++ compiler is' false
check_enabled CXX QT 'Qt companion' 'The C++ compiler is' false

if [ "$HAVE_QT" != 'no' ]; then
check_pkgconf QT5CORE Qt5Core 5.2
check_pkgconf QT5GUI Qt5Gui 5.2
check_pkgconf QT5WIDGETS Qt5Widgets 5.2
check_pkgconf QT5CONCURRENT Qt5Concurrent 5.2
check_pkgconf QT5NETWORK Qt5Network 5.2
#check_pkgconf QT5WEBENGINE Qt5WebEngine 5.4

# pkg-config is needed to reliably find Qt5 libraries.

check_enabled QT5CORE QT Qt 'Qt5Core is' true
check_enabled QT5GUI QT Qt 'Qt5GUI is' true
check_enabled QT5WIDGETS QT Qt 'Qt5Widgets is' true
check_enabled QT5CONCURRENT QT Qt 'Qt5Concurrent is' true
check_enabled QT5NETWORK QT Qt 'Qt5Network is' true
#check_enabled QT5WEBENGINE QT Qt 'Qt5Webengine is' true

if [ "$HAVE_QT" != yes ]; then
die : 'Notice: Qt support disabled, required libraries were not found.'
if [ "$HAVE_CXX17" = 'yes' ]; then
check_pkgconf QT6CORE Qt6Core 6.2
check_pkgconf QT6GUI Qt6Gui 6.2
check_pkgconf QT6WIDGETS Qt6Widgets 6.2
check_pkgconf QT6CONCURRENT Qt6Concurrent 6.2
check_pkgconf QT6NETWORK Qt6Network 6.2
#check_pkgconf QT6WEBENGINE Qt6WebEngine 6.2

# pkg-config is needed to reliably find Qt6 libraries.

check_enabled QT6CORE QT Qt 'Qt6Core is' true
check_enabled QT6GUI QT Qt 'Qt6GUI is' true
check_enabled QT6WIDGETS QT Qt 'Qt6Widgets is' true
check_enabled QT6CONCURRENT QT Qt 'Qt6Concurrent is' true
check_enabled QT6NETWORK QT Qt 'Qt6Network is' true
#check_enabled QT6WEBENGINE QT Qt 'Qt6Webengine is' true

if [ "$HAVE_QT" != yes ]; then
die : 'Notice: Qt support disabled, required libraries were not found.'
else
HAVE_QT6='yes'
add_define MAKEFILE HAVE_QT6 1
fi
fi
if [ "$HAVE_QT6" != 'yes' ]; then
HAVE_QT='auto'
check_pkgconf QT5CORE Qt5Core 5.2
check_pkgconf QT5GUI Qt5Gui 5.2
check_pkgconf QT5WIDGETS Qt5Widgets 5.2
check_pkgconf QT5CONCURRENT Qt5Concurrent 5.2
check_pkgconf QT5NETWORK Qt5Network 5.2
#check_pkgconf QT5WEBENGINE Qt6WebEngine 5.2

# pkg-config is needed to reliably find Qt5 libraries.

check_enabled QT5CORE QT Qt 'Qt5Core is' true
check_enabled QT5GUI QT Qt 'Qt5GUI is' true
check_enabled QT5WIDGETS QT Qt 'Qt5Widgets is' true
check_enabled QT5CONCURRENT QT Qt 'Qt5Concurrent is' true
check_enabled QT5NETWORK QT Qt 'Qt5Network is' true
#check_enabled QT5WEBENGINE QT Qt 'Qt5Webengine is' true

if [ "$HAVE_QT" != yes ]; then
die : 'Notice: Qt support disabled, required libraries were not found.'
fi
fi

check_pkgconf OPENSSL openssl 1.0.0
Expand Down
4 changes: 2 additions & 2 deletions qb/config.moc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
QT_VERSION=qt5
QT_FLAGS="$CXX11_CFLAGS $QT5CORE_CFLAGS $QT5CORE_LIBS"
[ "$HAVE_QT6" = "yes" ] && QT_VERSION=qt6 || QT_VERSION=qt5
[ "$HAVE_QT6" = "yes" ] && QT_FLAGS="$CXX17_CFLAGS $QT6CORE_CFLAGS $QT6CORE_LIBS" || QT_FLAGS="$CXX11_CFLAGS $QT5CORE_CFLAGS $QT5CORE_LIBS"

add_define MAKEFILE QT_VERSION "$QT_VERSION"
6 changes: 5 additions & 1 deletion qb/qb.moc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ if [ "$HAVE_QT" = "yes" ]; then
>/dev/null 2>&1 &&
moc_works=1
else
for moc in "moc-$QT_VERSION" moc; do
if [ "$QT_VERSION" = "qt6" ]; then
QMAKE="$(exists qmake6)" || QMAKE="qmake"
$QMAKE -query QT_HOST_LIBEXECS && QT_HOST_LIBEXECS="$($QMAKE -query QT_HOST_LIBEXECS)/"
fi
for moc in "${QT_HOST_LIBEXECS}moc-$QT_VERSION" "${QT_HOST_LIBEXECS}moc"; do
MOC="$(exists "$moc")" || MOC=""
if [ "$MOC" ]; then
QT_SELECT="$QT_VERSION" \
Expand Down
5 changes: 5 additions & 0 deletions ui/drivers/qt/gridview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,12 @@ void GridView::paintEvent(QPaintEvent*)
{
QModelIndex index = model()->index(row, 0, rootIndex());
QRectF rect = viewportRectForRow(row);
#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
QStyleOptionViewItem option;
initViewItemOption(&option);
#else
QStyleOptionViewItem option = viewOptions();
#endif

if (!rect.isValid() || rect.bottom() < 0 || rect.y() > viewport()->height())
continue;
Expand Down
Loading
Loading