summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaglcontext.mm21
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm25
-rw-r--r--src/plugins/platforms/cocoa/qnsview_drawing.mm3
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.cpp1
-rw-r--r--src/plugins/platforms/wasm/qwasmdrag.cpp66
-rw-r--r--src/plugins/platforms/wasm/qwasmdrag.h3
-rw-r--r--src/plugins/platforms/wasm/qwasmevent.h1
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.cpp6
-rw-r--r--src/plugins/platforms/wasm/qwasmwindow.h1
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow.cpp1
-rw-r--r--src/plugins/platforms/wayland/qwaylandwindow_p.h1
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp20
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp2
-rw-r--r--src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp2
-rw-r--r--src/plugins/sqldrivers/.cmake.conf2
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style.cpp61
-rw-r--r--src/plugins/styles/modernwindows/qwindows11style_p.h3
-rw-r--r--src/plugins/styles/modernwindows/qwindowsvistastyle.cpp5
-rw-r--r--src/plugins/tls/openssl/qtlsbackend_openssl.cpp9
21 files changed, 164 insertions, 78 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
index adad12a4242..be05249c1b8 100644
--- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm
+++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm
@@ -265,19 +265,26 @@ void QCocoaGLContext::updateSurfaceFormat()
return value;
};
- int colorSize = pixelFormatAttribute(NSOpenGLPFAColorSize);
- colorSize /= 4; // The attribute includes the alpha component
- m_format.setRedBufferSize(colorSize);
- m_format.setGreenBufferSize(colorSize);
- m_format.setBlueBufferSize(colorSize);
+ // Resolve color channel bits from GL, rather than NSOpenGLPFAColorSize,
+ // as the latter is not specific enough (combines all channels).
+ GLint redBits, greenBits, blueBits;
+ glGetIntegerv(GL_RED_BITS, &redBits);
+ glGetIntegerv(GL_GREEN_BITS, &greenBits);
+ glGetIntegerv(GL_BLUE_BITS, &blueBits);
+ m_format.setRedBufferSize(redBits);
+ m_format.setGreenBufferSize(greenBits);
+ m_format.setBlueBufferSize(blueBits);
// Surfaces on macOS always have an alpha channel, but unless the user requested
// one via setAlphaBufferSize(), which triggered setting NSOpenGLCPSurfaceOpacity
// to make the surface non-opaque, we don't want to report back the actual alpha
// size, as that will make the user believe the alpha channel can be used for
// something useful, when in reality it can't, due to the surface being opaque.
- if (m_format.alphaBufferSize() > 0)
- m_format.setAlphaBufferSize(pixelFormatAttribute(NSOpenGLPFAAlphaSize));
+ if (m_format.alphaBufferSize() > 0) {
+ GLint alphaBits;
+ glGetIntegerv(GL_ALPHA_BITS, &alphaBits);
+ m_format.setAlphaBufferSize(alphaBits);
+ }
m_format.setDepthBufferSize(pixelFormatAttribute(NSOpenGLPFADepthSize));
m_format.setStencilBufferSize(pixelFormatAttribute(NSOpenGLPFAStencilSize));
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 0905ba3e644..1b34490e358 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -330,6 +330,13 @@ QMargins QCocoaWindow::safeAreaMargins() const
// merge them.
auto screenRect = m_view.window.screen.frame;
auto screenInsets = m_view.window.screen.safeAreaInsets;
+ auto screenSafeArea = QCocoaScreen::mapFromNative(NSMakeRect(
+ NSMinX(screenRect) + screenInsets.left,
+ NSMinY(screenRect) + screenInsets.bottom, // Non-flipped
+ NSWidth(screenRect) - screenInsets.left - screenInsets.right,
+ NSHeight(screenRect) - screenInsets.top - screenInsets.bottom
+ ));
+
auto screenRelativeViewBounds = QCocoaScreen::mapFromNative(
[m_view.window convertRectToScreen:
[m_view convertRect:m_view.bounds toView:nil]]
@@ -339,20 +346,10 @@ QMargins QCocoaWindow::safeAreaMargins() const
// Note that we do not want represent the area outside of the
// screen as being outside of the safe area.
QMarginsF screenSafeAreaMargins = {
- screenInsets.left ?
- qMax(0.0f, screenInsets.left - screenRelativeViewBounds.left())
- : 0.0f,
- screenInsets.top ?
- qMax(0.0f, screenInsets.top - screenRelativeViewBounds.top())
- : 0.0f,
- screenInsets.right ?
- qMax(0.0f, screenInsets.right
- - (screenRect.size.width - screenRelativeViewBounds.right()))
- : 0.0f,
- screenInsets.bottom ?
- qMax(0.0f, screenInsets.bottom
- - (screenRect.size.height - screenRelativeViewBounds.bottom()))
- : 0.0f
+ qMin(screenSafeArea.left() - screenRelativeViewBounds.left(), screenInsets.left),
+ qMin(screenSafeArea.top() - screenRelativeViewBounds.top(), screenInsets.top),
+ qMin(screenRelativeViewBounds.right() - screenSafeArea.right(), screenInsets.right),
+ qMin(screenRelativeViewBounds.bottom() - screenSafeArea.bottom(), screenInsets.bottom)
};
return (screenSafeAreaMargins | viewSafeAreaMargins).toMargins();
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm
index 64c806a087b..b3c22ff051e 100644
--- a/src/plugins/platforms/cocoa/qnsview_drawing.mm
+++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm
@@ -183,6 +183,9 @@
{
qCDebug(lcQpaDrawing) << "Backing properties changed for" << self;
+ if (!m_platformWindow)
+ return;
+
[self propagateBackingProperties];
// Ideally we would plumb this situation through QPA in a way that lets
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
index 881a233e694..5b86c1e1725 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
@@ -254,6 +254,7 @@ QDirectFbKeyMap::QDirectFbKeyMap()
insert(DIKS_FAVORITES , Qt::Key_Favorites);
insert(DIKS_KEYBOARD , Qt::Key_Keyboard);
insert(DIKS_PHONE , Qt::Key_Phone);
+ insert(DIKS_CALL , Qt::Key_Call)
insert(DIKS_PROGRAM , Qt::Key_Guide);
insert(DIKS_TIME , Qt::Key_Time);
diff --git a/src/plugins/platforms/wasm/qwasmdrag.cpp b/src/plugins/platforms/wasm/qwasmdrag.cpp
index 730816b9a99..6447d1e399f 100644
--- a/src/plugins/platforms/wasm/qwasmdrag.cpp
+++ b/src/plugins/platforms/wasm/qwasmdrag.cpp
@@ -16,6 +16,9 @@
#include <QtCore/qtimer.h>
#include <QFile>
+#include <private/qshapedpixmapdndwindow_p.h>
+#include <private/qdnd_p.h>
+
#include <functional>
#include <string>
#include <utility>
@@ -91,16 +94,13 @@ Qt::DropAction QWasmDrag::drag(QDrag *drag)
return Qt::IgnoreAction;
Qt::DropAction dragResult = Qt::IgnoreAction;
- if (qstdweb::haveJspi()) {
- QEventLoop loop;
- m_dragState = std::make_unique<DragState>(drag, window, [&loop]() { loop.quit(); });
- loop.exec();
- dragResult = m_dragState->dropAction;
+ if (qstdweb::haveAsyncify()) {
+ m_dragState = std::make_unique<DragState>(drag, window, [this]() { QSimpleDrag::cancelDrag(); });
+ dragResult = QSimpleDrag::drag(drag);
m_dragState.reset();
- }
-
- if (dragResult == Qt::IgnoreAction)
+ } else {
dragResult = QBasicDrag::drag(drag);
+ }
return dragResult;
}
@@ -110,13 +110,16 @@ void QWasmDrag::onNativeDragStarted(DragEvent *event)
Q_ASSERT_X(event->type == EventType::DragStart, Q_FUNC_INFO,
"The event is not a DragStart event");
- event->webEvent.call<void>("preventDefault");
-
// It is possible for a drag start event to arrive from another window.
if (!m_dragState || m_dragState->window != event->targetWindow) {
event->cancelDragStart();
return;
}
+ setExecutedDropAction(event->dropAction);
+
+ // We have our own window
+ if (shapedPixmapWindow())
+ shapedPixmapWindow()->setVisible(false);
m_dragState->dragImage = std::make_unique<DragState::DragImage>(
m_dragState->drag->pixmap(), m_dragState->drag->mimeData(), event->targetWindow);
@@ -141,8 +144,10 @@ void QWasmDrag::onNativeDragOver(DragEvent *event)
event->mouseButton, event->modifiers);
event->acceptDragOver();
if (dragResponse.isAccepted()) {
+ setExecutedDropAction(dragResponse.acceptedAction());
event->dataTransfer.setDropAction(dragResponse.acceptedAction());
} else {
+ setExecutedDropAction(Qt::DropAction::IgnoreAction);
event->dataTransfer.setDropAction(Qt::DropAction::IgnoreAction);
}
}
@@ -170,19 +175,22 @@ void QWasmDrag::onNativeDrop(DragEvent *event)
// files, but the browser expects that accepted state is set before any
// async calls.
event->acceptDrop();
+ setExecutedDropAction(event->dropAction);
+ std::shared_ptr<DragState> dragState = m_dragState;
- const auto dropCallback = [&m_dragState = m_dragState, wasmWindow, targetWindowPos,
+ const auto dropCallback = [dragState, wasmWindow, targetWindowPos,
actions, mouseButton, modifiers](QMimeData *mimeData) {
-
- auto dropResponse = std::make_shared<QPlatformDropQtResponse>(true, Qt::DropAction::CopyAction);
- *dropResponse = QWindowSystemInterface::handleDrop(wasmWindow->window(), mimeData,
+ if (mimeData) {
+ auto dropResponse = std::make_shared<QPlatformDropQtResponse>(true, Qt::DropAction::CopyAction);
+ *dropResponse = QWindowSystemInterface::handleDrop(wasmWindow->window(), mimeData,
targetWindowPos, actions,
mouseButton, modifiers);
- if (dropResponse->isAccepted())
- m_dragState->dropAction = dropResponse->acceptedAction();
+ if (dragState && dropResponse->isAccepted())
+ dragState->dropAction = dropResponse->acceptedAction();
- delete mimeData;
+ delete mimeData;
+ }
};
event->dataTransfer.toMimeDataWithFile(dropCallback);
@@ -192,13 +200,35 @@ void QWasmDrag::onNativeDragFinished(DragEvent *event)
{
event->webEvent.call<void>("preventDefault");
m_dragState->dropAction = event->dropAction;
+ setExecutedDropAction(event->dropAction);
m_dragState->quitEventLoopClosure();
}
+void QWasmDrag::onNativeDragEnter(DragEvent *event)
+{
+ event->webEvent.call<void>("preventDefault");
+
+ // Already dragging
+ if (QDragManager::self() && QDragManager::self()->object())
+ return;
+
+ // Event coming from external browser, start a drag
+ if (m_dragState)
+ m_dragState->dropAction = event->dropAction;
+
+ setExecutedDropAction(event->dropAction);
+
+ QDrag *drag = new QDrag(this);
+ drag->setMimeData(new QMimeData());
+ drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction);
+}
+
void QWasmDrag::onNativeDragLeave(DragEvent *event)
{
event->webEvent.call<void>("preventDefault");
- m_dragState->dropAction = event->dropAction;
+ if (m_dragState)
+ m_dragState->dropAction = event->dropAction;
+ setExecutedDropAction(event->dropAction);
event->dataTransfer.setDropAction(Qt::DropAction::IgnoreAction);
}
diff --git a/src/plugins/platforms/wasm/qwasmdrag.h b/src/plugins/platforms/wasm/qwasmdrag.h
index e821470c913..5bb8ec66a3c 100644
--- a/src/plugins/platforms/wasm/qwasmdrag.h
+++ b/src/plugins/platforms/wasm/qwasmdrag.h
@@ -32,6 +32,7 @@ public:
void onNativeDrop(DragEvent *event);
void onNativeDragStarted(DragEvent *event);
void onNativeDragFinished(DragEvent *event);
+ void onNativeDragEnter(DragEvent *event);
void onNativeDragLeave(DragEvent *event);
// QPlatformDrag:
@@ -40,7 +41,7 @@ public:
private:
struct DragState;
- std::unique_ptr<DragState> m_dragState;
+ std::shared_ptr<DragState> m_dragState;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmevent.h b/src/plugins/platforms/wasm/qwasmevent.h
index ef1b6129e3c..07faee3fe4b 100644
--- a/src/plugins/platforms/wasm/qwasmevent.h
+++ b/src/plugins/platforms/wasm/qwasmevent.h
@@ -23,6 +23,7 @@ enum class EventType {
DragEnd,
DragOver,
DragStart,
+ DragEnter,
DragLeave,
Drop,
KeyDown,
diff --git a/src/plugins/platforms/wasm/qwasmwindow.cpp b/src/plugins/platforms/wasm/qwasmwindow.cpp
index 264471794bd..6e8bd46ca58 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.cpp
+++ b/src/plugins/platforms/wasm/qwasmwindow.cpp
@@ -203,6 +203,12 @@ void QWasmWindow::registerEventHandlers()
QWasmDrag::instance()->onNativeDragFinished(&dragEvent);
}
);
+ m_dragEnterCallback = QWasmEventHandler(m_window, "dragenter",
+ [this](emscripten::val event) {
+ DragEvent dragEvent(EventType::DragEnter, event, window());
+ QWasmDrag::instance()->onNativeDragEnter(&dragEvent);
+ }
+ );
m_dragLeaveCallback = QWasmEventHandler(m_window, "dragleave",
[this](emscripten::val event) {
DragEvent dragEvent(EventType::DragLeave, event, window());
diff --git a/src/plugins/platforms/wasm/qwasmwindow.h b/src/plugins/platforms/wasm/qwasmwindow.h
index 87f4d6644c7..ca5c9132ca0 100644
--- a/src/plugins/platforms/wasm/qwasmwindow.h
+++ b/src/plugins/platforms/wasm/qwasmwindow.h
@@ -195,6 +195,7 @@ private:
QWasmEventHandler m_dragStartCallback;
QWasmEventHandler m_dragEndCallback;
QWasmEventHandler m_dropCallback;
+ QWasmEventHandler m_dragEnterCallback;
QWasmEventHandler m_dragLeaveCallback;
QWasmEventHandler m_wheelEventCallback;
diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp
index f27943070d0..2be05625971 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow.cpp
+++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp
@@ -513,7 +513,6 @@ void QWaylandWindow::setGeometry(const QRect &r)
mWindowDecoration->update();
QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(window(), geometry());
- mSentInitialResize = true;
}
// Wayland has no concept of areas being exposed or not, only the entire window, when our geometry changes, we need to flag the new area as exposed
diff --git a/src/plugins/platforms/wayland/qwaylandwindow_p.h b/src/plugins/platforms/wayland/qwaylandwindow_p.h
index 9e1bd92af30..7dda16cc776 100644
--- a/src/plugins/platforms/wayland/qwaylandwindow_p.h
+++ b/src/plugins/platforms/wayland/qwaylandwindow_p.h
@@ -334,7 +334,6 @@ protected:
int mFrameCallbackTimeout = 100;
QVariantMap m_properties;
- bool mSentInitialResize = false;
QPoint mOffset;
std::optional<qreal> mScale = std::nullopt;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 0236669d6fb..23bbe409caa 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -450,6 +450,26 @@ QPixmap QWindowsScreen::grabWindow(WId window, int xIn, int yIn, int width, int
hwnd = GetDesktopWindow();
const QRect screenGeometry = geometry();
windowSize = screenGeometry.size();
+ // When dpi awareness is not set to PerMonitor, windows reports primary display or dummy
+ // DPI for all displays, so xIn and yIn and windowSize are calculated with a wrong DPI,
+ // so we need to recalculate them using the actual screen size we get from
+ // EnumDisplaySettings api.
+ const auto dpiAwareness = QWindowsContext::instance()->processDpiAwareness();
+ if (dpiAwareness != QtWindows::DpiAwareness::PerMonitor &&
+ dpiAwareness != QtWindows::DpiAwareness::PerMonitorVersion2) {
+ MONITORINFOEX info = {};
+ info.cbSize = sizeof(MONITORINFOEX);
+ if (GetMonitorInfo(handle(), &info)) {
+ DEVMODE dm = {};
+ dm.dmSize = sizeof(dm);
+ if (EnumDisplaySettings(info.szDevice, ENUM_CURRENT_SETTINGS, &dm)) {
+ qreal scale = static_cast<qreal>(dm.dmPelsWidth) / windowSize.width();
+ x = static_cast<int>(static_cast<qreal>(x) * scale);
+ y = static_cast<int>(static_cast<qreal>(y) * scale);
+ windowSize = QSize(dm.dmPelsWidth, dm.dmPelsHeight);
+ }
+ }
+ }
x += screenGeometry.x();
y += screenGeometry.y();
}
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index b77e985c965..2816982b1a8 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -1732,8 +1732,10 @@ void QWindowsWindow::destroyWindow()
m_surface = nullptr;
}
#endif
+ DestroyWindow(m_data.hwndTitlebar);
DestroyWindow(m_data.hwnd);
context->removeWindow(m_data.hwnd);
+ m_data.hwndTitlebar = nullptr;
m_data.hwnd = nullptr;
}
}
diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
index db3fb160593..e2f181aa628 100644
--- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
+++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp
@@ -82,9 +82,12 @@ void QWindowsUiaMainProvider::notifyStateChange(QAccessibleStateChangeEvent *eve
{
if (QAccessibleInterface *accessible = event->accessibleInterface()) {
if (event->changedStates().checked || event->changedStates().checkStateMixed) {
- // Notifies states changes in checkboxes and switches.
+ // Notifies states changes in checkboxes, switches, and checkable item view items.
if (accessible->role() == QAccessible::CheckBox
- || accessible->role() == QAccessible::Switch) {
+ || accessible->role() == QAccessible::Switch
+ || accessible->role() == QAccessible::Cell
+ || accessible->role() == QAccessible::ListItem
+ || accessible->role() == QAccessible::TreeItem) {
if (auto provider = providerForAccessible(accessible)) {
long toggleState = ToggleState_Off;
if (accessible->state().checked)
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index b4c12ed1a0c..d8e41a753ef 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -856,7 +856,7 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event)
if (event->data.data32[0] && event->data.data32[0] != current_target)
return;
- const bool dropPossible = event->data.data32[1];
+ const bool dropPossible = event->data.data32[1] & 1;
setCanDrop(dropPossible);
if (dropPossible) {
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 2c56603fef0..7d5f0155960 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -2573,7 +2573,7 @@ void QXcbWindow::setOpacity(qreal level)
if (!m_window)
return;
- quint32 value = qRound64(qBound(qreal(0), level, qreal(1)) * 0xffffffff);
+ quint32 value = qRound64(qBound(qreal(0), level, qreal(1)) * qreal(0xffffffff));
xcb_change_property(xcb_connection(),
XCB_PROP_MODE_REPLACE,
diff --git a/src/plugins/sqldrivers/.cmake.conf b/src/plugins/sqldrivers/.cmake.conf
index be788d10f8e..846c4f3b923 100644
--- a/src/plugins/sqldrivers/.cmake.conf
+++ b/src/plugins/sqldrivers/.cmake.conf
@@ -1 +1 @@
-set(QT_REPO_MODULE_VERSION "6.11.0")
+set(QT_REPO_MODULE_VERSION "6.12.0")
diff --git a/src/plugins/styles/modernwindows/qwindows11style.cpp b/src/plugins/styles/modernwindows/qwindows11style.cpp
index 6fd857828d3..e9b90d787bc 100644
--- a/src/plugins/styles/modernwindows/qwindows11style.cpp
+++ b/src/plugins/styles/modernwindows/qwindows11style.cpp
@@ -596,7 +596,7 @@ void QWindows11Style::drawComplexControl(ComplexControl control, const QStyleOpt
if (sub & SC_ComboBoxArrow) {
QRectF rect = proxy()->subControlRect(CC_ComboBox, option, SC_ComboBoxArrow, widget);
painter->setFont(d->assetFont);
- painter->setPen(controlTextColor(option));
+ painter->setPen(controlTextColor(option, true));
painter->drawText(rect, Qt::AlignCenter, fluentIcon(Icon::ChevronDownMed));
}
if (state & State_KeyboardFocusChange && hasFocus) {
@@ -887,7 +887,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
if (isOn) {
painter->setFont(d->assetFont);
- painter->setPen(controlTextColor(option, QPalette::Window));
+ painter->setPen(controlTextColor(option));
qreal clipWidth = 1.0;
const QString str = fluentIcon(Icon::AcceptMedium);
QFontMetrics fm(d->assetFont);
@@ -907,19 +907,24 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
QFont f(d->assetFont);
f.setPointSize(6);
painter->setFont(f);
- painter->setPen(controlTextColor(option, QPalette::Window));
+ painter->setPen(controlTextColor(option));
painter->drawText(rect, Qt::AlignCenter, fluentIcon(Icon::Dash12));
}
}
break;
case PE_IndicatorBranch: {
if (option->state & State_Children) {
+ const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(option);
const bool isReverse = option->direction == Qt::RightToLeft;
const bool isOpen = option->state & QStyle::State_Open;
+ const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
QFont f(d->assetFont);
- f.setPointSize(6);
+ f.setPointSize(8);
painter->setFont(f);
- painter->setPen(option->palette.color(isOpen ? QPalette::Active : QPalette::Disabled,
+ if (view && view->alternatingRowColors() && vopt && vopt->state & State_Selected)
+ painter->setPen(winUI3Color(textOnAccentPrimary));
+ else
+ painter->setPen(option->palette.color(isOpen ? QPalette::Active : QPalette::Disabled,
QPalette::WindowText));
const auto ico = isOpen ? Icon::ChevronDownMed
: (isReverse ? Icon::ChevronLeftMed
@@ -1071,14 +1076,16 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
if (option->state & State_Selected && !highContrastTheme) {
// keep in sync with CE_ItemViewItem QListView indicator painting
- const auto col = option->palette.accent().color();
- painter->setBrush(col);
- painter->setPen(col);
- const auto xPos = isRtl ? rect.right() - 4.5f : rect.left() + 3.5f;
- const auto yOfs = rect.height() / 4.;
- QRectF r(QPointF(xPos, rect.y() + yOfs),
- QPointF(xPos + 1, rect.y() + rect.height() - yOfs));
- painter->drawRoundedRect(r, 1, 1);
+ if (!qobject_cast<const QTableView *>(widget)) {
+ const auto col = option->palette.accent().color();
+ painter->setBrush(col);
+ painter->setPen(col);
+ const auto xPos = isRtl ? rect.right() - 4.5f : rect.left() + 3.5f;
+ const auto yOfs = rect.height() / 4.;
+ QRectF r(QPointF(xPos, rect.y() + yOfs),
+ QPointF(xPos + 1, rect.y() + rect.height() - yOfs));
+ painter->drawRoundedRect(r, 1, 1);
+ }
}
const bool isTreeDecoration = vopt->features.testFlag(
@@ -1099,7 +1106,7 @@ void QWindows11Style::drawPrimitive(PrimitiveElement element, const QStyleOption
}
const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
- painter->setBrush(view->alternatingRowColors() ? vopt->palette.highlight() : WINUI3Colors[colorSchemeIndex][subtleHighlightColor]);
+ painter->setBrush(view->alternatingRowColors() && state & State_Selected ? calculateAccentColor(option) : WINUI3Colors[colorSchemeIndex][subtleHighlightColor]);
painter->setPen(Qt::NoPen);
if (isFirst) {
QPainterStateGuard psg(painter);
@@ -1207,7 +1214,7 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
case QStyle::CE_ComboBoxLabel:
#if QT_CONFIG(combobox)
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- painter->setPen(controlTextColor(option));
+ painter->setPen(controlTextColor(option, true));
QStyleOptionComboBox newOption = *cb;
newOption.rect.adjust(4,0,-4,0);
QCommonStyle::drawControl(element, &newOption, painter, widget);
@@ -1753,13 +1760,13 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
}
}
const bool highlightCurrent = vopt->state.testAnyFlags(State_Selected | State_MouseOver);
+ const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
if (highlightCurrent) {
if (highContrastTheme) {
painter->setBrush(vopt->palette.highlight());
} else {
- const QAbstractItemView *view = qobject_cast<const QAbstractItemView *>(widget);
- painter->setBrush(view && view->alternatingRowColors()
- ? vopt->palette.highlight()
+ painter->setBrush(view && view->alternatingRowColors() && vopt->state & State_Selected
+ ? calculateAccentColor(option)
: winUI3Color(subtleHighlightColor));
}
} else {
@@ -1815,8 +1822,13 @@ void QWindows11Style::drawControl(ControlElement element, const QStyleOption *op
vopt->icon.paint(painter, iconRect, vopt->decorationAlignment, mode, state);
}
- painter->setPen(highlightCurrent && highContrastTheme ? vopt->palette.base().color()
- : vopt->palette.text().color());
+ if (highlightCurrent && highContrastTheme) {
+ painter->setPen(vopt->palette.base().color());
+ } else if ((view && view->alternatingRowColors() && highlightCurrent && vopt->state & State_Selected)) {
+ painter->setPen(winUI3Color(textOnAccentPrimary));
+ } else {
+ painter->setPen(vopt->palette.text().color());
+ }
d->viewItemDrawText(painter, vopt, textRect);
// paint a vertical marker for QListView
@@ -2725,7 +2737,7 @@ QBrush QWindows11Style::inputFillBrush(const QStyleOption *option, const QWidget
return winUI3Color(fillControlDefault);
}
-QColor QWindows11Style::controlTextColor(const QStyleOption *option, QPalette::ColorRole role) const
+QColor QWindows11Style::controlTextColor(const QStyleOption *option, bool ignoreIsChecked) const
{
using namespace StyleOptionHelper;
static constexpr WINUI3Color colorEnums[2][4] = {
@@ -2738,12 +2750,9 @@ QColor QWindows11Style::controlTextColor(const QStyleOption *option, QPalette::C
if (option->palette.isBrushSet(QPalette::Current, QPalette::ButtonText))
return option->palette.buttonText().color();
- const int colorIndex = isChecked(option) ? 1 : 0;
+ const int colorIndex = !ignoreIsChecked && isChecked(option) ? 1 : 0;
const auto state = calcControlState(option);
- const auto alpha = winUI3Color(colorEnums[colorIndex][int(state)]);
- QColor col = option->palette.color(role);
- col.setAlpha(alpha.alpha());
- return col;
+ return winUI3Color(colorEnums[colorIndex][int(state)]);
}
void QWindows11Style::drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable) const
diff --git a/src/plugins/styles/modernwindows/qwindows11style_p.h b/src/plugins/styles/modernwindows/qwindows11style_p.h
index 96c2c4136e0..9d0cdda3e33 100644
--- a/src/plugins/styles/modernwindows/qwindows11style_p.h
+++ b/src/plugins/styles/modernwindows/qwindows11style_p.h
@@ -104,8 +104,7 @@ private:
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;
+ QColor controlTextColor(const QStyleOption *option, bool ignoreIsChecked = false) const;
void drawLineEditFrame(QPainter *p, const QRectF &rect, const QStyleOption *o, bool isEditable = true) const;
inline QColor winUI3Color(enum WINUI3Color col) const;
diff --git a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp
index 64ffba2d6f8..36b5d0f0143 100644
--- a/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp
+++ b/src/plugins/styles/modernwindows/qwindowsvistastyle.cpp
@@ -16,6 +16,9 @@
#include <private/qapplication_p.h>
#include <private/qsystemlibrary_p.h>
#include <private/qwindowsthemecache_p.h>
+#if QT_CONFIG(tooltip)
+#include "private/qtooltip_p.h"
+#endif
#include "qdrawutil.h" // for now
#include <qbackingstore.h>
@@ -4676,7 +4679,7 @@ void QWindowsVistaStyle::polish(QWidget *widget)
widget->setPalette(pal);
} else
#endif // QT_CONFIG(commandlinkbutton)
- if (widget->inherits("QTipLabel")) {
+ if (qobject_cast<const QTipLabel *>(widget)) {
//note that since tooltips are not reused
//we do not have to care about unpolishing
widget->setContentsMargins(3, 0, 4, 0);
diff --git a/src/plugins/tls/openssl/qtlsbackend_openssl.cpp b/src/plugins/tls/openssl/qtlsbackend_openssl.cpp
index deb257be01c..d3b7d669ec7 100644
--- a/src/plugins/tls/openssl/qtlsbackend_openssl.cpp
+++ b/src/plugins/tls/openssl/qtlsbackend_openssl.cpp
@@ -407,8 +407,13 @@ QList<QSslCertificate> systemCaCertificates()
for (const QByteArray &directory : directories) {
for (const auto &dirEntry : QDirListing(QFile::decodeName(directory), flags)) {
// use canonical path here to not load the same certificate twice if symlinked
- if (hasMatchingExtension(dirEntry.fileName()))
- certFiles.insert(dirEntry.canonicalFilePath());
+ if (hasMatchingExtension(dirEntry.fileName())) {
+ QString canonicalPath = dirEntry.canonicalFilePath();
+ // skip broken symlinks to not end up adding "" to the list which will then
+ // just be rejected by `QSslCertificate::fromFile`
+ if (!canonicalPath.isEmpty())
+ certFiles.insert(canonicalPath);
+ }
}
}
for (const QString& file : std::as_const(certFiles))