From 004e8a80b2cd577f0dd6b7b998d11181798c69da Mon Sep 17 00:00:00 2001 From: spycrab Date: Sun, 25 Apr 2021 02:18:28 +0200 Subject: [PATCH] Add support for building against Qt 6 --- BuildMacOSUniversalBinary.py | 2 +- CMakeSettings.json | 16 +- Externals/Qt | 2 +- Source/Core/DolphinQt/CMakeLists.txt | 49 ++- .../DolphinQt/CheatSearchFactoryWidget.cpp | 2 +- .../Config/CommonControllersWidget.cpp | 2 +- .../Config/GamecubeControllersWidget.cpp | 2 +- .../Config/ToolTipControls/ToolTipWidget.h | 4 + .../Config/WiimoteControllersWidget.cpp | 4 +- Source/Core/DolphinQt/DolphinQt.vcxproj | 18 +- Source/Core/DolphinQt/GBAWidget.cpp | 8 +- Source/Core/DolphinQt/GameList/GameList.cpp | 4 +- Source/Core/DolphinQt/Main.cpp | 9 +- Source/Core/DolphinQt/MainWindow.cpp | 4 +- Source/Core/DolphinQt/MenuBar.cpp | 2 +- .../QtUtils/ParallelProgressDialog.h | 5 + Source/Core/DolphinQt/RenderWidget.cpp | 4 +- Source/Core/DolphinQt/TAS/IRWidget.cpp | 4 +- Source/Core/DolphinQt/TAS/StickWidget.cpp | 4 +- Source/Core/DolphinQt/TAS/TASInputWindow.cpp | 6 +- .../Core/DolphinQt/TAS/WiiTASInputWindow.cpp | 4 +- Source/Core/DolphinQt/qt6.natvis | 406 ++++++++++++++++++ Source/VSProps/QtCompile.props | 66 +-- Source/VSProps/qtmoc.props | 2 +- 24 files changed, 545 insertions(+), 84 deletions(-) create mode 100644 Source/Core/DolphinQt/qt6.natvis diff --git a/BuildMacOSUniversalBinary.py b/BuildMacOSUniversalBinary.py index 5f9b45744c..0e01057b27 100755 --- a/BuildMacOSUniversalBinary.py +++ b/BuildMacOSUniversalBinary.py @@ -261,7 +261,7 @@ def build(config): os.mkdir(arch) env = os.environ.copy() - env["Qt5_DIR"] = config[arch+"_qt5_path"] + env["QT_DIR"] = config[arch+"_qt5_path"] env["CMAKE_OSX_ARCHITECTURES"] = arch env["CMAKE_PREFIX_PATH"] = config[arch+"_cmake_prefix"] diff --git a/CMakeSettings.json b/CMakeSettings.json index c571312285..94812b270f 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -10,8 +10,8 @@ "cmakeCommandArgs": "", "variables": [ { - "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_64\\lib\\cmake\\Qt5" + "name": "QT_DIR", + "value": "${workspaceRoot}\\Externals\\Qt\\Qt6.3.0\\x64\\lib\\cmake\\Qt6" } ] }, @@ -25,8 +25,8 @@ "cmakeCommandArgs": "", "variables": [ { - "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_64\\lib\\cmake\\Qt5" + "name": "QT_DIR", + "value": "${workspaceRoot}\\Externals\\Qt\\Qt6.3.0\\x64\\lib\\cmake\\Qt6" } ] }, @@ -40,8 +40,8 @@ "cmakeCommandArgs": "", "variables": [ { - "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_arm64\\lib\\cmake\\Qt5" + "name": "QT_DIR", + "value": "${workspaceRoot}\\Externals\\Qt\\Qt6.3.0\\ARM64\\lib\\cmake\\Qt6" }, { "name": "CMAKE_SYSTEM_NAME", @@ -63,8 +63,8 @@ "cmakeCommandArgs": "", "variables": [ { - "name": "Qt5_DIR", - "value": "${workspaceRoot}\\Externals\\Qt\\Qt5.15.0\\msvc2019_arm64\\lib\\cmake\\Qt5" + "name": "QT_DIR", + "value": "${workspaceRoot}\\Externals\\Qt\\Qt6.3.0\\ARM64\\lib\\cmake\\Qt6" }, { "name": "CMAKE_SYSTEM_NAME", diff --git a/Externals/Qt b/Externals/Qt index 5ab31b5fdf..9498dbe942 160000 --- a/Externals/Qt +++ b/Externals/Qt @@ -1 +1 @@ -Subproject commit 5ab31b5fdf1cdc59b9e8c82a0f7c12d5fe878cd8 +Subproject commit 9498dbe9421a80da674212fee0bf745883464992 diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index e08af734cc..000e5767a4 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -1,18 +1,29 @@ -if (NOT Qt5_DIR AND MSVC) +if(POLICY CMP0084) + # Disable trying to search for Qt3/4 if what we actually want is not found + cmake_policy(SET CMP0084 NEW) +endif() + +if (NOT QT_DIR AND MSVC) if(_M_ARM_64) - set(Qt5_DIR "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt5.15.0/msvc2019_arm64/lib/cmake/Qt5") + set(QT_DIR "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.3.0/ARM64/lib/cmake/Qt6") else() - set(Qt5_DIR "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt5.15.0/msvc2019_64/lib/cmake/Qt5") + set(QT_DIR "${CMAKE_SOURCE_DIR}/Externals/Qt/Qt6.3.0/x64/lib/cmake/Qt6") endif() endif() -find_package(Qt5 5.9 REQUIRED COMPONENTS Gui Widgets) - -set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES "") -message(STATUS "Found Qt version ${Qt5Core_VERSION}") - 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}") + +set_property(TARGET Qt${QT_VERSION_MAJOR}::Core PROPERTY INTERFACE_COMPILE_FEATURES "") + add_executable(dolphin-emu AboutDialog.cpp AboutDialog.h @@ -351,13 +362,13 @@ PRIVATE target_include_directories(dolphin-emu PRIVATE ${CMAKE_CURRENT_BINARY_DIR} - ${Qt5Gui_PRIVATE_INCLUDE_DIRS} + ${Qt${QT_VERSION_MAJOR}Gui_PRIVATE_INCLUDE_DIRS} ) target_link_libraries(dolphin-emu PRIVATE core - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Widgets uicommon imgui ) @@ -377,9 +388,9 @@ if (MSVC) set(qtGui "") set(qtGuiPriv "") set(qtWidgetsPriv "") - list(TRANSFORM Qt5Gui_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtGui) - list(TRANSFORM Qt5Gui_PRIVATE_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtGuiPriv) - list(TRANSFORM Qt5Widgets_PRIVATE_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtWidgetsPriv) + list(TRANSFORM Qt6Gui_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtGui) + list(TRANSFORM Qt6Gui_PRIVATE_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtGuiPriv) + list(TRANSFORM Qt6Widgets_PRIVATE_INCLUDE_DIRS PREPEND "/external:I" OUTPUT_VARIABLE qtWidgetsPriv) target_compile_options(dolphin-emu PRIVATE "${qtGui}") target_compile_options(dolphin-emu PRIVATE "${qtGuiPriv}") target_compile_options(dolphin-emu PRIVATE "${qtWidgets}") @@ -415,7 +426,7 @@ 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 Qt5::moc IMPORTED_LOCATION) + get_target_property(MOC_EXECUTABLE_LOCATION Qt${QT_VERSION_MAJOR}::moc IMPORTED_LOCATION) get_filename_component(QT_BINARY_DIRECTORY "${MOC_EXECUTABLE_LOCATION}" DIRECTORY) find_program(WINDEPLOYQT_EXE windeployqt HINTS "${QT_BINARY_DIRECTORY}") @@ -520,12 +531,18 @@ 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() + # Copy Qt plugins into the bundle - get_target_property(qtcocoa_location Qt5::QCocoaIntegrationPlugin LOCATION) + get_target_property(qtcocoa_location Qt${QT_VERSION_MAJOR}::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 Qt5::QMacStylePlugin LOCATION) + get_target_property(qtmacstyle_location Qt${QT_VERSION_MAJOR}::QMacStylePlugin LOCATION) target_sources(dolphin-emu PRIVATE "${qtmacstyle_location}") set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles) diff --git a/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp b/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp index 4b62a9f6a6..637d00ef67 100644 --- a/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp +++ b/Source/Core/DolphinQt/CheatSearchFactoryWidget.cpp @@ -55,7 +55,7 @@ void CheatSearchFactoryWidget::CreateWidgets() label_standard_address_space->setWordWrap(true); auto* custom_address_space_layout = new QVBoxLayout(); - custom_address_space_layout->setMargin(6); + custom_address_space_layout->setContentsMargins(6, 6, 6, 6); auto* custom_address_space_button_group = new QButtonGroup(this); m_custom_virtual_address_space = new QRadioButton(tr("Use virtual addresses when possible")); m_custom_virtual_address_space->setChecked(true); diff --git a/Source/Core/DolphinQt/Config/CommonControllersWidget.cpp b/Source/Core/DolphinQt/Config/CommonControllersWidget.cpp index 245fca6d83..0f43658ae3 100644 --- a/Source/Core/DolphinQt/Config/CommonControllersWidget.cpp +++ b/Source/Core/DolphinQt/Config/CommonControllersWidget.cpp @@ -36,7 +36,7 @@ void CommonControllersWidget::CreateLayout() m_common_box->setLayout(m_common_layout); auto* layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setAlignment(Qt::AlignTop); layout->addWidget(m_common_box); setLayout(layout); diff --git a/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp b/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp index a4ce7b4bab..3b18baf1e9 100644 --- a/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp +++ b/Source/Core/DolphinQt/Config/GamecubeControllersWidget.cpp @@ -92,7 +92,7 @@ void GamecubeControllersWidget::CreateLayout() m_gc_box->setLayout(m_gc_layout); auto* layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setAlignment(Qt::AlignTop); layout->addWidget(m_gc_box); setLayout(layout); diff --git a/Source/Core/DolphinQt/Config/ToolTipControls/ToolTipWidget.h b/Source/Core/DolphinQt/Config/ToolTipControls/ToolTipWidget.h index fee62da77f..127a708aa6 100644 --- a/Source/Core/DolphinQt/Config/ToolTipControls/ToolTipWidget.h +++ b/Source/Core/DolphinQt/Config/ToolTipControls/ToolTipWidget.h @@ -22,7 +22,11 @@ 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; diff --git a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp index 37fff86807..392af928d8 100644 --- a/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp +++ b/Source/Core/DolphinQt/Config/WiimoteControllersWidget.cpp @@ -74,7 +74,7 @@ static int GetLayoutHorizontalSpacing(const QGridLayout* layout) float pixel_ratio = QGuiApplication::primaryScreen()->devicePixelRatio(); #ifdef __APPLE__ // TODO is this still required? - hspacing = pixel_ratio * style->pixelMetric(QStyle::PM_DefaultLayoutSpacing); + hspacing = pixel_ratio * style->pixelMetric(QStyle::PM_LayoutHorizontalSpacing); if (hspacing >= 0) return hspacing; #endif @@ -145,7 +145,7 @@ void WiimoteControllersWidget::CreateLayout() m_wiimote_layout->addWidget(m_wiimote_refresh, continuous_scanning_row, 3); auto* layout = new QVBoxLayout; - layout->setMargin(0); + layout->setContentsMargins(0, 0, 0, 0); layout->setAlignment(Qt::AlignTop); layout->addWidget(m_wiimote_box); setLayout(layout); diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj b/Source/Core/DolphinQt/DolphinQt.vcxproj index abd204ca29..da9e6096b0 100644 --- a/Source/Core/DolphinQt/DolphinQt.vcxproj +++ b/Source/Core/DolphinQt/DolphinQt.vcxproj @@ -13,14 +13,11 @@ - - - 5054;%(DisableSpecificWarnings) $(ProjectDir)Config\Graphics;%(AdditionalIncludeDirectories) $(ProjectDir)Config;%(AdditionalIncludeDirectories) $(ProjectDir)Config\ControllerInterface;%(AdditionalIncludeDirectories) @@ -33,6 +30,8 @@ $(ProjectDir)Settings;%(AdditionalIncludeDirectories) $(ProjectDir)TAS;%(AdditionalIncludeDirectories) $(ProjectDir)VideoInterface;%(AdditionalIncludeDirectories) + + false DolphinQt.manifest;%(AdditionalManifestFiles) @@ -379,6 +378,9 @@ + + + {D79392F7-06D6-4B4B-A39F-4D587C215D3A} @@ -389,6 +391,16 @@ {0e033be3-2e08-428e-9ae9-bc673efa12b5} + + + {76563A7F-1011-4EAD-B667-7BB18D09568E} + false + true + true + diff --git a/Source/Core/DolphinQt/GBAWidget.cpp b/Source/Core/DolphinQt/GBAWidget.cpp index db05c04367..2fd36ac070 100644 --- a/Source/Core/DolphinQt/GBAWidget.cpp +++ b/Source/Core/DolphinQt/GBAWidget.cpp @@ -510,7 +510,13 @@ void GBAWidget::mouseMoveEvent(QMouseEvent* event) { if (!m_moving) return; - move(event->globalPos() - m_move_pos - (geometry().topLeft() - pos())); + auto event_pos = +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + event->globalPosition().toPoint(); +#else + event->globalPos(); +#endif + move(event_pos - m_move_pos - (geometry().topLeft() - pos())); } void GBAWidget::paintEvent(QPaintEvent* event) diff --git a/Source/Core/DolphinQt/GameList/GameList.cpp b/Source/Core/DolphinQt/GameList/GameList.cpp index cc5b1ebb43..5583497435 100644 --- a/Source/Core/DolphinQt/GameList/GameList.cpp +++ b/Source/Core/DolphinQt/GameList/GameList.cpp @@ -108,14 +108,14 @@ GameList::GameList(QWidget* parent) : QStackedWidget(parent), m_model(this) // conceptually as 'control plus' (which is then interpreted as an appropriate zooming action) // instead of the technically correct 'control equal'. Qt doesn't account for this convention so // an alternate shortcut is needed to avoid counterintuitive behavior. - const auto* zoom_in_alternate = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Equal), this); + const auto* zoom_in_alternate = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Equal), this); connect(zoom_in_alternate, &QShortcut::activated, this, &GameList::ZoomIn); // The above correction introduces a different inconsistency: now zooming in can be done using // conceptual 'control plus' or 'control shift plus', while zooming out can only be done using // 'control minus'. Adding an alternate shortcut representing 'control shift minus' restores // consistency. - const auto* zoom_out_alternate = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Underscore), this); + const auto* zoom_out_alternate = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Underscore), this); connect(zoom_out_alternate, &QShortcut::activated, this, &GameList::ZoomOut); connect(&Settings::Instance(), &Settings::MetadataRefreshCompleted, this, diff --git a/Source/Core/DolphinQt/Main.cpp b/Source/Core/DolphinQt/Main.cpp index 88f716b5a6..defffa5e42 100644 --- a/Source/Core/DolphinQt/Main.cpp +++ b/Source/Core/DolphinQt/Main.cpp @@ -132,8 +132,15 @@ int main(int argc, char* argv[]) const optparse::Values& options = CommandLineParse::ParseArguments(parser.get(), argc, argv); const std::vector args = parser->args(); + // setHighDpiScaleFactorRoundingPolicy was added in 5.14, but default behavior changed in 6.0 +#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) + // Set to the previous default behavior + QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round); +#else QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); +#endif + QCoreApplication::setOrganizationName(QStringLiteral("Dolphin Emulator")); QCoreApplication::setOrganizationDomain(QStringLiteral("dolphin-emu.org")); QCoreApplication::setApplicationName(QStringLiteral("dolphin-emu")); @@ -144,7 +151,7 @@ int main(int argc, char* argv[]) QApplication app(argc, argv); #endif -#ifdef _WIN32 +#if defined(_WIN32) && (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) // On Windows, Qt 5's default system font (MS Shell Dlg 2) is outdated. // Interestingly, the QMenu font is correct and comes from lfMenuFont // (Segoe UI on English computers). diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 3be8f9d6a0..5099ffa0e2 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -825,7 +825,7 @@ void MainWindow::TogglePause() void MainWindow::OnStopComplete() { m_stop_requested = false; - HideRenderWidget(true, m_exit_requested); + HideRenderWidget(!m_exit_requested, m_exit_requested); #ifdef USE_DISCORD_PRESENCE if (!m_netplay_dialog->isVisible()) Discord::UpdateDiscordPresence(); @@ -834,7 +834,7 @@ void MainWindow::OnStopComplete() SetFullScreenResolution(false); if (m_exit_requested || Settings::Instance().IsBatchModeEnabled()) - QGuiApplication::instance()->quit(); + QGuiApplication::exit(0); // If the current emulation prevented the booting of another, do that now if (m_pending_boot != nullptr) diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp index a353cb5734..1ace1276b8 100644 --- a/Source/Core/DolphinQt/MenuBar.cpp +++ b/Source/Core/DolphinQt/MenuBar.cpp @@ -218,7 +218,7 @@ void MenuBar::AddFileMenu() file_menu->addSeparator(); m_exit_action = file_menu->addAction(tr("E&xit"), this, &MenuBar::Exit); - m_exit_action->setShortcuts({QKeySequence::Quit, QKeySequence(Qt::ALT + Qt::Key_F4)}); + m_exit_action->setShortcuts({QKeySequence::Quit, QKeySequence(Qt::ALT | Qt::Key_F4)}); } void MenuBar::AddToolsMenu() diff --git a/Source/Core/DolphinQt/QtUtils/ParallelProgressDialog.h b/Source/Core/DolphinQt/QtUtils/ParallelProgressDialog.h index a784685d9a..4335ec4b9f 100644 --- a/Source/Core/DolphinQt/QtUtils/ParallelProgressDialog.h +++ b/Source/Core/DolphinQt/QtUtils/ParallelProgressDialog.h @@ -16,6 +16,11 @@ class ParallelProgressDialog final : public QObject Q_OBJECT public: + ParallelProgressDialog(const ParallelProgressDialog&) = delete; + ParallelProgressDialog& operator=(const ParallelProgressDialog&) = delete; + ParallelProgressDialog(ParallelProgressDialog&&) = delete; + ParallelProgressDialog& operator=(ParallelProgressDialog&&) = delete; + // Only use this from the main thread template ParallelProgressDialog(Args&&... args) : m_dialog{std::forward(args)...} diff --git a/Source/Core/DolphinQt/RenderWidget.cpp b/Source/Core/DolphinQt/RenderWidget.cpp index 2430b7a415..013f4dce00 100644 --- a/Source/Core/DolphinQt/RenderWidget.cpp +++ b/Source/Core/DolphinQt/RenderWidget.cpp @@ -502,8 +502,8 @@ void RenderWidget::PassEventToImGui(const QEvent* event) // coordinates (as if the screen was standard dpi). We need to update the mouse position in // native coordinates, as the UI (and game) is rendered at native resolution. const float scale = devicePixelRatio(); - ImGui::GetIO().MousePos.x = static_cast(event)->x() * scale; - ImGui::GetIO().MousePos.y = static_cast(event)->y() * scale; + ImGui::GetIO().MousePos.x = static_cast(event)->pos().x() * scale; + ImGui::GetIO().MousePos.y = static_cast(event)->pos().y() * scale; } break; diff --git a/Source/Core/DolphinQt/TAS/IRWidget.cpp b/Source/Core/DolphinQt/TAS/IRWidget.cpp index c1587cfd0e..992c10c90e 100644 --- a/Source/Core/DolphinQt/TAS/IRWidget.cpp +++ b/Source/Core/DolphinQt/TAS/IRWidget.cpp @@ -87,8 +87,8 @@ void IRWidget::handleMouseEvent(QMouseEvent* event) else { // convert from widget space to value space - int new_x = ir_max_x - (event->x() * ir_max_x) / width(); - int new_y = (event->y() * ir_max_y) / height(); + int new_x = ir_max_x - (event->pos().x() * ir_max_x) / width(); + int new_y = (event->pos().y() * ir_max_y) / height(); m_x = std::max(0, std::min(static_cast(ir_max_x), new_x)); m_y = std::max(0, std::min(static_cast(ir_max_y), new_y)); diff --git a/Source/Core/DolphinQt/TAS/StickWidget.cpp b/Source/Core/DolphinQt/TAS/StickWidget.cpp index 26f806971a..7a8842477a 100644 --- a/Source/Core/DolphinQt/TAS/StickWidget.cpp +++ b/Source/Core/DolphinQt/TAS/StickWidget.cpp @@ -90,8 +90,8 @@ void StickWidget::handleMouseEvent(QMouseEvent* event) else { // convert from widget space to value space - int new_x = (event->x() * m_max_x) / width(); - int new_y = m_max_y - (event->y() * m_max_y) / height(); + int new_x = (event->pos().x() * m_max_x) / width(); + int new_y = m_max_y - (event->pos().y() * m_max_y) / height(); m_x = std::max(0, std::min(static_cast(m_max_x), new_x)); m_y = std::max(0, std::min(static_cast(m_max_y), new_y)); diff --git a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp index fbcdcd4fe8..771b1402fc 100644 --- a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp @@ -72,8 +72,8 @@ QGroupBox* TASInputWindow::CreateStickInputs(QString name, QSpinBox*& x_value, Q u16 max_x, u16 max_y, Qt::Key x_shortcut_key, Qt::Key y_shortcut_key) { - const QKeySequence x_shortcut_key_sequence = QKeySequence(Qt::ALT + x_shortcut_key); - const QKeySequence y_shortcut_key_sequence = QKeySequence(Qt::ALT + y_shortcut_key); + const QKeySequence x_shortcut_key_sequence = QKeySequence(Qt::ALT | x_shortcut_key); + const QKeySequence y_shortcut_key_sequence = QKeySequence(Qt::ALT | y_shortcut_key); auto* box = new QGroupBox(QStringLiteral("%1 (%2/%3)") @@ -119,7 +119,7 @@ QBoxLayout* TASInputWindow::CreateSliderValuePairLayout(QString name, QSpinBox*& int default_, u16 max, Qt::Key shortcut_key, QWidget* shortcut_widget, bool invert) { - const QKeySequence shortcut_key_sequence = QKeySequence(Qt::ALT + shortcut_key); + const QKeySequence shortcut_key_sequence = QKeySequence(Qt::ALT | shortcut_key); auto* label = new QLabel(QStringLiteral("%1 (%2)").arg( name, shortcut_key_sequence.toString(QKeySequence::NativeText))); diff --git a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp index cad896bab0..1b379c739f 100644 --- a/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/WiiTASInputWindow.cpp @@ -40,8 +40,8 @@ using namespace WiimoteCommon; WiiTASInputWindow::WiiTASInputWindow(QWidget* parent, int num) : TASInputWindow(parent), m_num(num) { - const QKeySequence ir_x_shortcut_key_sequence = QKeySequence(Qt::ALT + Qt::Key_F); - const QKeySequence ir_y_shortcut_key_sequence = QKeySequence(Qt::ALT + Qt::Key_G); + const QKeySequence ir_x_shortcut_key_sequence = QKeySequence(Qt::ALT | Qt::Key_F); + const QKeySequence ir_y_shortcut_key_sequence = QKeySequence(Qt::ALT | Qt::Key_G); m_ir_box = new QGroupBox(QStringLiteral("%1 (%2/%3)") .arg(tr("IR"), diff --git a/Source/Core/DolphinQt/qt6.natvis b/Source/Core/DolphinQt/qt6.natvis new file mode 100644 index 0000000000..e3470e347a --- /dev/null +++ b/Source/Core/DolphinQt/qt6.natvis @@ -0,0 +1,406 @@ + + + + + + + {val} + + val + + + + + {_q_value} + + _q_value + + + + + + + empty + {_q_value} + + *value() + + + + + + {{ x = {xp}, y = {yp} }} + + xp + yp + + + + + {{ x = {x1}, y = {y1}, width = {x2 - x1 + 1}, height = {y2 - y1 + 1} }} + + x1 + y1 + x2 - x1 + 1 + y2 - y1 + 1 + + + + + {{ x = {xp}, y = {yp}, width = {w}, height = {h} }} + + xp + yp + w + h + + + + + + {{ width = {wd}, height = {ht} }} + + wd + ht + + + + + + {{ start point = {pt1}, end point = {pt2} }} + + + {pt1} + + pt1 + + + + {pt2} + + pt2 + + + + + + + + {{ size={d->size} }} + + d->ref.atomic._q_value + + d->size + (QPoint*)((reinterpret_cast<char*>(d)) + d->offset) + + + + + + {{ size={d->size} }} + + + d->size > 0 + && ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).xp + == (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).xp) + && ((((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[0]).yp + == (((QPointF*)((reinterpret_cast<char*>(d)) + d->offset)[d->size - 1]).yp) + + d->ref.atomic._q_value + + d->size + (QPointF*)((reinterpret_cast<char*>(d)) + d->offset) + + + + + + {{ x = {xp}, y = {yp} }} + + xp + yp + + + + + {{ x = {xp}, y = {yp}, z = {zp} }} + + xp + yp + zp + + + + + {{ x = {xp}, y = {yp}, z = {zp}, w = {wp} }} + + xp + yp + zp + wp + + + + + + {{ m11 = {_m11}, m12 = {_m12}, m21 = {_m21}, m22 = {_m22}, ... }} + + + _m11 + _m12 + _m21 + _m22 + _dx + _dy + + + + + + {{ m11 = {m[0][0]}, m12 = {m[1][0]}, m13 = {m[2][0]}, m14 = {m[3][0]}, ... }} + + + m[0][0] + m[1][0] + m[2][0] + m[3][0] + m[0][1] + m[1][1] + m[2][1] + m[3][1] + m[0][2] + m[1][2] + m[2][2] + m[3][2] + m[0][3] + m[1][3] + m[2][3] + m[3][3] + + + + + + {{ horizontal = {static_cast<Policy>(bits.horPolicy)}, vertical = {static_cast<Policy>(bits.verPolicy)}, type = {ControlType(1 << bits.ctype)} }} + + + + QSizePolicy::Policy::{static_cast<Policy>(bits.verPolicy)} + + + QSizePolicy::Policy::{static_cast<Policy>(bits.horPolicy)} + + + QSizePolicy::ControlType::{ControlType(1 << bits.ctype)} + + + + Qt::Vertical (2) + + + Qt::Horizontal (1) + + + static_cast<int>(bits.verStretch) + static_cast<int>(bits.horStretch) + bits.hfw == 1 + bits.wfh == 1 + + + + + {ucs,c} + ucs,c + + ucs > 0xff ? '\0' : char(ucs),c + ucs,c + + + + + "{(reinterpret_cast<unsigned short*>(d.ptr)),sub}" + (reinterpret_cast<unsigned short*>(d.ptr)),sub + + d.size + + d.size + d.ptr + + + + + + {m_string,[m_size]} u"" + {m_string->d.ptr+m_position,[m_size]} + "" + m_string,[m_position+m_size] + + m_position + m_size + + m_size + m_string->d.ptr+m_position + + + + + + {m_data,[m_size]} + m_data,[m_size] + + m_size + + m_size + m_data + + + + + + "{((reinterpret_cast<char*>(d.ptr))),sb}" + ((reinterpret_cast<char*>(d.ptr))),sb + + d.size + + d.size + d.ptr + + + + + + + + + + + + + + + + + + + + {scheme()}://{host()}{path()} + {path()} + + scheme() + username() + password() + host() + path() + query() + fragment() + + + + + {{ julian day = {jd} }} + + + + + + + + {{ millisecond = {mds} }} + {{ milliseconds = {mds} }} + + hour(), d + hour(), d + minute(), d + minute(), d + second(), d + second(), d + millisecond(), d + millisecond(), d + + + + + ({first}, {second}) + + first + second + + + + + + {{ size={d.size} }} + + + d.size + reinterpret_cast<$T1*>(d.ptr) + + + + + + {{ size={s} }} + + a + + s + ptr + + + + + + + {{ size={d.d->m._Mypair._Myval2._Myval2._Mysize} }} + + d.d->m + + + + + + {{ size = {d->size} }} + + d->ref.atomic._q_value + + + + diff --git a/Source/VSProps/QtCompile.props b/Source/VSProps/QtCompile.props index 119a8101ac..c159b823e2 100644 --- a/Source/VSProps/QtCompile.props +++ b/Source/VSProps/QtCompile.props @@ -1,9 +1,9 @@ - $(ExternalsDir)Qt\Qt5.15.0\msvc2019_64\ - $(ExternalsDir)Qt\Qt5.15.0\msvc2019_arm64\ - $(QTDIRDefault) + $(ExternalsDir)Qt\Qt6.3.0\ + $(ExternalsQtDir)$(Platform)\ + $(QtTargetDirDefault) $(QTDIR)\ false true @@ -13,6 +13,7 @@ $(QTDIR)plugins\ $(IntDir) d + $(ExternalsQtDir)x64\ $(QtDebugSuffix) QtPlugins @@ -25,16 +26,15 @@ $(QtIncludeDir)QtCore;%(AdditionalIncludeDirectories) $(QtIncludeDir)QtGui;%(AdditionalIncludeDirectories) $(QtIncludeDir)QtWidgets;%(AdditionalIncludeDirectories) - $(QtIncludeDir)QtANGLE;%(AdditionalIncludeDirectories) - false + As of Qt6.3, Qt needs user code deriving from certain Qt types to have RTTI (AS WELL AS MOC, UGH). + Do NOT enable in dolphin outside of Qt-dependant code. + --> + true $(QtLibDir);%(AdditionalLibraryDirectories) - Qt5Core$(QtLibSuffix).lib;Qt5Gui$(QtLibSuffix).lib;Qt5Widgets$(QtLibSuffix).lib;%(AdditionalDependencies) + Qt6Core$(QtLibSuffix).lib;Qt6Gui$(QtLibSuffix).lib;Qt6Widgets$(QtLibSuffix).lib;%(AdditionalDependencies) Windows + $(QtToolOutDir)moc_68\moc_%(Filename).cpp @@ -72,34 +78,32 @@ - - - - - - - - - - - + + + + + + + + $(BinaryOutputDir)qt.conf - + Inputs="@(QtDllsSrc);@(QtPluginsSrc)" + Outputs="@(QtDllsDst);@(QtPluginsDst)"> diff --git a/Source/VSProps/qtmoc.props b/Source/VSProps/qtmoc.props index 9203740ccb..18832a6e93 100644 --- a/Source/VSProps/qtmoc.props +++ b/Source/VSProps/qtmoc.props @@ -50,7 +50,7 @@ moc %(Identity) $(QTDIR) + >$(QtHostToolsDir) $(QtInstallDir)