Merge pull request #11775 from shuffle2/qtnext2
qt: raise min version to 6
This commit is contained in:
commit
71a56d9e04
|
@ -13,16 +13,10 @@ endif()
|
|||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
|
||||
# For some reason the method in Qt6 documentation is not working (at least on ubuntu jammy)
|
||||
# When Qt5 and Qt6 are given in same NAMES entry, only Qt5 is ever found.
|
||||
find_package(QT NAMES Qt6 COMPONENTS Core Gui Widgets)
|
||||
if(NOT QT_DIR)
|
||||
find_package(QT NAMES Qt5 COMPONENTS Core Gui Widgets)
|
||||
endif()
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets)
|
||||
message(STATUS "Found Qt version ${QT_VERSION}")
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
|
||||
message(STATUS "Found Qt version ${Qt6_VERSION}")
|
||||
|
||||
set_property(TARGET Qt${QT_VERSION_MAJOR}::Core PROPERTY INTERFACE_COMPILE_FEATURES "")
|
||||
set_property(TARGET Qt6::Core PROPERTY INTERFACE_COMPILE_FEATURES "")
|
||||
|
||||
add_executable(dolphin-emu
|
||||
AboutDialog.cpp
|
||||
|
@ -374,13 +368,13 @@ PRIVATE
|
|||
target_include_directories(dolphin-emu
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS}
|
||||
${Qt6Gui_PRIVATE_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(dolphin-emu
|
||||
PRIVATE
|
||||
core
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt6::Widgets
|
||||
uicommon
|
||||
imgui
|
||||
implot
|
||||
|
@ -408,14 +402,9 @@ if (MSVC)
|
|||
# Qt 6.3.0 headers use std::aligned_storage instead of alignas
|
||||
target_compile_definitions(dolphin-emu PRIVATE _SILENCE_CXX23_ALIGNED_STORAGE_DEPRECATION_WARNING)
|
||||
|
||||
if ("${QT_VERSION_MAJOR}" GREATER_EQUAL 6)
|
||||
# Qt6 requires RTTI
|
||||
remove_cxx_flag_from_target(dolphin-emu "/GR-")
|
||||
target_compile_options(dolphin-emu PRIVATE "/GR")
|
||||
else()
|
||||
# Add precompiled header
|
||||
target_link_libraries(audiocommon PRIVATE use_pch)
|
||||
endif()
|
||||
# Qt6 requires RTTI
|
||||
remove_cxx_flag_from_target(dolphin-emu "/GR-")
|
||||
target_compile_options(dolphin-emu PRIVATE "/GR")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
@ -448,17 +437,10 @@ if(WIN32)
|
|||
)
|
||||
|
||||
# Delegate to Qt's official deployment binary on Windows to copy over the necessary Qt-specific libraries, etc.
|
||||
get_target_property(MOC_EXECUTABLE_LOCATION Qt${QT_VERSION_MAJOR}::moc IMPORTED_LOCATION)
|
||||
get_target_property(MOC_EXECUTABLE_LOCATION Qt6::moc IMPORTED_LOCATION)
|
||||
get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY)
|
||||
find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}")
|
||||
|
||||
if ("${QT_VERSION_MAJOR}" LESS 6)
|
||||
set(NO_ANGLE_PARAM "--no-angle")
|
||||
else()
|
||||
# parameter no longer exists in Qt6
|
||||
set(NO_ANGLE_PARAM "")
|
||||
endif()
|
||||
|
||||
# Note: We set the PATH for the duration of this command so that the
|
||||
# deployment application is able to locate the Qt libraries to copy.
|
||||
# if the necessary paths aren't already set beforehand.
|
||||
|
@ -481,7 +463,6 @@ if(WIN32)
|
|||
--no-translations
|
||||
--no-compiler-runtime
|
||||
--no-system-d3d-compiler
|
||||
"${NO_ANGLE_PARAM}"
|
||||
--no-opengl-sw
|
||||
"$<TARGET_FILE:dolphin-emu>"
|
||||
)
|
||||
|
@ -560,18 +541,16 @@ if(APPLE)
|
|||
target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/Dolphin.icns")
|
||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/Dolphin.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
||||
|
||||
# Plugins have to be manually included with Qt 6
|
||||
if (QT_VERSION_MAJOR EQUAL 6)
|
||||
find_package(Qt6QMacStylePlugin REQUIRED PATHS ${Qt6Widgets_DIR})
|
||||
find_package(Qt6QCocoaIntegrationPlugin REQUIRED PATHS ${Qt6Gui_DIR})
|
||||
endif()
|
||||
# Manually include plugins
|
||||
find_package(Qt6QMacStylePlugin REQUIRED PATHS ${Qt6Widgets_DIR})
|
||||
find_package(Qt6QCocoaIntegrationPlugin REQUIRED PATHS ${Qt6Gui_DIR})
|
||||
|
||||
# Copy Qt plugins into the bundle
|
||||
get_target_property(qtcocoa_location Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin LOCATION)
|
||||
get_target_property(qtcocoa_location Qt6::QCocoaIntegrationPlugin LOCATION)
|
||||
target_sources(dolphin-emu PRIVATE "${qtcocoa_location}")
|
||||
set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms)
|
||||
|
||||
get_target_property(qtmacstyle_location Qt${QT_VERSION_MAJOR}::QMacStylePlugin LOCATION)
|
||||
get_target_property(qtmacstyle_location Qt6::QMacStylePlugin LOCATION)
|
||||
target_sources(dolphin-emu PRIVATE "${qtmacstyle_location}")
|
||||
set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles)
|
||||
|
||||
|
|
|
@ -16,12 +16,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QStyle>
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
#include <QScreen>
|
||||
#else
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <QToolTip>
|
||||
|
@ -105,11 +100,7 @@ BalloonTip::BalloonTip(PrivateTag, const QIcon& icon, QString title, QString mes
|
|||
message_label->setTextFormat(Qt::RichText);
|
||||
message_label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
const int limit = QApplication::desktop()->availableGeometry(message_label).width() / 3;
|
||||
#else
|
||||
const int limit = message_label->screen()->availableGeometry().width() / 3;
|
||||
#endif
|
||||
message_label->setMaximumWidth(limit);
|
||||
message_label->setSizePolicy(QSizePolicy::Policy::MinimumExpanding,
|
||||
QSizePolicy::Policy::MinimumExpanding);
|
||||
|
@ -136,14 +127,11 @@ void BalloonTip::UpdateBoundsAndRedraw(const QPoint& pos, ShowArrow show_arrow)
|
|||
{
|
||||
m_show_arrow = show_arrow == ShowArrow::Yes;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
const QRect screen_rect = QApplication::desktop()->screenGeometry(pos);
|
||||
#else
|
||||
QScreen* screen = QGuiApplication::screenAt(pos);
|
||||
if (!screen)
|
||||
screen = QGuiApplication::primaryScreen();
|
||||
const QRect screen_rect = screen->geometry();
|
||||
#endif
|
||||
|
||||
QSize sh = sizeHint();
|
||||
// The look should resemble the default tooltip style set in Settings::SetCurrentUserStyle()
|
||||
const int border = 1;
|
||||
|
|
|
@ -22,11 +22,7 @@ public:
|
|||
void SetDescription(QString description) { m_description = std::move(description); }
|
||||
|
||||
private:
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
void enterEvent(QEvent* event) override
|
||||
#else
|
||||
void enterEvent(QEnterEvent* event) override
|
||||
#endif
|
||||
{
|
||||
if (m_timer_id)
|
||||
return;
|
||||
|
|
|
@ -212,11 +212,7 @@ void MemoryViewWidget::UpdateFont()
|
|||
// BoundingRect is too unpredictable, a custom one would be needed for each view type. Different
|
||||
// fonts have wildly different spacing between two characters and horizontalAdvance includes
|
||||
// spacing.
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
m_font_width = fm.horizontalAdvance(QLatin1Char('0'));
|
||||
#else
|
||||
m_font_width = fm.width(QLatin1Char('0'));
|
||||
#endif
|
||||
m_table->setFont(Settings::Instance().GetDebugFont());
|
||||
|
||||
CreateTable();
|
||||
|
|
|
@ -514,12 +514,7 @@ void GBAWidget::mouseMoveEvent(QMouseEvent* event)
|
|||
{
|
||||
if (!m_moving)
|
||||
return;
|
||||
auto event_pos =
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
event->globalPosition().toPoint();
|
||||
#else
|
||||
event->globalPos();
|
||||
#endif
|
||||
auto event_pos = event->globalPosition().toPoint();
|
||||
move(event_pos - m_move_pos - (geometry().topLeft() - pos()));
|
||||
}
|
||||
|
||||
|
|
|
@ -191,7 +191,11 @@ void MenuBar::OnDebugModeToggled(bool enabled)
|
|||
void MenuBar::AddFileMenu()
|
||||
{
|
||||
QMenu* file_menu = addMenu(tr("&File"));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
m_open_action = file_menu->addAction(tr("&Open..."), QKeySequence::Open, this, &MenuBar::Open);
|
||||
#else
|
||||
m_open_action = file_menu->addAction(tr("&Open..."), this, &MenuBar::Open, QKeySequence::Open);
|
||||
#endif
|
||||
|
||||
file_menu->addSeparator();
|
||||
|
||||
|
@ -501,14 +505,23 @@ void MenuBar::AddViewMenu()
|
|||
connect(&Settings::Instance(), &Settings::GameListRefreshStarted, purge_action,
|
||||
[purge_action] { purge_action->setEnabled(true); });
|
||||
view_menu->addSeparator();
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
view_menu->addAction(tr("Search"), QKeySequence::Find, this, &MenuBar::ShowSearch);
|
||||
#else
|
||||
view_menu->addAction(tr("Search"), this, &MenuBar::ShowSearch, QKeySequence::Find);
|
||||
#endif
|
||||
}
|
||||
|
||||
void MenuBar::AddOptionsMenu()
|
||||
{
|
||||
QMenu* options_menu = addMenu(tr("&Options"));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
options_menu->addAction(tr("Co&nfiguration"), QKeySequence::Preferences, this,
|
||||
&MenuBar::Configure);
|
||||
#else
|
||||
options_menu->addAction(tr("Co&nfiguration"), this, &MenuBar::Configure,
|
||||
QKeySequence::Preferences);
|
||||
#endif
|
||||
options_menu->addSeparator();
|
||||
options_menu->addAction(tr("&Graphics Settings"), this, &MenuBar::ConfigureGraphics);
|
||||
options_menu->addAction(tr("&Audio Settings"), this, &MenuBar::ConfigureAudio);
|
||||
|
|
Loading…
Reference in New Issue