From b1709bdc723ee62d13cdb11d77e4fbe03a0c44bf Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 8 Apr 2019 15:51:04 +0200 Subject: Windows QPA: Fix Drag and Drop of images onto MS PowerPoint Use the PNG format only for transparent images. Fixes: QTBUG-64322 Change-Id: I5e02132ca446876e20fcf46f2ef8daa599e85e71 Reviewed-by: Andre de la Rocha --- src/plugins/platforms/windows/qwindowsmime.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 96e34fb44c..030d8d1e0f 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -1087,7 +1087,10 @@ bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMi const QImage image = qvariant_cast(mimeData->imageData()); if (image.isNull()) return false; - return cf == CF_DIBV5 || (cf == CF_DIB) || cf == int(CF_PNG); + // QTBUG-64322: Use PNG only for transparent images as otherwise MS PowerPoint + // cannot handle it. + return cf == CF_DIBV5 || cf == CF_DIB + || (cf == int(CF_PNG) && image.hasAlphaChannel()); } bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const -- cgit v1.2.3 From 53d62b8fcbb639bd625777c8f1c01764445fb1c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 9 Apr 2019 15:02:38 +0200 Subject: macOS: set layer.delegate when setting a layer Fixes flicker with Qt 5.12.2 on macOS 10.14.4. Change-Id: Ibb866d4339ecafae5fb573a653a2fb0f6238d704 Reviewed-by: Andy Shaw --- src/plugins/platforms/cocoa/qnsview_drawing.mm | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm index 490dbe8c4c..3690d6ebb4 100644 --- a/src/plugins/platforms/cocoa/qnsview_drawing.mm +++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm @@ -154,6 +154,7 @@ << "due to being" << ([self layerExplicitlyRequested] ? "explicitly requested" : [self shouldUseMetalLayer] ? "needed by surface type" : "enabled by macOS"); [super setLayer:layer]; + layer.delegate = self; } - (NSViewLayerContentsRedrawPolicy)layerContentsRedrawPolicy -- cgit v1.2.3 From 7b4f9dbf270b6e3369da5f5c0187876dfad69e70 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 11 Apr 2019 16:22:55 +0000 Subject: Revert "QMacStyle - workaround NSButtonCell (disclose button type)" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit a868942b11a586861e167aaafaa9c65fde23e88d. We know how to fix it properly. Change-Id: I9180aeca82f884333d53bab9c6d588ee3a23d3cb Reviewed-by: Tor Arne Vestbø --- src/plugins/styles/mac/qmacstyle_mac.mm | 71 +-------------------------------- 1 file changed, 2 insertions(+), 69 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 0745e917a2..847b1a6034 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -1156,66 +1156,6 @@ static QStyleHelper::WidgetSizePolicy qt_aqua_guess_size(const QWidget *widg, QS } #endif -static NSColor *qt_convertColorForContext(CGContextRef context, NSColor *color) -{ - Q_ASSERT(color); - Q_ASSERT(context); - - CGColorSpaceRef targetCGColorSpace = CGBitmapContextGetColorSpace(context); - NSColorSpace *targetNSColorSpace = [[NSColorSpace alloc] initWithCGColorSpace:targetCGColorSpace]; - NSColor *adjusted = [color colorUsingColorSpace:targetNSColorSpace]; - [targetNSColorSpace release]; - - return adjusted; -} - -static NSColor *qt_colorForContext(CGContextRef context, const CGFloat (&rgba)[4]) -{ - Q_ASSERT(context); - - auto colorSpace = CGBitmapContextGetColorSpace(context); - if (!colorSpace) - return nil; - - return qt_convertColorForContext(context, [NSColor colorWithSRGBRed:rgba[0] green:rgba[1] blue:rgba[2] alpha:rgba[3]]); -} - -static void qt_drawDisclosureButton(CGContextRef context, NSInteger state, bool selected, CGRect rect) -{ - Q_ASSERT(context); - - static const CGFloat gray[] = {0.55, 0.55, 0.55, 0.97}; - static const CGFloat white[] = {1.0, 1.0, 1.0, 0.9}; - - NSColor *fillColor = qt_colorForContext(context, selected ? white : gray); - [fillColor setFill]; - - if (state == NSOffState) { - static NSBezierPath *triangle = [[NSBezierPath alloc] init]; - [triangle removeAllPoints]; - // In off state, a disclosure button is an equilateral triangle - // ('pointing' to the right) with a bound rect that can be described - // as NSMakeRect(0, 0, 8, 9). Inside the 'rect' it's translated by - // (2, 4). - [triangle moveToPoint:NSMakePoint(rect.origin.x + 2, rect.origin.y + 4)]; - [triangle lineToPoint:NSMakePoint(rect.origin.x + 2, rect.origin.y + 4 + 9)]; - [triangle lineToPoint:NSMakePoint(rect.origin.x + 2 + 8, rect.origin.y + 4 + 4.5)]; - [triangle closePath]; - [triangle fill]; - } else { - static NSBezierPath *openTriangle = [[NSBezierPath alloc] init]; - [openTriangle removeAllPoints]; - // In 'on' state, the button is an equilateral triangle (looking down) - // with the bounding rect NSMakeRect(0, 0, 9, 8). Inside the 'rect' - // it's translated by (1, 4). - [openTriangle moveToPoint:NSMakePoint(rect.origin.x + 1, rect.origin.y + 4 + 8)]; - [openTriangle lineToPoint:NSMakePoint(rect.origin.x + 1 + 9, rect.origin.y + 4 + 8)]; - [openTriangle lineToPoint:NSMakePoint(rect.origin.x + 1 + 4.5, rect.origin.y + 4)]; - [openTriangle closePath]; - [openTriangle fill]; - } -} - void QMacStylePrivate::drawFocusRing(QPainter *p, const QRectF &targetRect, int hMargin, int vMargin, const CocoaControl &cw) const { QPainterPath focusRingPath; @@ -3301,15 +3241,8 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai CGContextScaleCTM(cg, 1, -1); CGContextTranslateCTM(cg, -rect.origin.x, -rect.origin.y); - if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::MacOSMojave && !qt_mac_applicationIsInDarkMode()) { - // When the real system theme is one of the 'Dark' themes, and an application forces the 'Aqua' theme, - // under some conditions (see QTBUG-74515 for more details) NSButtonCell seems to select the 'Dark' - // code path and is becoming transparent, thus 'invisible' on the white background. To workaround this, - // we draw the disclose triangle manually: - qt_drawDisclosureButton(cg, triangleCell.state, (opt->state & State_Selected) && viewHasFocus, rect); - } else { - [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]]; - } + [triangleCell drawBezelWithFrame:NSRectFromCGRect(rect) inView:[triangleCell controlView]]; + d->restoreNSGraphicsContext(cg); break; } -- cgit v1.2.3 From 09228604d8cd38c331bcb4f34d8d8aa3b34488e4 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 11 Apr 2019 13:22:18 +0200 Subject: Generic bearer engine - do not ignore WLAN interfaces (Windows) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous code and comments refer to the "separate engine" and skip such interfaces. Given we explicitly disabled this "separate engine", skipping the interfaces is a bit cruel. Task-number: QTBUG-65593 Change-Id: Ie9dce1661bd697f22044ca6fb4a5e2485ef74253 Reviewed-by: Mårten Nordheim --- src/plugins/bearer/generic/qgenericengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 7472758418..b1f28849a7 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -300,7 +300,7 @@ void QGenericEngine::doRequestUpdate() if (interface.flags() & QNetworkInterface::IsLoopBack) continue; -#ifndef Q_OS_WINRT +#ifndef Q_OS_WIN // ignore WLAN interface handled in separate engine if (qGetInterfaceType(interface.name()) == QNetworkConfiguration::BearerWLAN) continue; -- cgit v1.2.3 From ab2c1e20fadc59a1a2365bda9e0e6b8eb295f5c9 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Tue, 9 Apr 2019 17:18:49 +0200 Subject: Windows QPA: Fix QComboBox accessibility with screen readers Screen readers like NVDA and Narrator were not reading the contents of a QComboBox when changing its value using the keyboard, without expanding it, due to missing UI Automation notifications in this case. This change should also help in other cases where updated string values were not notified to screen readers. Fixes: QTBUG-75066 Change-Id: Id7f488380aec5ad27fd11b3cf854d44ab1b28688 Reviewed-by: Friedemann Kleint --- .../uiautomation/qwindowsuiaaccessibility.cpp | 3 ++ .../uiautomation/qwindowsuiamainprovider.cpp | 37 ++++++++++++++++++++-- .../windows/uiautomation/qwindowsuiamainprovider.h | 1 + 3 files changed, 39 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp index 85a931e015..c7c0deab3f 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiaaccessibility.cpp @@ -113,6 +113,9 @@ void QWindowsUiaAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event case QAccessible::ValueChanged: QWindowsUiaMainProvider::notifyValueChange(static_cast(event)); break; + case QAccessible::SelectionAdd: + QWindowsUiaMainProvider::notifySelectionChange(event); + break; case QAccessible::TextAttributeChanged: case QAccessible::TextColumnChanged: case QAccessible::TextInserted: diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp index fad83fb165..44328492a6 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.cpp @@ -146,9 +146,33 @@ void QWindowsUiaMainProvider::notifyStateChange(QAccessibleStateChangeEvent *eve void QWindowsUiaMainProvider::notifyValueChange(QAccessibleValueChangeEvent *event) { if (QAccessibleInterface *accessible = event->accessibleInterface()) { - if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) { - // Notifies changes in values of controls supporting the value interface. + if (accessible->role() == QAccessible::ComboBox && accessible->childCount() > 0) { + QAccessibleInterface *listacc = accessible->child(0); + if (listacc && listacc->role() == QAccessible::List) { + int count = listacc->childCount(); + for (int i = 0; i < count; ++i) { + QAccessibleInterface *item = listacc->child(i); + if (item && item->text(QAccessible::Name) == event->value()) { + if (!item->state().selected) { + if (QAccessibleActionInterface *actionInterface = item->actionInterface()) + actionInterface->doAction(QAccessibleActionInterface::toggleAction()); + } + break; + } + } + } + } + if (event->value().type() == QVariant::String) { + if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) { + // Notifies changes in string values. + VARIANT oldVal, newVal; + clearVariant(&oldVal); + setVariantString(event->value().toString(), &newVal); + QWindowsUiaWrapper::instance()->raiseAutomationPropertyChangedEvent(provider, UIA_ValueValuePropertyId, oldVal, newVal); + } + } else if (QAccessibleValueInterface *valueInterface = accessible->valueInterface()) { if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) { + // Notifies changes in values of controls supporting the value interface. VARIANT oldVal, newVal; clearVariant(&oldVal); setVariantDouble(valueInterface->currentValue().toDouble(), &newVal); @@ -158,6 +182,15 @@ void QWindowsUiaMainProvider::notifyValueChange(QAccessibleValueChangeEvent *eve } } +void QWindowsUiaMainProvider::notifySelectionChange(QAccessibleEvent *event) +{ + if (QAccessibleInterface *accessible = event->accessibleInterface()) { + if (QWindowsUiaMainProvider *provider = providerForAccessible(accessible)) { + QWindowsUiaWrapper::instance()->raiseAutomationEvent(provider, UIA_SelectionItem_ElementSelectedEventId); + } + } +} + // Notifies changes in text content and selection state of text controls. void QWindowsUiaMainProvider::notifyTextChange(QAccessibleEvent *event) { diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h index 325d5b3de4..df0d60f9c9 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiamainprovider.h @@ -68,6 +68,7 @@ public: static void notifyFocusChange(QAccessibleEvent *event); static void notifyStateChange(QAccessibleStateChangeEvent *event); static void notifyValueChange(QAccessibleValueChangeEvent *event); + static void notifySelectionChange(QAccessibleEvent *event); static void notifyTextChange(QAccessibleEvent *event); // IUnknown -- cgit v1.2.3