ui(QT): QT 6.7.3 Implementation

This commit is contained in:
vampiric_x 2025-01-12 04:26:22 +01:00
parent d3ed42af8f
commit 2d7f9d921b
10 changed files with 394 additions and 203 deletions

View file

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2018 yuzu Emulator Project & 2025 citron Homebrew Project
# SPDX-FileCopyrightText: 2025 Citron Homebrew Emulator Project & vampiric_x 2025
# SPDX-License-Identifier: GPL-2.0-or-later
set(CMAKE_AUTOMOC ON)
@ -368,11 +368,7 @@ if (APPLE)
elseif(WIN32)
# compile as a win32 gui application instead of a console application
if (QT_VERSION VERSION_GREATER_EQUAL 6)
target_link_libraries(citron PRIVATE Qt6::EntryPointPrivate)
else()
target_link_libraries(citron PRIVATE Qt5::WinMain)
endif()
target_link_libraries(citron PRIVATE Qt6::EntryPointPrivate)
if(MSVC)
target_link_libraries(citron PRIVATE version.lib)
set_target_properties(citron PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
@ -382,15 +378,15 @@ elseif(WIN32)
endif()
target_link_libraries(citron PRIVATE common core input_common frontend_common network video_core)
target_link_libraries(citron PRIVATE Boost::headers glad Qt${QT_MAJOR_VERSION}::Widgets)
target_link_libraries(citron PRIVATE Boost::headers glad Qt6::Widgets)
target_link_libraries(citron PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
target_link_libraries(citron PRIVATE Vulkan::Headers)
if (NOT WIN32)
target_include_directories(citron PRIVATE ${Qt${QT_MAJOR_VERSION}Gui_PRIVATE_INCLUDE_DIRS})
target_include_directories(citron PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
endif()
if (UNIX AND NOT APPLE)
target_link_libraries(citron PRIVATE Qt${QT_MAJOR_VERSION}::DBus)
target_link_libraries(citron PRIVATE Qt6::DBus)
endif()
target_compile_definitions(citron PRIVATE
@ -448,9 +444,9 @@ if (WIN32 AND QT_VERSION VERSION_GREATER_EQUAL 6)
add_custom_command(TARGET citron POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} "${CITRON_EXE_DIR}/citron.exe" --dir "${CITRON_EXE_DIR}" --libdir "${CITRON_EXE_DIR}" --plugindir "${CITRON_EXE_DIR}/plugins" --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler --no-translations --verbose 0)
endif()
if (CITRON_USE_BUNDLED_QT AND QT_VERSION VERSION_LESS 6)
include(CopyCitronQt5Deps)
copy_citron_Qt5_deps(citron)
if (CITRON_USE_BUNDLED_QT)
include(CopyCitronQt6Deps)
copy_citron_Qt6_deps(citron)
endif()
if (ENABLE_SDL2)

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2014 Citra Emulator Project & 2025 Citron Homebrew Project
// SPDX-FileCopyrightText: 2025 Citron Homebrew Emulator Project & vampiric_x 2025
// SPDX-License-Identifier: GPL-2.0-or-later
#include <algorithm>
@ -736,19 +736,19 @@ void GRenderWindow::wheelEvent(QWheelEvent* event) {
}
void GRenderWindow::TouchBeginEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
QList<QTouchEvent::TouchPoint> touch_points = event->points();
for (const auto& touch_point : touch_points) {
const auto [x, y] = ScaleTouch(touch_point.pos());
const auto [x, y] = ScaleTouch(touch_point.position());
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
input_subsystem->GetTouchScreen()->TouchPressed(touch_x, touch_y, touch_point.id());
}
}
void GRenderWindow::TouchUpdateEvent(const QTouchEvent* event) {
QList<QTouchEvent::TouchPoint> touch_points = event->touchPoints();
QList<QTouchEvent::TouchPoint> touch_points = event->points();
input_subsystem->GetTouchScreen()->ClearActiveFlag();
for (const auto& touch_point : touch_points) {
const auto [x, y] = ScaleTouch(touch_point.pos());
const auto [x, y] = ScaleTouch(touch_point.position());
const auto [touch_x, touch_y] = MapToTouchScreen(x, y);
input_subsystem->GetTouchScreen()->TouchMoved(touch_x, touch_y, touch_point.id());
}
@ -1137,4 +1137,4 @@ bool GRenderWindow::eventFilter(QObject* object, QEvent* event) {
emit MouseActivity();
}
return false;
}
}

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2020 Citra Emulator Project & 2025 Citron Homebrew Project
// SPDX-FileCopyrightText: 2025 Citron Homebrew Emulator Project & vampiric_x 2025
// SPDX-License-Identifier: GPL-2.0-or-later
#include <QInputDialog>
@ -505,7 +505,7 @@ void TouchScreenPreview::mouseMoveEvent(QMouseEvent* event) {
if (!coord_label) {
return;
}
const auto pos = MapToDeviceCoords(event->x(), event->y());
const auto pos = MapToDeviceCoords(event->position().x(), event->position().y());
if (pos) {
coord_label->setText(QStringLiteral("X: %1, Y: %2").arg(pos->x()).arg(pos->y()));
} else {
@ -523,7 +523,7 @@ void TouchScreenPreview::mousePressEvent(QMouseEvent* event) {
if (event->button() != Qt::MouseButton::LeftButton) {
return;
}
const auto pos = MapToDeviceCoords(event->x(), event->y());
const auto pos = MapToDeviceCoords(event->position().x(), event->position().y());
if (pos) {
emit DotAdded(*pos);
}
@ -539,7 +539,7 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
emit DotSelected(obj->property(PropId).toInt());
drag_state.dot = qobject_cast<QLabel*>(obj);
drag_state.start_pos = mouse_event->globalPos();
drag_state.start_pos = mouse_event->globalPosition().toPoint();
return true;
}
case QEvent::Type::MouseMove: {
@ -549,13 +549,13 @@ bool TouchScreenPreview::eventFilter(QObject* obj, QEvent* event) {
const auto mouse_event = static_cast<QMouseEvent*>(event);
if (!drag_state.active) {
drag_state.active =
(mouse_event->globalPos() - drag_state.start_pos).manhattanLength() >=
(mouse_event->globalPosition().toPoint() - drag_state.start_pos).manhattanLength() >=
QApplication::startDragDistance();
if (!drag_state.active) {
break;
}
}
auto current_pos = mapFromGlobal(mouse_event->globalPos());
auto current_pos = mapFromGlobal(mouse_event->globalPosition().toPoint());
current_pos.setX(std::clamp(current_pos.x(), contentsMargins().left(),
contentsMargins().left() + contentsRect().width() - 1));
current_pos.setY(std::clamp(current_pos.y(), contentsMargins().top(),
@ -614,4 +614,4 @@ void TouchScreenPreview::PositionDot(QLabel* const dot, const int device_x,
contentsMargins().top() - static_cast<float>(dot->height()) / 2 + 0.5f);
dot->move(x_coord, y_coord);
}
}

View file

@ -256,7 +256,7 @@ void ConfigureUi::InitializeLanguageComboBox() {
locale.truncate(locale.lastIndexOf(QLatin1Char{'.'}));
locale.remove(0, locale.lastIndexOf(QLatin1Char{'/'}) + 1);
const QString lang = QLocale::languageToString(QLocale(locale).language());
const QString country = QLocale::countryToString(QLocale(locale).country());
const QString country = QLocale::territoryToString(QLocale(locale).territory());
ui->language_combobox->addItem(QStringLiteral("%1 (%2)").arg(lang, country), locale);
}

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2015 Citra Emulator Project & 2025 Citron Homebrew Project
// SPDX-FileCopyrightText: 2025 Citron Homebrew Emulator Project & vampiric_x 2025
// SPDX-License-Identifier: GPL-2.0-or-later
#include <regex>
@ -235,7 +235,7 @@ void GameList::OnTextChanged(const QString& new_text) {
file_path.mid(file_path.lastIndexOf(QLatin1Char{'/'}) + 1) + QLatin1Char{' '} +
file_title;
if (ContainsAllWords(file_name, edit_filter_text) ||
(file_program_id.count() == 16 && file_program_id.contains(edit_filter_text))) {
(file_program_id.size() == 16 && file_program_id.contains(edit_filter_text))) {
tree_view->setRowHidden(j, folder_index, false);
++result_count;
} else {

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2014 Citra Emulator Project & 2025 Citron Homebrew Project
// SPDX-FileCopyrightText: 2025 Citron Homebrew Emulator Project & vampiric_x 2025
// SPDX-License-Identifier: GPL-2.0-or-later
#include <cinttypes>
@ -5239,9 +5239,6 @@ static void SetHighDPIAttributes() {
QApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
}
int main(int argc, char* argv[]) {