From 6ccbe7ffdfee0a69ba50d22f577075b1d8cb0b04 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 29 Mar 2019 00:29:00 +0100 Subject: macOS: When a menu item has an italic font it should respect this MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id8d2c5c0d0407ead66700d38634f342f489a2842 Fixes: QTBUG-69489 Reviewed-by: Morten Johan Sørvig --- src/plugins/styles/mac/qmacstyle_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 9a11c4d818..fd006b1ca3 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -4323,7 +4323,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter d->setupNSGraphicsContext(cgCtx, YES); [s.toNSString() drawInRect:textRect - withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c }]; + withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c, + NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0]}]; d->restoreNSGraphicsContext(cgCtx); } else { -- cgit v1.2.3 From 409e3eab092ae9896f453b69f4b4749e654680bb Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 28 Mar 2019 10:42:38 +0100 Subject: QMacStyle - fix PE_InticatorTabClose handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for the case a custom style sheet is in use and QStyleSheetStyle replaces the widget (close button) with its parent (QTabBar). We still need this button though to compare against tabButton on a hovered tab. This allows us to have, indeed, native-looking tabs as documented (aka similar to Safari or the "Terminal" application). Change-Id: I53ff78699e705db6d7c7b84774b8e188a1277535 Fixes: QTBUG-61092 Fixes: QTBUG-74689 Reviewed-by: Morten Johan Sørvig --- src/plugins/styles/mac/qmacstyle_mac.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index fd006b1ca3..0745e917a2 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -3411,18 +3411,20 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai case PE_IndicatorTabClose: { // Make close button visible only on the hovered tab. QTabBar *tabBar = qobject_cast(w->parentWidget()); + const QWidget *closeBtn = w; if (!tabBar) { // QStyleSheetStyle instead of CloseButton (which has // a QTabBar as a parent widget) uses the QTabBar itself: tabBar = qobject_cast(const_cast(w)); + closeBtn = decltype(closeBtn)(property("_q_styleSheetRealCloseButton").value()); } if (tabBar) { const bool documentMode = tabBar->documentMode(); const QTabBarPrivate *tabBarPrivate = static_cast(QObjectPrivate::get(tabBar)); const int hoveredTabIndex = tabBarPrivate->hoveredTabIndex(); if (!documentMode || - (hoveredTabIndex != -1 && ((w == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) || - (w == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide))))) { + (hoveredTabIndex != -1 && ((closeBtn == tabBar->tabButton(hoveredTabIndex, QTabBar::LeftSide)) || + (closeBtn == tabBar->tabButton(hoveredTabIndex, QTabBar::RightSide))))) { const bool hover = (opt->state & State_MouseOver); const bool selected = (opt->state & State_Selected); const bool pressed = (opt->state & State_Sunken); -- cgit v1.2.3 From e4532224145a0a72cde9b40cb7fd39011624d1c1 Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Sun, 10 Mar 2019 14:48:58 +0300 Subject: Fix tablet jitter on X11 We should get the correct stylus position from the valuators, not from the X11-provided global position. Global position is rounded to the nearest FP16 values, which is not enough for smooth painting. [ChangeLog][Platform Specific Changes][X11 / XCB] QTabletEvent coordinates now come from AbsX/AbsY valuators in the X11 event, in more precise 32.32 fixed-point format, scaled to fit the virtual desktop. It's possible to revert to using the legacy 16.16-format event_x/event_y coordinates as in previous releases by setting the QT_XCB_TABLET_LEGACY_COORDINATES environment variable. Task-number: QTBUG-45375 Fixes: QTBUG-48151 Change-Id: Ie701446b3586296bcb8fb09158f387ba6a7cbf07 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 04ddd3c98c..91fd612cde 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -1208,6 +1208,11 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD return handled; } +inline qreal scaleOneValuator(qreal normValue, qreal screenMin, qreal screenSize) +{ + return screenMin + normValue * screenSize; +} + void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletData) { auto *ev = reinterpret_cast(event); @@ -1220,6 +1225,17 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD QPointF global(fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y)); double pressure = 0, rotation = 0, tangentialPressure = 0; int xTilt = 0, yTilt = 0; + static const bool useValuators = !qEnvironmentVariableIsSet("QT_XCB_TABLET_LEGACY_COORDINATES"); + + // Valuators' values are relative to the physical size of the current virtual + // screen. Therefore we cannot use QScreen/QWindow geometry and should use + // QPlatformWindow/QPlatformScreen instead. + QRect physicalScreenArea; + if (Q_LIKELY(useValuators)) { + const QList siblings = window->screen()->handle()->virtualSiblings(); + for (const QPlatformScreen *screen : siblings) + physicalScreenArea |= screen->geometry(); + } for (QHash::iterator it = tabletData->valuatorInfo.begin(), ite = tabletData->valuatorInfo.end(); it != ite; ++it) { @@ -1228,6 +1244,20 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD xi2GetValuatorValueIfSet(event, classInfo.number, &classInfo.curVal); double normalizedValue = (classInfo.curVal - classInfo.minVal) / (classInfo.maxVal - classInfo.minVal); switch (valuator) { + case QXcbAtom::AbsX: + if (Q_LIKELY(useValuators)) { + const qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.x(), physicalScreenArea.width()); + global.setX(value); + local.setX(value - window->handle()->geometry().x()); + } + break; + case QXcbAtom::AbsY: + if (Q_LIKELY(useValuators)) { + qreal value = scaleOneValuator(normalizedValue, physicalScreenArea.y(), physicalScreenArea.height()); + global.setY(value); + local.setY(value - window->handle()->geometry().y()); + } + break; case QXcbAtom::AbsPressure: pressure = normalizedValue; break; -- cgit v1.2.3