mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Add support for building against Qt 6
This commit is contained in:
@@ -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"]
|
||||
|
||||
|
||||
+8
-8
@@ -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",
|
||||
|
||||
Vendored
+1
-1
Submodule Externals/Qt updated: 5ab31b5fdf...9498dbe942
@@ -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)
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -13,14 +13,11 @@
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VSPropsDir)Base.props" />
|
||||
<Import Project="$(VSPropsDir)PCHUse.props" />
|
||||
<Import Project="$(VSPropsDir)QtCompile.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<!-- 5054 operator '+': deprecated between enumerations of different types (types defined in Qt headers) -->
|
||||
<DisableSpecificWarnings>5054;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)Config\Graphics;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)Config;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)Config\ControllerInterface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
@@ -33,6 +30,8 @@
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)Settings;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)TAS;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)VideoInterface;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<!--Ignore warnings in locally-instantiated fmt templates-->
|
||||
<ExternalTemplatesDiagnostics>false</ExternalTemplatesDiagnostics>
|
||||
</ClCompile>
|
||||
<Manifest>
|
||||
<AdditionalManifestFiles>DolphinQt.manifest;%(AdditionalManifestFiles)</AdditionalManifestFiles>
|
||||
@@ -379,6 +378,9 @@
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="DolphinQt.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="qt6.natvis" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(CoreDir)DolphinLib.vcxproj">
|
||||
<Project>{D79392F7-06D6-4B4B-A39F-4D587C215D3A}</Project>
|
||||
@@ -389,6 +391,16 @@
|
||||
<ProjectReference Include="$(DolphinRootDir)Languages\Languages.vcxproj">
|
||||
<Project>{0e033be3-2e08-428e-9ae9-bc673efa12b5}</Project>
|
||||
</ProjectReference>
|
||||
<!--
|
||||
This project doesn't use PCH during compile (because RTTI setting differs),
|
||||
but we still must link it for the dependants (DolphinLib)
|
||||
-->
|
||||
<ProjectReference Include="$(SourceDir)PCH\pch.vcxproj">
|
||||
<Project>{76563A7F-1011-4EAD-B667-7BB18D09568E}</Project>
|
||||
<Private>false</Private>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>true</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(ExternalsDir)ExternalsReferenceAll.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -132,8 +132,15 @@ int main(int argc, char* argv[])
|
||||
const optparse::Values& options = CommandLineParse::ParseArguments(parser.get(), argc, argv);
|
||||
const std::vector<std::string> 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).
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 <typename... Args>
|
||||
ParallelProgressDialog(Args&&... args) : m_dialog{std::forward<Args>(args)...}
|
||||
|
||||
@@ -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<const QMouseEvent*>(event)->x() * scale;
|
||||
ImGui::GetIO().MousePos.y = static_cast<const QMouseEvent*>(event)->y() * scale;
|
||||
ImGui::GetIO().MousePos.x = static_cast<const QMouseEvent*>(event)->pos().x() * scale;
|
||||
ImGui::GetIO().MousePos.y = static_cast<const QMouseEvent*>(event)->pos().y() * scale;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -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<int>(ir_max_x), new_x));
|
||||
m_y = std::max(0, std::min(static_cast<int>(ir_max_y), new_y));
|
||||
|
||||
@@ -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<int>(m_max_x), new_x));
|
||||
m_y = std::max(0, std::min(static_cast<int>(m_max_y), new_y));
|
||||
|
||||
@@ -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)));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user