From d79dcac3b356c3d2a9d2097464fcc064c407f772 Mon Sep 17 00:00:00 2001 From: twi-devel Date: Thu, 22 Oct 2026 18:15:25 +0200 Subject: [PATCH] fix: CMake include path and QString literals - Add target_include_directories for test target to find MainWindow.h - Replace u""_s literals with QStringLiteral() for compiler compatibility - Fixes Jenkins build errors Entire-Checkpoint: 0e6491fe1b1c --- qt6-after/qt6-migrated-benchmark/CMakeLists.txt | 4 ++++ qt6-after/qt6-migrated-benchmark/MainWindow.cpp | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/qt6-after/qt6-migrated-benchmark/CMakeLists.txt b/qt6-after/qt6-migrated-benchmark/CMakeLists.txt index c66382a..2dd6c50 100644 --- a/qt6-after/qt6-migrated-benchmark/CMakeLists.txt +++ b/qt6-after/qt6-migrated-benchmark/CMakeLists.txt @@ -66,6 +66,10 @@ add_executable(Qt6MigratedBenchmarkTest MainWindow.cpp ) +target_include_directories(Qt6MigratedBenchmarkTest PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + target_link_libraries(Qt6MigratedBenchmarkTest PRIVATE Qt6::Core Qt6::Gui diff --git a/qt6-after/qt6-migrated-benchmark/MainWindow.cpp b/qt6-after/qt6-migrated-benchmark/MainWindow.cpp index 5f0a954..418288e 100644 --- a/qt6-after/qt6-migrated-benchmark/MainWindow.cpp +++ b/qt6-after/qt6-migrated-benchmark/MainWindow.cpp @@ -13,10 +13,10 @@ MainWindow::MainWindow(QWidget* parent) { ui->setupUi(this); - setWindowTitle(u"Qt6 Legacy Migration Benchmark"_s); + setWindowTitle(QStringLiteral("Qt6 Legacy Migration Benchmark")); - ui->label->setText(u"Bitte Text wie Test123 eingeben."_s); - ui->iconLabel->setPixmap(QPixmap(u":/icons/app.png"_s).scaled(48, 48)); + ui->label->setText(QStringLiteral("Bitte Text wie Test123 eingeben.")); + ui->iconLabel->setPixmap(QPixmap(QStringLiteral(":/icons/app.png")).scaled(48, 48)); connect(ui->validateButton, &QPushButton::clicked, this, &MainWindow::onValidateClicked); connect(ui->screenButton, &QPushButton::clicked, this, &MainWindow::onScreenInfoClicked); @@ -37,10 +37,10 @@ QString MainWindow::getScreenInfo() const const QScreen* screen = QApplication::primaryScreen(); if (!screen) { - return u"Screen: unavailable"_s; + return QStringLiteral("Screen: unavailable"); } const QRect geometry = screen->geometry(); - return u"Screen: %1x%2"_s.arg(geometry.width()).arg(geometry.height()); + return QStringLiteral("Screen: %1x%2").arg(geometry.width()).arg(geometry.height()); } void MainWindow::onValidateClicked() @@ -49,11 +49,11 @@ void MainWindow::onValidateClicked() if (validateInput(text)) { - ui->resultLabel->setText(u"Match"_s); + ui->resultLabel->setText(QStringLiteral("Match")); } else { - ui->resultLabel->setText(u"No match"_s); + ui->resultLabel->setText(QStringLiteral("No match")); } }