diff options
| -rw-r--r-- | cmake/QtTestHelpers.cmake | 25 | ||||
| -rw-r--r-- | src/corelib/Qt6AndroidMacros.cmake | 21 | ||||
| -rw-r--r-- | src/corelib/doc/src/cmake/qt_add_android_dynamic_feature_java_source_dirs.qdoc | 30 | ||||
| -rw-r--r-- | src/corelib/itemmodels/qrangemodel_impl.h | 41 | ||||
| -rw-r--r-- | src/corelib/kernel/qobject.cpp | 35 | ||||
| -rw-r--r-- | src/dbus/qt_attribution.json | 8 | ||||
| -rw-r--r-- | src/gui/accessible/linux/qspimatchrulematcher.cpp | 9 | ||||
| -rw-r--r-- | src/gui/painting/qcolorspace.cpp | 2 | ||||
| -rw-r--r-- | src/plugins/platforms/windows/qwindowswindowclassdescription.cpp | 10 | ||||
| -rw-r--r-- | src/plugins/platforms/windows/qwindowswindowclassdescription.h | 3 | ||||
| -rw-r--r-- | src/plugins/platforms/windows/qwindowswindowclassregistry.cpp | 13 | ||||
| -rw-r--r-- | src/plugins/styles/modernwindows/qwindows11style.cpp | 38 | ||||
| -rw-r--r-- | src/plugins/styles/modernwindows/qwindows11style_p.h | 2 | ||||
| -rw-r--r-- | tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp | 2 |
14 files changed, 174 insertions, 65 deletions
diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index 52183d09203..06228ac41de 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -821,13 +821,22 @@ function(qt_internal_add_test name) qt_internal_collect_command_environment(test_env_path test_env_plugin_path) + set(add_test_args "") + if(test_working_dir) + list(APPEND add_test_args WORKING_DIRECTORY "${test_working_dir}") + endif() + if(arg_NO_WRAPPER OR QT_NO_TEST_WRAPPERS) if(QT_BUILD_TESTS_BATCHED) message(FATAL_ERROR "Wrapperless tests are unspupported with test batching") endif() - add_test(NAME "${testname}" COMMAND ${test_executable} ${extra_test_args} - WORKING_DIRECTORY "${test_working_dir}") + + + add_test(NAME "${testname}" + COMMAND ${test_executable} ${extra_test_args} + ${add_test_args} + ) set_property(TEST "${testname}" APPEND PROPERTY ENVIRONMENT "PATH=${test_env_path}" "QT_TEST_RUNNING_IN_CTEST=1" @@ -838,7 +847,7 @@ function(qt_internal_add_test name) qt_internal_create_test_script(NAME "${testname}" COMMAND "${test_executable}" ARGS "${extra_test_args}" - WORKING_DIRECTORY "${test_working_dir}" + ${add_test_args} OUTPUT_FILE "${test_wrapper_file}" ENVIRONMENT "QT_TEST_RUNNING_IN_CTEST" 1 "PATH" "${test_env_path}" @@ -1089,8 +1098,14 @@ for this function. Will be ignored") if(is_in_batch) _qt_internal_test_batch_target_name(executable_name) endif() + + set(add_test_working_dir "") + if(arg_WORKING_DIRECTORY) + list(APPEND add_test_working_dir WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}") + endif() + add_test(NAME "${arg_NAME}" COMMAND "${CMAKE_COMMAND}" "-P" "${arg_OUTPUT_FILE}" - WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}") + ${add_test_working_dir}) # If crosscompiling is enabled, we should avoid run cmake in emulator environment. # Prepend emulator to test command in generated cmake script instead. Keep in mind that @@ -1111,7 +1126,7 @@ for this function. Will be ignored") "\${env_test_args}" ${command_args} OUTPUT_FILE "${arg_OUTPUT_FILE}" - WORKING_DIRECTORY "${arg_WORKING_DIRECTORY}" + ${add_test_working_dir} ENVIRONMENT ${arg_ENVIRONMENT} PRE_RUN "separate_arguments(env_test_args NATIVE_COMMAND \ \"\$ENV{TESTARGS}\")" diff --git a/src/corelib/Qt6AndroidMacros.cmake b/src/corelib/Qt6AndroidMacros.cmake index 6a83e947146..be362ba1925 100644 --- a/src/corelib/Qt6AndroidMacros.cmake +++ b/src/corelib/Qt6AndroidMacros.cmake @@ -106,6 +106,27 @@ function(qt6_add_android_dynamic_features target) endif() endfunction() + +function(qt_add_android_dynamic_feature_java_source_dirs) + qt6_add_android_dynamic_feature_java_source_dirs(${ARGV}) +endfunction() + +# Add java source directories for dynamic feature. Intermediate solution until java library +# support exists. +function(qt6_add_android_dynamic_feature_java_source_dirs target) + + set(opt_args "") + set(single_args "") + set(multi_args + SOURCE_DIRS + ) + cmake_parse_arguments(PARSE_ARGV 1 arg "${opt_args}" "${single_args}" "${multi_args}") + if(arg_SOURCE_DIRS) + set_property(TARGET ${target} APPEND PROPERTY + _qt_android_gradle_java_source_dirs ${arg_SOURCE_DIRS}) + endif() +endfunction() + # Generate the deployment settings json file for a cmake target. function(qt6_android_generate_deployment_settings target) # Information extracted from mkspecs/features/android/android_deployment_settings.prf diff --git a/src/corelib/doc/src/cmake/qt_add_android_dynamic_feature_java_source_dirs.qdoc b/src/corelib/doc/src/cmake/qt_add_android_dynamic_feature_java_source_dirs.qdoc new file mode 100644 index 00000000000..cf670110cab --- /dev/null +++ b/src/corelib/doc/src/cmake/qt_add_android_dynamic_feature_java_source_dirs.qdoc @@ -0,0 +1,30 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only + +/*! +\page qt_add_android_dynamic_feature_java_source_dirs.html +\ingroup cmake-commands-qtcore + +\title qt_add_android_dynamic_feature_java_source_dirs +\keyword qt6_add_android_dynamic_feature_java_source_dirs + +\summary {Adds Java source directories to a dynamic feature build.} + +\include cmake-find-package-core.qdocinc + +\cmakecommandsince 6.11 + +\section1 Synopsis + +\badcode +qt_add_android_dynamic_feature_java_source_dirs(target [SOURCE_DIRS <directory1> <directory2> ...]) +\endcode + +\versionlessCMakeCommandsNote qt6_add_android_dynamic_feature_java_source_dirs() + +\section1 Description + +The command adds extra Java/Kotlin source directories to the \c {target} +executable when building the executable app with dynamic feature functionality. +To be used in conjunction with qt6_add_android_dynamic_features(). +*/ diff --git a/src/corelib/itemmodels/qrangemodel_impl.h b/src/corelib/itemmodels/qrangemodel_impl.h index 70552cbfe05..88bd6cf444e 100644 --- a/src/corelib/itemmodels/qrangemodel_impl.h +++ b/src/corelib/itemmodels/qrangemodel_impl.h @@ -28,7 +28,7 @@ #include <functional> #include <iterator> #include <type_traits> -#include <QtCore/q20type_traits.h> +#include <QtCore/qxptype_traits.h> #include <tuple> #include <QtCore/q23utility.h> @@ -562,35 +562,30 @@ namespace QRangeModelDetails } }; - template <typename P, typename R, typename = void> - struct protocol_parentRow : std::false_type {}; template <typename P, typename R> - struct protocol_parentRow<P, R, - std::void_t<decltype(std::declval<P&>().parentRow(std::declval<wrapped_t<R>&>()))>> - : std::true_type {}; + using protocol_parentRow_test = decltype(std::declval<P&>() + .parentRow(std::declval<QRangeModelDetails::wrapped_t<R>&>())); + template <typename P, typename R> + using protocol_parentRow = qxp::is_detected<protocol_parentRow_test, P, R>; - template <typename P, typename R, typename = void> - struct protocol_childRows : std::false_type {}; template <typename P, typename R> - struct protocol_childRows<P, R, - std::void_t<decltype(std::declval<P&>().childRows(std::declval<wrapped_t<R>&>()))>> - : std::true_type {}; + using protocol_childRows_test = decltype(std::declval<P&>() + .childRows(std::declval<QRangeModelDetails::wrapped_t<R>&>())); + template <typename P, typename R> + using protocol_childRows = qxp::is_detected<protocol_childRows_test, P, R>; - template <typename P, typename R, typename = void> - struct protocol_setParentRow : std::false_type {}; template <typename P, typename R> - struct protocol_setParentRow<P, R, - std::void_t<decltype(std::declval<P&>().setParentRow(std::declval<wrapped_t<R>&>(), - std::declval<wrapped_t<R>*>()))>> - : std::true_type {}; + using protocol_setParentRow_test = decltype(std::declval<P&>() + .setParentRow(std::declval<QRangeModelDetails::wrapped_t<R>&>(), + std::declval<QRangeModelDetails::wrapped_t<R>*>())); + template <typename P, typename R> + using protocol_setParentRow = qxp::is_detected<protocol_setParentRow_test, P, R>; - template <typename P, typename R, typename = void> - struct protocol_mutable_childRows : std::false_type {}; template <typename P, typename R> - struct protocol_mutable_childRows<P, R, - std::void_t<decltype(refTo(std::declval<P&>().childRows(std::declval<wrapped_t<R>&>())) - = {}) >> - : std::true_type {}; + using protocol_mutable_childRows_test = decltype(refTo(std::declval<P&>() + .childRows(std::declval<wrapped_t<R>&>())) = {}); + template <typename P, typename R> + using protocol_mutable_childRows = qxp::is_detected<protocol_mutable_childRows_test, P, R>; template <typename P, typename = void> struct protocol_newRow : std::false_type {}; diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 02c9f00f301..607dc23f56c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2696,23 +2696,38 @@ static void err_method_notfound(const QObject *object, case QSIGNAL_CODE: type = "signal"; break; } const char *loc = extract_location(method); + const char *err; if (strchr(method, ')') == nullptr) // common typing mistake - qCWarning(lcConnect, "QObject::%s: Parentheses expected, %s %s::%s%s%s", func, type, - object->metaObject()->className(), method + 1, loc ? " in " : "", loc ? loc : ""); + err = "Parentheses expected,"; else - qCWarning(lcConnect, "QObject::%s: No such %s %s::%s%s%s", func, type, - object->metaObject()->className(), method + 1, loc ? " in " : "", loc ? loc : ""); + err = "No such"; + qCWarning(lcConnect, "QObject::%s: %s %s %s::%s%s%s", func, err, type, + object->metaObject()->className(), method + 1, loc ? " in " : "", loc ? loc : ""); +} + +enum class ConnectionEnd : bool { Sender, Receiver }; +Q_DECL_COLD_FUNCTION +static void err_info_about_object(const char *func, const QObject *o, ConnectionEnd end) +{ + if (!o) + return; + const QString name = o->objectName(); + if (name.isEmpty()) + return; + const bool sender = end == ConnectionEnd::Sender; + qCWarning(lcConnect, "QObject::%s: (%s name:%*s'%ls')", + func, + sender ? "sender" : "receiver", + sender ? 3 : 1, // ← length of generated whitespace + "", + qUtf16Printable(name)); } Q_DECL_COLD_FUNCTION static void err_info_about_objects(const char *func, const QObject *sender, const QObject *receiver) { - QString a = sender ? sender->objectName() : QString(); - QString b = receiver ? receiver->objectName() : QString(); - if (!a.isEmpty()) - qCWarning(lcConnect, "QObject::%s: (sender name: '%s')", func, a.toLocal8Bit().data()); - if (!b.isEmpty()) - qCWarning(lcConnect, "QObject::%s: (receiver name: '%s')", func, b.toLocal8Bit().data()); + err_info_about_object(func, sender, ConnectionEnd::Sender); + err_info_about_object(func, receiver, ConnectionEnd::Receiver); } Q_DECL_COLD_FUNCTION diff --git a/src/dbus/qt_attribution.json b/src/dbus/qt_attribution.json index 067e3013bb1..faffd45685a 100644 --- a/src/dbus/qt_attribution.json +++ b/src/dbus/qt_attribution.json @@ -7,14 +7,14 @@ "Description": "D-Bus is a message bus system, a simple way for applications to talk to one another.", "Homepage": "https://www.freedesktop.org/wiki/Software/dbus/", "Version": "Minimal supported is 1.2, compatible up to ...", - "Version": "dbus-1.13.12", - "PURL": "pkg:github/d-bus/dbus@$<VERSION>", + "Version": "1.13.12", + "PURL": "pkg:github/d-bus/dbus@dbus-$<VERSION>", + "CPE": "cpe:2.3:a:freedesktop:dbus:$<VERSION>:*:*:*:*:*:*:*", "LicenseId": "AFL-2.1 OR GPL-2.0-or-later", "License": "Academic Free License v2.1, or GNU General Public License v2.0 or later", "LicenseFile": "LICENSE.LIBDBUS-1.txt", "Comment": "Fragments from various upstream files, see comments in ...", "Files": "dbus_minimal_p.h", "Copyright": ["Copyright (C) 2002, 2003 CodeFactory AB", - "Copyright (C) 2004, 2005 Red Hat, Inc."], - "Comment": "no relevant CPE found" + "Copyright (C) 2004, 2005 Red Hat, Inc."] } diff --git a/src/gui/accessible/linux/qspimatchrulematcher.cpp b/src/gui/accessible/linux/qspimatchrulematcher.cpp index d7047ad3e0e..48357f7ae63 100644 --- a/src/gui/accessible/linux/qspimatchrulematcher.cpp +++ b/src/gui/accessible/linux/qspimatchrulematcher.cpp @@ -23,11 +23,11 @@ QSpiMatchRuleMatcher::QSpiMatchRuleMatcher(const QSpiMatchRule &matchRule) m_interfaceMatchType(matchRule.interfaceMatchType) { // extract roles encoded in bitset stored in multiple 32 bit integers - std::unordered_set<AtspiRole> atSpiRoles; - for (int i = 0; i < matchRule.roles.size(); ++i) { + for (qsizetype i = 0; i < matchRule.roles.size(); ++i) { + const auto role = matchRule.roles.at(i); for (int j = 0; j < 32; j++) { - if (matchRule.roles.at(i) & (1 << j)) { - const int atspiRole = i * 32 + j; + if (role & (1 << j)) { + const auto atspiRole = i * 32 + j; if (atspiRole < ATSPI_ROLE_LAST_DEFINED) m_roles.insert(AtspiRole(atspiRole)); else @@ -38,6 +38,7 @@ QSpiMatchRuleMatcher::QSpiMatchRuleMatcher(const QSpiMatchRule &matchRule) } // use qualified interface names to match what accessibleInterfaces() returns + m_interfaces.reserve(matchRule.interfaces.size()); for (const QString &ifaceName : matchRule.interfaces) m_interfaces.push_back("org.a11y.atspi."_L1 + ifaceName); } diff --git a/src/gui/painting/qcolorspace.cpp b/src/gui/painting/qcolorspace.cpp index 9149971b999..680bdef3ac9 100644 --- a/src/gui/painting/qcolorspace.cpp +++ b/src/gui/painting/qcolorspace.cpp @@ -1205,9 +1205,9 @@ QByteArray QColorSpace::iccProfile() const */ QColorSpace QColorSpace::fromIccProfile(const QByteArray &iccProfile) { + QColorSpace colorSpace; // Must detach if input is fromRawData(); nullTerminated() is trick to do that and nothing else QByteArray ownedIccProfile = iccProfile.nullTerminated(); - QColorSpace colorSpace; if (QIcc::fromIccProfile(ownedIccProfile, &colorSpace)) return colorSpace; colorSpace.detach(); diff --git a/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp b/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp index 63e16260b62..e2e46a7b215 100644 --- a/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp +++ b/src/plugins/platforms/windows/qwindowswindowclassdescription.cpp @@ -75,4 +75,14 @@ QWindowsWindowClassDescription QWindowsWindowClassDescription::fromWindow(const return description; } +QDebug operator<<(QDebug dbg, const QWindowsWindowClassDescription &description) +{ + dbg << description.name + << " style=0x" << Qt::hex << description.style << Qt::dec + << " brush=" << description.brush + << " hasIcon=" << description.hasIcon; + + return dbg; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowswindowclassdescription.h b/src/plugins/platforms/windows/qwindowswindowclassdescription.h index 9423abf9d2d..3acca65b8a2 100644 --- a/src/plugins/platforms/windows/qwindowswindowclassdescription.h +++ b/src/plugins/platforms/windows/qwindowswindowclassdescription.h @@ -23,6 +23,9 @@ struct QWindowsWindowClassDescription HBRUSH brush{ nullptr }; bool hasIcon{ false }; bool shouldAddPrefix{ true }; + +private: + friend QDebug operator<<(QDebug dbg, const QWindowsWindowClassDescription &description); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp b/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp index c330720a09c..19694eab330 100644 --- a/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp +++ b/src/plugins/platforms/windows/qwindowswindowclassregistry.cpp @@ -110,13 +110,13 @@ QString QWindowsWindowClassRegistry::registerWindowClass(const QWindowsWindowCla wc.lpszClassName = reinterpret_cast<LPCWSTR>(className.utf16()); ATOM atom = RegisterClassEx(&wc); if (!atom) - qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.", - qPrintable(className)); + qCWarning(lcQpaWindowClass) << "Failed to register window class" << className + << "(" << qt_error_string(-1) << ")"; m_registeredWindowClassNames.insert(className); - qCDebug(lcQpaWindowClass).nospace() << __FUNCTION__ << ' ' << className - << " style=0x" << Qt::hex << description.style << Qt::dec - << " brush=" << description.brush << " icon=" << description.hasIcon << " atom=" << atom; + + qCDebug(lcQpaWindowClass).nospace() << __FUNCTION__ << ' ' << className << ' ' << description << " atom=" << atom; + return className; } @@ -136,7 +136,8 @@ void QWindowsWindowClassRegistry::unregisterWindowClasses() for (const QString &name : std::as_const(m_registeredWindowClassNames)) { if (!UnregisterClass(reinterpret_cast<LPCWSTR>(name.utf16()), appInstance) && QWindowsContext::verbose) - qErrnoWarning("UnregisterClass failed for '%s'", qPrintable(name)); + qCWarning(lcQpaWindowClass) << "Failed to unregister window class" << name + << "(" << qt_error_string(-1) << ")"; } m_registeredWindowClassNames.clear(); } diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp index ffba4f775c8..13682256370 100644 --- a/src/plugins/styles/modernwindows/qwindows11style.cpp +++ b/src/plugins/styles/modernwindows/qwindows11style.cpp @@ -69,6 +69,10 @@ inline bool isAutoRaise(const QStyleOption *option) { return option->state.testFlag(QStyle::State_AutoRaise); } +inline bool hasFocus(const QStyleOption *option) +{ + return option->state.testFlag(QStyle::State_HasFocus); +} enum class ControlState { Normal, Hover, Pressed, Disabled }; inline ControlState calcControlState(const QStyleOption *option) { @@ -125,7 +129,7 @@ static constexpr int percentToAlpha(double percent) return qRound(percent * 255. / 100.); } -static constexpr std::array<QColor, 33> WINUI3ColorsLight { +static constexpr std::array<QColor, 34> WINUI3ColorsLight { QColor(0x00,0x00,0x00,percentToAlpha(3.73)), // subtleHighlightColor (fillSubtleSecondary) QColor(0x00,0x00,0x00,percentToAlpha(2.41)), // subtlePressedColor (fillSubtleTertiary) QColor(0x00,0x00,0x00,0x0F), //frameColorLight @@ -144,6 +148,7 @@ static constexpr std::array<QColor, 33> WINUI3ColorsLight { QColor(0xF9,0xF9,0xF9,percentToAlpha(50)), // fillControlSecondary QColor(0xF9,0xF9,0xF9,percentToAlpha(30)), // fillControlTertiary QColor(0xF9,0xF9,0xF9,percentToAlpha(30)), // fillControlDisabled + QColor(0xFF,0xFF,0xFF,percentToAlpha(100)), // fillControlInputActive QColor(0x00,0x00,0x00,percentToAlpha(2.41)), // fillControlAltSecondary QColor(0x00,0x00,0x00,percentToAlpha(5.78)), // fillControlAltTertiary QColor(0x00,0x00,0x00,percentToAlpha(9.24)), // fillControlAltQuarternary @@ -161,7 +166,7 @@ static constexpr std::array<QColor, 33> WINUI3ColorsLight { QColor(0x00,0x00,0x00,percentToAlpha(8.03)), // dividerStrokeDefault }; -static constexpr std::array<QColor, 33> WINUI3ColorsDark { +static constexpr std::array<QColor, 34> WINUI3ColorsDark { QColor(0xFF,0xFF,0xFF,percentToAlpha(6.05)), // subtleHighlightColor (fillSubtleSecondary) QColor(0xFF,0xFF,0xFF,percentToAlpha(4.19)), // subtlePressedColor (fillSubtleTertiary) QColor(0xFF,0xFF,0xFF,0x12), //frameColorLight @@ -180,6 +185,7 @@ static constexpr std::array<QColor, 33> WINUI3ColorsDark { QColor(0xFF,0xFF,0xFF,percentToAlpha(8.37)), // fillControlSecondary QColor(0xFF,0xFF,0xFF,percentToAlpha(3.26)), // fillControlTertiary QColor(0xFF,0xFF,0xFF,percentToAlpha(4.19)), // fillControlDisabled + QColor(0x1E,0x1E,0x1E,percentToAlpha(70)), // fillControlInputActive QColor(0x00,0x00,0x00,percentToAlpha(10.0)), // fillControlAltDefault QColor(0xFF,0xFF,0xFF,percentToAlpha(4.19)), // fillControlAltSecondary QColor(0xFF,0xFF,0xFF,percentToAlpha(6.98)), // fillControlAltTertiafillCy @@ -197,7 +203,7 @@ static constexpr std::array<QColor, 33> WINUI3ColorsDark { QColor(0xFF,0xFF,0xFF,percentToAlpha(8.37)), // dividerStrokeDefault }; -static constexpr std::array<std::array<QColor,33>, 2> WINUI3Colors { +static constexpr std::array<std::array<QColor,34>, 2> WINUI3Colors { WINUI3ColorsLight, WINUI3ColorsDark }; @@ -990,16 +996,9 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption case PE_PanelLineEdit: if (const auto *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) { const auto frameRect = QRectF(option->rect).marginsRemoved(QMarginsF(1.5, 1.5, 1.5, 1.5)); - drawRoundedRect(painter, frameRect, Qt::NoPen, option->palette.brush(QPalette::Base)); - + drawRoundedRect(painter, frameRect, Qt::NoPen, inputFillBrush(option, widget)); if (panel->lineWidth > 0) proxy()->drawPrimitive(PE_FrameLineEdit, panel, painter, widget); - - const bool isMouseOver = state & State_MouseOver; - const bool hasFocus = state & State_HasFocus; - const bool isEnabled = state & State_Enabled; - if (isMouseOver && isEnabled && hasFocus && !highContrastTheme) - drawRoundedRect(painter, frameRect, Qt::NoPen, winUI3Color(subtleHighlightColor)); } break; case PE_FrameLineEdit: { @@ -2674,6 +2673,23 @@ QBrush QWindows11Style::controlFillBrush(const QStyleOption *option, ControlType return winUI3Color(colorEnums[int(controlType)][int(state)]); } +QBrush QWindows11Style::inputFillBrush(const QStyleOption *option, const QWidget *widget) const +{ + // slightly different states than in controlFillBrush + using namespace StyleOptionHelper; + const auto role = widget ? widget->backgroundRole() : QPalette::Window; + if (option->palette.isBrushSet(QPalette::Current, role)) + return option->palette.button(); + + if (isDisabled(option)) + return winUI3Color(fillControlDisabled); + if (hasFocus(option)) + return winUI3Color(fillControlInputActive); + if (isHover(option)) + return winUI3Color(fillControlSecondary); + return winUI3Color(fillControlDefault); +} + QColor QWindows11Style::controlTextColor(const QStyleOption *option, QPalette::ColorRole role) const { using namespace StyleOptionHelper; diff --git a/src/plugins/styles/modernwindows/qwindows11style_p.h b/src/plugins/styles/modernwindows/qwindows11style_p.h index a51a93ddd9b..96c2c4136e0 100644 --- a/src/plugins/styles/modernwindows/qwindows11style_p.h +++ b/src/plugins/styles/modernwindows/qwindows11style_p.h @@ -42,6 +42,7 @@ enum WINUI3Color { fillControlSecondary, // button hover color (alpha) fillControlTertiary, // button pressed color (alpha) fillControlDisabled, // button disabled color (alpha) + fillControlInputActive, // input active fillControlAltSecondary, // checkbox/RadioButton default color (alpha) fillControlAltTertiary, // checkbox/RadioButton hover color (alpha) fillControlAltQuarternary, // checkbox/RadioButton pressed color (alpha) @@ -101,6 +102,7 @@ private: ControlAlt }; QBrush controlFillBrush(const QStyleOption *option, ControlType controlType) const; + QBrush inputFillBrush(const QStyleOption *option, const QWidget *widget) const; // ControlType::ControlAlt can be mapped to QPalette directly QColor controlTextColor(const QStyleOption *option, QPalette::ColorRole role = QPalette::ButtonText) const; diff --git a/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp b/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp index a63dea4c679..93024bb4a6c 100644 --- a/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp +++ b/tests/auto/corelib/text/qlocaledata/tst_qlocaledata.cpp @@ -260,7 +260,7 @@ void tst_QLocaleData::numericData_data() << u"\u00D7\u06F1\u06F0^"_s << GS(1, 3, 3) << U'\u06F0' << false; // Grouping separator variants: - QTest::newRow("gsw-Latn-CH/exp") // Right single quote for grouping: + QTest::newRow("gsw-Latn-CH/exp") // Uses apostrophe for grouping (matching C++): << LOCALE_DATA_PTR(SwissGerman, LatinScript, Switzerland) << QLocaleData::DoubleScientificMode << u"."_s << u"'"_s << u"\u2212"_s << u"+"_s << u"E"_s |
