From 6a7ee92b3958e3a3ebc16be15f8bd34217ec7bd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Wed, 10 Dec 2014 07:27:23 +0100 Subject: Handle SelectionClientClose in QXcbClipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QXcbClipboard listens for subtype SelectionClientClose of Xfixes SelectionNotify event, but doesn't handle it. When the client holding the clipboard selection closes the Clipboard becomes empty and thus the change should be emitted. This fixes downstream KDE Bug #329174. Change-Id: I19fb8cfd7bd3b249c0bc6ca2a724a9aeeb05ac7e Reviewed-by: Jørgen Lind Reviewed-by: Aleix Pol Gonzalez --- src/plugins/platforms/xcb/qxcbclipboard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index 8b3893ec2f..f56a29d985 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -742,7 +742,8 @@ void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_eve m_xClipboard[mode]->reset(); } emitChanged(mode); - } + } else if (event->subtype == XCB_XFIXES_SELECTION_EVENT_SELECTION_CLIENT_CLOSE) + emitChanged(mode); } -- cgit v1.2.3 From e415ed83af3b90be76c63b21ee281eb48995c2ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 10 Dec 2014 16:45:45 +0100 Subject: iOS: Don't scroll screen on changes to input item transform MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We auto-scroll the screen to reveal the cursor whenever the cursor rect changes or other properties of the input methods are updated, but the expected behavior when explicitly moving an item under the keyboard, such as when scrolling a view or moving an item using drag, is to not scroll the screen until typing commences. This matches how eg. Safari or the Notes app handles the same use-case. Change-Id: I6b6932d9bcbdccd8df26db982246c162f1574d86 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.h | 1 - src/plugins/platforms/ios/qiosinputcontext.mm | 22 +++------------------- 2 files changed, 3 insertions(+), 20 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosinputcontext.h b/src/plugins/platforms/ios/qiosinputcontext.h index 863e503c3b..498db45ef2 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.h +++ b/src/plugins/platforms/ios/qiosinputcontext.h @@ -96,7 +96,6 @@ public: void setFocusObject(QObject *object) Q_DECL_OVERRIDE; void focusWindowChanged(QWindow *focusWindow); - void cursorRectangleChanged(); void scrollToCursor(); void scroll(int y); diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index fe9ee18155..aebf8fff8f 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -281,8 +281,6 @@ QIOSInputContext::QIOSInputContext() if (isQtApplication()) { QIOSScreen *iosScreen = static_cast(QGuiApplication::primaryScreen()->handle()); [iosScreen->uiWindow() addGestureRecognizer:m_keyboardHideGesture]; - - connect(qGuiApp->inputMethod(), &QInputMethod::cursorRectangleChanged, this, &QIOSInputContext::cursorRectangleChanged); } connect(qGuiApp, &QGuiApplication::focusWindowChanged, this, &QIOSInputContext::focusWindowChanged); @@ -400,23 +398,6 @@ QRectF QIOSInputContext::keyboardRect() const // ------------------------------------------------------------------------- -void QIOSInputContext::cursorRectangleChanged() -{ - if (!isInputPanelVisible() || !qApp->focusObject()) - return; - - // Check if the cursor has changed position inside the input item. Since - // qApp->inputMethod()->cursorRectangle() will also change when the input item - // itself moves, we need to ask the focus object for ImCursorRectangle: - static QPoint prevCursor; - QInputMethodQueryEvent queryEvent(Qt::ImCursorRectangle); - QCoreApplication::sendEvent(qApp->focusObject(), &queryEvent); - QPoint cursor = queryEvent.value(Qt::ImCursorRectangle).toRect().topLeft(); - if (cursor != prevCursor) - scrollToCursor(); - prevCursor = cursor; -} - UIView *QIOSInputContext::scrollableRootView() { if (!m_keyboardHideGesture.view) @@ -598,6 +579,9 @@ void QIOSInputContext::update(Qt::InputMethodQueries updatedProperties) } else { [m_textResponder notifyInputDelegate:changedProperties]; } + + if (changedProperties & Qt::ImCursorRectangle) + scrollToCursor(); } bool QIOSInputContext::inputMethodAccepted() const -- cgit v1.2.3 From 8aa663e1393fcd2fa78eccc92b1acd7ba7c9cde2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 10 Dec 2014 16:44:48 +0100 Subject: iOS: Only scroll to cursor on keyboard hide gesture reset if requested MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I15b313b5f0d57358e405f16e941fc5061028c6a7 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.mm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index aebf8fff8f..69bdf4aa87 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -68,6 +68,7 @@ static QUIView *focusView() @private QIOSInputContext *m_context; } +@property BOOL hasDeferredScrollToCursor; @end @implementation QIOSKeyboardListener @@ -80,6 +81,8 @@ static QUIView *focusView() m_context = context; + self.hasDeferredScrollToCursor = NO; + // UIGestureRecognizer self.enabled = NO; self.cancelsTouchesInView = NO; @@ -231,9 +234,14 @@ static QUIView *focusView() qImDebug() << "keyboard was hidden, disabling hide-keyboard gesture"; self.enabled = NO; } else { - qImDebug() << "gesture completed without triggering, scrolling view to cursor"; - m_context->scrollToCursor(); + qImDebug() << "gesture completed without triggering"; + if (self.hasDeferredScrollToCursor) { + qImDebug() << "applying deferred scroll to cursor"; + m_context->scrollToCursor(); + } } + + self.hasDeferredScrollToCursor = NO; } @end @@ -418,7 +426,8 @@ void QIOSInputContext::scrollToCursor() if (m_keyboardHideGesture.state == UIGestureRecognizerStatePossible && m_keyboardHideGesture.numberOfTouches == 1) { // Don't scroll to the cursor if the user is touching the screen and possibly // trying to trigger the hide-keyboard gesture. - qImDebug() << "preventing scrolling to cursor as we're still waiting for a possible gesture"; + qImDebug() << "deferring scrolling to cursor as we're still waiting for a possible gesture"; + m_keyboardHideGesture.hasDeferredScrollToCursor = YES; return; } -- cgit v1.2.3 From de04841e19feb1ce1ba010c5026c06978ee03433 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Thu, 4 Dec 2014 14:57:53 +0100 Subject: iOS: only clear focus object if it supports IM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We try to keep a on-to-one relationship between UI controls with text input and keyboard visibility. But if the control does not use text input, then there is no reason for us to clear focus when the keyboard hides. In fact, we should avoid doing so, since that will stop e.g buttons from working correctly. The typical flow is: - a touch release targeting a button is sendt to QApplication. - QApplication transfers focus to the button. - qiosinputcontext gets notified, we refuse, and clear focus again. - QApplication enters a propagation loop where it tried to find out the receiver of the event. Since the button is now unfocused, the event will propagate up to a grandparent instead. - the button will as such not trigger. Change-Id: I70baa38299f40defc4a77f62790502e2d6ebbba9 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.mm | 3 ++- src/plugins/platforms/ios/qiostextresponder.mm | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 69bdf4aa87..e8b16a0ed8 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -514,7 +514,8 @@ void QIOSInputContext::setFocusObject(QObject *focusObject) qImDebug() << "new focus object =" << focusObject; - if (m_keyboardHideGesture.state == UIGestureRecognizerStateChanged) { + if (QPlatformInputContext::inputMethodAccepted() + && m_keyboardHideGesture.state == UIGestureRecognizerStateChanged) { // A new focus object may be set as part of delivering touch events to // application during the hide-keyboard gesture, but we don't want that // to result in a new object getting focus and bringing the keyboard up diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 2fcc7258f7..bebc7577f8 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -263,10 +263,14 @@ // will set the new first-responder to our next-responder, and in the latter // case we'll have an active responder candidate. if ([UIResponder currentFirstResponder] == [self nextResponder]) { - // We have resigned the keyboard, and transferred back to the parent view, so unset focus object + // We have resigned the keyboard, and transferred first responder back to the parent view Q_ASSERT(!FirstResponderCandidate::currentCandidate()); - qImDebug() << "keyboard was closed, clearing focus object"; - m_inputContext->clearCurrentFocusObject(); + if ([self imValue:Qt::ImEnabled].toBool()) { + // The current focus object expects text input, but there + // is no keyboard to get input from. So we clear focus. + qImDebug() << "no keyboard available, clearing focus object"; + m_inputContext->clearCurrentFocusObject(); + } } else { // We've lost responder status because another Qt window was made active, // another QIOSTextResponder was made first-responder, another UIView was -- cgit v1.2.3 From fb9eca8c9c7c88673cc991f978a264a493652796 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 2 Dec 2014 15:33:55 +0100 Subject: iOS: let keyboard gesture work better with other gestures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Let the keyboard gesture work better alongside other gestures by reporting that it should: 1. not prevent other gestures from triggering. This means that even if our gesture triggers (we close the keyboard), gestures attached to sub-views will still continue tracking. 2. not be prevented by other gestures. This means that if a gesture in a sub-view triggeres before our gesture, our gesture will still continue to track. In short it means that regardless of other gestures, we always close the keyboard if our text responder is first responder and the user flicks down. And we do so as "silently" as possible. Change-Id: I22386b5ef5dedbc498a2899929ddd07424e514d8 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosinputcontext.mm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index e8b16a0ed8..76c02d939f 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -162,6 +162,18 @@ static QUIView *focusView() // ------------------------------------------------------------------------- +- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)other +{ + Q_UNUSED(other); + return NO; +} + +- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)other +{ + Q_UNUSED(other); + return NO; +} + - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesBegan:touches withEvent:event]; -- cgit v1.2.3 From 994bbcf1df83ecd6ed273926128d55088bd7ef5e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Dec 2014 13:16:56 +0100 Subject: Windows: Fix window geometry when using QWindow::fromWinId(). Take margins into account. Task-number: QTBUG-43252 Change-Id: I816115d2bbbcee3e8663f42bf07b1a140a049e69 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 5768800947..05ed6aed53 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -559,10 +559,11 @@ QWindowsWindowData Q_ASSERT(result.hwnd); const LONG_PTR style = GetWindowLongPtr(result.hwnd, GWL_STYLE); const LONG_PTR exStyle = GetWindowLongPtr(result.hwnd, GWL_EXSTYLE); - result.geometry = frameGeometry(result.hwnd, !GetParent(result.hwnd)); - result.frame = QWindowsGeometryHint::frame(style, exStyle); result.embedded = false; - qCDebug(lcQpaWindows) << "Foreign window: " << w << result.hwnd << result.geometry << result.frame; + result.frame = QWindowsGeometryHint::frame(style, exStyle); + result.geometry = frameGeometry(result.hwnd, !GetParent(result.hwnd)) + .marginsRemoved(result.frame); + qCDebug(lcQpaWindows) << "Foreign window: " << w << result.hwnd << result.geometry; return result; } -- cgit v1.2.3 From d61ee49df4d540d08782c9fac1c42541d2f4f9b6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Dec 2014 13:18:07 +0100 Subject: Windows: Do not register windows obtained by QWindow::fromWinId() for touch. Fixes a warning: RegisterTouchWindow() failed for window ''. (Access is denied.) Task-number: QTBUG-43252 Change-Id: I92a565f3a5e2e8815eb709b5c6d0ccdba7330e31 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 05ed6aed53..7d67aa0d09 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -890,7 +890,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) updateDropSite(); #ifndef Q_OS_WINCE - if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) { + if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch) + && aWindow->type() != Qt::ForeignWindow) { if (QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0)) { setFlag(TouchRegistered); } else { -- cgit v1.2.3 From 2e2de5e4820a928e017d3b92e826e23d95805fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 4 Dec 2014 13:30:40 +0100 Subject: Fix xcb backend not grabbing the server as default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The xcb backend relies on grabbing the x server in a few situations like popuphandling. For Qt 5.4.0 the logic enabling this code path was moved into the plugin. However it defaults to never grabbing the server Change-Id: I82489a0727affbce62587b3d7470085cf716a0cc Task-number: QTBUG-43049 Reviewed-by: Martin Gräßlin Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 3818494d99..f0c4a7f691 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -165,7 +165,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char "\t Use the -dograb option to enforce grabbing."); } #endif - m_canGrab = (!underDebugger && noGrabArg) || (underDebugger && doGrabArg); + m_canGrab = (!underDebugger && !noGrabArg) || (underDebugger && doGrabArg); static bool canNotGrabEnv = qEnvironmentVariableIsSet("QT_XCB_NO_GRAB_SERVER"); if (canNotGrabEnv) -- cgit v1.2.3 From 21101d9c52d2b7c6471f9814c9bff5aa87e22afc Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Thu, 11 Dec 2014 13:51:48 +0200 Subject: Fix crash when Android Style is set more than once. Load again JSON document is it was freed. Task-number: QTBUG-43111 Change-Id: I22f1de221371b49fec8b3d66ad5f0bd2af9656fe Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../platforms/android/qandroidplatformintegration.cpp | 5 ++++- .../platforms/android/qandroidplatformtheme.cpp | 18 +++++++++++++----- src/plugins/platforms/android/qandroidplatformtheme.h | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 07bdf95bf4..d94da65dde 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -79,8 +79,11 @@ void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteA if (resource == "QtActivity") return QtAndroid::activity(); if (resource == "AndroidStyleData") { - if (m_androidStyle) + if (m_androidStyle) { + if (m_androidStyle->m_styleData.isEmpty()) + m_androidStyle->m_styleData = AndroidStyle::loadStyleData(); return &m_androidStyle->m_styleData; + } else return Q_NULLPTR; } diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp index d9f062576b..35eb282994 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.cpp +++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp @@ -176,7 +176,7 @@ static void setPaletteColor(const QVariantMap &object, } } -static std::shared_ptr loadAndroidStyle(QPalette *defaultPalette) +QJsonObject AndroidStyle::loadStyleData() { QString stylePath(QLatin1String(qgetenv("MINISTRO_ANDROID_STYLE_PATH"))); const QLatin1Char slashChar('/'); @@ -198,21 +198,29 @@ static std::shared_ptr loadAndroidStyle(QPalette *defaultPalette) QFile f(stylePath + QLatin1String("style.json")); if (!f.open(QIODevice::ReadOnly)) - return std::shared_ptr(); + return QJsonObject(); QJsonParseError error; QJsonDocument document = QJsonDocument::fromJson(f.readAll(), &error); if (document.isNull()) { qCritical() << error.errorString(); - return std::shared_ptr(); + return QJsonObject(); } if (!document.isObject()) { qCritical() << "Style.json does not contain a valid style."; - return std::shared_ptr(); + return QJsonObject(); } + return document.object(); +} + +static std::shared_ptr loadAndroidStyle(QPalette *defaultPalette) +{ std::shared_ptr style(new AndroidStyle); - style->m_styleData = document.object(); + style->m_styleData = AndroidStyle::loadStyleData(); + if (style->m_styleData.isEmpty()) + return std::shared_ptr(); + for (QJsonObject::const_iterator objectIterator = style->m_styleData.constBegin(); objectIterator != style->m_styleData.constEnd(); ++objectIterator) { diff --git a/src/plugins/platforms/android/qandroidplatformtheme.h b/src/plugins/platforms/android/qandroidplatformtheme.h index e842e672d6..2069910136 100644 --- a/src/plugins/platforms/android/qandroidplatformtheme.h +++ b/src/plugins/platforms/android/qandroidplatformtheme.h @@ -46,12 +46,12 @@ QT_BEGIN_NAMESPACE struct AndroidStyle { + static QJsonObject loadStyleData(); QJsonObject m_styleData; QPalette m_standardPalette; QHash m_palettes; QHash m_fonts; QHash m_QWidgetsFonts; - QHash m_QWidgetsPalettes; }; class QAndroidPlatformNativeInterface; -- cgit v1.2.3 From 7f6c4390ec98b644cc3c07cc5aa5f47da37c8dd3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 15 Dec 2014 14:18:13 +0100 Subject: Windows: Return false from event processing of unhandled multimedia keys. Otherwise, potentially active players no longer receive the keys when a Qt application is running. Task-number: QTBUG-43343 Change-Id: Iefa511a101734690305e3244fafec4a460a9212d Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowskeymapper.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index ff9ad1874a..d781cdbe9c 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -833,7 +833,10 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con const int qtKey = CmdTbl[cmd]; sendExtendedPressRelease(receiver, qtKey, Qt::KeyboardModifier(state), 0, 0, 0); - return true; + // QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise, + // the keys are not passed to the active media player. + const QKeySequence sequence(Qt::Modifier(state) + qtKey); + return QGuiApplicationPrivate::instance()->shortcutMap.hasShortcutForKeySequence(sequence); #else Q_UNREACHABLE(); return false; -- cgit v1.2.3 From 9f63e2dc0e57fc35683f1aec915f699647987408 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 16 Dec 2014 14:51:21 +0100 Subject: Fix PDF when embedding fonts with large internal leading Setting lfHeight to a positive value in LOGFONT requests the font with the given cell height, which is em square size + internal leading. When setting this to the em square size, it means we will get glyphs that are actually sized for an em square with sides that are (emSquareSize - internalLeading). For most fonts, this was not noticeable, but for some fonts with large internal leading, the resulting glyphs would be very small. When setting lfHeight to something < 0 instead, we are selecting the font with the given character height instead, which is not including the internal leading. [ChangeLog][PDF] Fix embedding glyphs from fonts with large internal leading. Task-number: QTBUG-43082 Change-Id: Id74cf2279df2062804e9431fe305d803cb0b19d2 Reviewed-by: Lars Knoll Reviewed-by: Konstantin Ritt --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 38856a69de..e45ff5d744 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1017,7 +1017,7 @@ QFontEngine::Properties QWindowsFontEngine::properties() const void QWindowsFontEngine::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics) { LOGFONT lf = m_logfont; - lf.lfHeight = unitsPerEm; + lf.lfHeight = -unitsPerEm; int flags = synthesized(); if(flags & SynthesizedItalic) lf.lfItalic = false; -- cgit v1.2.3