From 080f0362593786ac547ad8e499565a322f40b0b3 Mon Sep 17 00:00:00 2001 From: Doris Verria Date: Thu, 25 Mar 2021 13:34:41 +0100 Subject: Re-add horizontal offsets around QPushButton Change c6379e34993370e7e2208b51be384b738ce35817 removed the horizontal space around QPushButton for consistency with other widgets. To not break existing layouts that expect the extra space around the button re-add those offsets and fix the SE_PushButtonLayoutItem accordingly. Fixes: QTBUG-91892 Change-Id: Iad1a28cd3f974adc8ab8e75f7d90cc8508d5a3b4 Reviewed-by: Timur Pocheptsov --- src/plugins/styles/mac/qmacstyle_mac.mm | 65 +++++++-------------------------- 1 file changed, 13 insertions(+), 52 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 9a263714a9..8c159e4107 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -195,10 +195,6 @@ const int QMacStylePrivate::PushButtonLeftOffset = 6; const int QMacStylePrivate::PushButtonRightOffset = 12; const int QMacStylePrivate::PushButtonContentPadding = 6; -const int pushButtonBevelRectOffsets[3] = { - QMacStylePrivate::PushButtonLeftOffset, 5, 5 -}; - QVector > QMacStylePrivate::scrollBars; // Title bar gradient colors for Lion were determined by inspecting PSDs exported @@ -1247,7 +1243,7 @@ void QMacStylePrivate::drawFocusRing(QPainter *p, const QRectF &targetRect, int } case Button_PopupButton: case SegmentedControl_Single: { - const qreal innerRadius = cw.type == Button_PushButton ? 3 : 4; + const qreal innerRadius = 4; const qreal outerRadius = innerRadius + focusRingWidth; hOffset = targetRect.left(); vOffset = targetRect.top(); @@ -1603,8 +1599,7 @@ QRectF QMacStylePrivate::CocoaControl::adjustedControlFrame(const QRectF &rect) const auto frameSize = defaultFrameSize(); if (type == QMacStylePrivate::Button_SquareButton) { frameRect = rect.adjusted(3, 1, -3, -1) - .adjusted(focusRingWidth, focusRingWidth, -focusRingWidth, -focusRingWidth) - .adjusted(-6.5, 0, 6.5, 0); + .adjusted(focusRingWidth, focusRingWidth, -focusRingWidth, -focusRingWidth); } else if (type == QMacStylePrivate::Button_PushButton) { // Start from the style option's top-left corner. frameRect = QRectF(rect.topLeft(), @@ -1613,8 +1608,6 @@ QRectF QMacStylePrivate::CocoaControl::adjustedControlFrame(const QRectF &rect) frameRect = frameRect.translated(0, 1.5); else if (size == QStyleHelper::SizeMini) frameRect = frameRect.adjusted(0, 0, -8, 0).translated(4, 4); - frameRect = frameRect.adjusted(-pushButtonBevelRectOffsets[size], 0, - pushButtonBevelRectOffsets[size], 0); } else { // Center in the style option's rect. frameRect = QRectF(QPointF(0, (rect.height() - frameSize.height()) / 2.0), @@ -1627,9 +1620,6 @@ QRectF QMacStylePrivate::CocoaControl::adjustedControlFrame(const QRectF &rect) frameRect = frameRect.adjusted(0, 0, -4, 0).translated(2, 1); else if (size == QStyleHelper::SizeMini) frameRect = frameRect.adjusted(0, 0, -9, 0).translated(5, 0); - if (type == QMacStylePrivate::Button_PullDown) - frameRect = frameRect.adjusted(-pushButtonBevelRectOffsets[size], 0, - pushButtonBevelRectOffsets[size], 0); } else if (type == QMacStylePrivate::ComboBox) { frameRect = frameRect.adjusted(0, 0, -6, 0).translated(4, 0); } @@ -3791,11 +3781,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter QRect textRect = itemTextRect( btn.fontMetrics, freeContentRect, Qt::AlignCenter, isEnabled, btn.text); if (hasMenu) { - if (ct == QMacStylePrivate::Button_SquareButton) - textRect.moveTo(w ? 8 : 11, textRect.top()); - else - textRect.moveTo(w ? (15 - pushButtonBevelRectOffsets[d->effectiveAquaSizeConstrain(b, w)]) - : 11, textRect.top()); // Supports Qt Quick Controls + textRect.moveTo(w ? 15 : 11, textRect.top()); // Supports Qt Quick Controls } // Draw the icon: if (hasIcon) { @@ -4943,24 +4929,14 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, = qstyleoption_cast(opt)) { if ((buttonOpt->features & QStyleOptionButton::Flat)) break; // leave rect alone - if ((buttonOpt->features & QStyleOptionButton::CommandLinkButton)) { - rect = opt->rect; - if (controlSize == QStyleHelper::SizeLarge) - rect.adjust(+6, +4, -6, -8); - else if (controlSize == QStyleHelper::SizeSmall) - rect.adjust(+5, +4, -5, -6); - else - rect.adjust(+1, 0, -1, -2); - break; - } } rect = opt->rect; if (controlSize == QStyleHelper::SizeLarge) { - rect.adjust(0, +4, 0, -8); + rect.adjust(+6, +4, -6, -8); } else if (controlSize == QStyleHelper::SizeSmall) { - rect.adjust(0, +4, 0, -6); + rect.adjust(+5, +4, -5, -6); } else { - rect.adjust(0, 0, 0, -2); + rect.adjust(+1, 0, -1, -2); } break; case SE_RadioButtonLayoutItem: @@ -6389,12 +6365,9 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, break; #endif case QStyle::CT_PushButton: { - bool isFlat = false; - if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { +if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) if (btn->features & QStyleOptionButton::CommandLinkButton) return QCommonStyle::sizeFromContents(ct, opt, sz, widget); - isFlat = btn->features & QStyleOptionButton::Flat; - } // By default, we fit the contents inside a normal rounded push button. // Do this by add enough space around the contents so that rounded @@ -6409,24 +6382,12 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, // All values as measured from HIThemeGetButtonBackgroundBounds() if (controlSize != QStyleHelper::SizeMini) sz.rwidth() += 12; // We like 12 over here. - - if (controlSize == QStyleHelper::SizeLarge) { - if (!isFlat) - sz.rwidth() -= 12; - if (sz.height() > 16) - sz.rheight() += pushButtonDefaultHeight[QStyleHelper::SizeLarge] - 16; - else - sz.setHeight(pushButtonDefaultHeight[QStyleHelper::SizeLarge]); - } else { - if (!isFlat) - sz.rwidth() -= 10; - if (controlSize == QStyleHelper::SizeMini) - sz.setHeight(24); - else - sz.setHeight(pushButtonDefaultHeight[QStyleHelper::SizeSmall]); - } - if (isFlat) - sz.rwidth() -= 13; + if (controlSize == QStyleHelper::SizeLarge && sz.height() > 16) + sz.rheight() += pushButtonDefaultHeight[QStyleHelper::SizeLarge] - 16; + else if (controlSize == QStyleHelper::SizeMini) + sz.setHeight(24); // FIXME Our previous HITheme-based logic returned this. + else + sz.setHeight(pushButtonDefaultHeight[controlSize]); break; } case QStyle::CT_MenuItem: -- cgit v1.2.3 From d2068a8108c9ba0168c6f107d2e000c40bd23bdf Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Mon, 12 Apr 2021 13:14:52 +0400 Subject: Read DPI from X Settings initially as well MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, Xft.dpi from X Resources is read initially, while changes are monitored for Xft/DPI from X Settings. These protocols are different and can have different values. E.g. MATE sets X Resources' Xft.dpi to 96.30859375, while X Settings' Xft/DPI is set to 197240 at 2x scale. This results in a very weird bug when Qt can't determine 2x scale initially, but if scale is changed at run time, Qt changes scale to the right value. The difference could be checked via xrdb -query and dump_xsettings (the second is from xsettingsd project). [ChangeLog] Qt now reads Xft/DPI from X settings at startup, and will prefer this value over Xft.dpi from X resources. Change-Id: If6adac0c88198579332ddebc673f1524f324c0e4 Reviewed-by: Morten Johan Sørvig (cherry picked from commit 6560778616b090f8cc73700675ec2ef385953fb6) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/xcb/qxcbscreen.cpp | 23 ++++++++++++++++------- src/plugins/platforms/xcb/qxcbscreen.h | 2 ++ 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index bf77e8f663..2957636129 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -114,17 +114,13 @@ QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t } auto dpiChangedCallback = [](QXcbVirtualDesktop *desktop, const QByteArray &, const QVariant &property, void *) { - bool ok; - int dpiTimes1k = property.toInt(&ok); - if (!ok) + if (!desktop->setDpiFromXSettings(property)) return; - int dpi = dpiTimes1k / 1024; - if (desktop->m_forcedDpi == dpi) - return; - desktop->m_forcedDpi = dpi; + const auto dpi = desktop->forcedDpi(); for (QXcbScreen *screen : desktop->connection()->screens()) QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(screen->QPlatformScreen::screen(), dpi, dpi); }; + setDpiFromXSettings(xSettings()->setting("Xft/DPI")); xSettings()->registerCallbackForProperty("Xft/DPI", dpiChangedCallback, nullptr); } @@ -425,6 +421,19 @@ void QXcbVirtualDesktop::readXResources() } } +bool QXcbVirtualDesktop::setDpiFromXSettings(const QVariant &property) +{ + bool ok; + int dpiTimes1k = property.toInt(&ok); + if (!ok) + return false; + int dpi = dpiTimes1k / 1024; + if (m_forcedDpi == dpi) + return false; + m_forcedDpi = dpi; + return true; +} + QSurfaceFormat QXcbVirtualDesktop::surfaceFormatFor(const QSurfaceFormat &format) const { const xcb_visualid_t xcb_visualid = connection()->hasDefaultVisualId() ? connection()->defaultVisualId() diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 2935cb72f9..c1dc4820be 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -118,6 +118,8 @@ private: QByteArray &stringValue); void readXResources(); + bool setDpiFromXSettings(const QVariant &property); + xcb_screen_t *m_screen; const int m_number; QList m_screens; -- cgit v1.2.3 From bdd55c9c333fb969171a3cd6667160298bfe3571 Mon Sep 17 00:00:00 2001 From: Tapio Oksa Date: Tue, 16 Mar 2021 11:35:30 +0200 Subject: [Android] Remove signal and slot mechanism to listen states in editors Task-number: QTBUG-58013 Change-Id: I6f78fa327943d8c0a0b71ce6f59e55fe2282aa8d Reviewed-by: Ville Voutilainen --- .../platforms/android/qandroidinputcontext.cpp | 35 +++++++++++++++++----- .../platforms/android/qandroidinputcontext.h | 2 +- 2 files changed, 29 insertions(+), 8 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index c7452ef0e4..f6d096b667 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -892,7 +892,34 @@ void QAndroidInputContext::update(Qt::InputMethodQueries queries) QSharedPointer query = focusObjectInputMethodQuery(queries); if (query.isNull()) return; -#warning TODO extract the needed data from query + + if (query->value(Qt::ImCursorPosition).toInt() >= 0 && + query->value(Qt::ImSurroundingText).toString() != nullptr && + query->value(Qt::ImSurroundingText).toString() + .left(query->value(Qt::ImCursorPosition).toInt()).length()>=0) { + // Cursos position should be always valid + // when object is composing + if (focusObjectIsComposing()) + return; + if (m_focusObject->isWidgetType()) + updateCursorPosition(); + else + updateCursorPositionInRange(query); + } +} + +void QAndroidInputContext::updateCursorPositionInRange(const QSharedPointer &query) +{ + QObject *input = qGuiApp->focusObject(); + QList attributes; + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, + query->value(Qt::ImCursorPosition).toInt(), 1)); + + QInputMethodEvent event(QString(), attributes); + QCoreApplication::sendEvent(input, &event); + QtAndroidInput::updateSelection(query->value(Qt::ImCursorPosition).toInt(), + query->value(Qt::ImCursorPosition).toInt(), 0, + query->value(Qt::ImSurroundingText).toString().length()); } void QAndroidInputContext::invokeAction(QInputMethod::Action action, int cursorPosition) @@ -925,12 +952,6 @@ void QAndroidInputContext::showInputPanel() if (query.isNull()) return; - disconnect(m_updateCursorPosConnection); - if (qGuiApp->focusObject()->metaObject()->indexOfSignal("cursorPositionChanged(int,int)") >= 0) // QLineEdit breaks the pattern - m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged(int,int)), this, SLOT(updateCursorPosition())); - else - m_updateCursorPosConnection = connect(qGuiApp->focusObject(), SIGNAL(cursorPositionChanged()), this, SLOT(updateCursorPosition())); - QRect rect = cursorRect(); QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(), inputItemRectangle().height(), diff --git a/src/plugins/platforms/android/qandroidinputcontext.h b/src/plugins/platforms/android/qandroidinputcontext.h index 8b3a362343..921364bfa0 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.h +++ b/src/plugins/platforms/android/qandroidinputcontext.h @@ -156,13 +156,13 @@ private: void focusObjectStartComposing(); bool focusObjectStopComposing(); QRect cursorRect(); + void updateCursorPositionInRange(const QSharedPointer &query); private: ExtractedText m_extractedText; QString m_composingText; int m_composingTextStart; int m_composingCursor; - QMetaObject::Connection m_updateCursorPosConnection; HandleModes m_handleMode; int m_batchEditNestingLevel; QObject *m_focusObject; -- cgit v1.2.3 From d648b9fa8a5e1e757b827927d424b9c4346da080 Mon Sep 17 00:00:00 2001 From: Bartlomiej Moskal Date: Tue, 23 Mar 2021 10:08:20 +0100 Subject: Android: fix for isSoftwareKeyboard method isSoftwareKeyboard() method will rely on visibility flag from activityDelegate. In such case it also need to consider that keyboard is during the hiding. Fix the regression related with commit: e6ca200a3a0aecc2313becf959c1be4fe18bdfa1 Before this change Software Keyboard is not showing after changing the focus. It is happening when Keyboard is already visible and focus is changed to widget that also need the keyboard. In such case keyboard is hiding (and NOT showing again). Fixes: QTBUG-92051 Change-Id: I6a5d07b25442429fda6e715d09ea104432c5ef50 Reviewed-by: Rami Potinkara Reviewed-by: Ville Voutilainen (cherry picked from commit e402e1103b874c0bf91a1bc754752ee73ffadf33) Reviewed-by: Assam Boudjelthia --- src/plugins/platforms/android/androidjniinput.cpp | 4 +--- src/plugins/platforms/android/qandroidinputcontext.cpp | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 4ab326410b..ba24b8ed4b 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -59,7 +59,6 @@ using namespace QtAndroid; namespace QtAndroidInput { static bool m_ignoreMouseEvents = false; - static bool m_softwareKeyboardVisible = false; static QRect m_softwareKeyboardRect; static QList m_touchPoints; @@ -115,7 +114,7 @@ namespace QtAndroidInput bool isSoftwareKeyboardVisible() { - return m_softwareKeyboardVisible; + return QJNIObjectPrivate::callStaticMethod(applicationClass(), "isSoftwareKeyboardVisible"); } QRect softwareKeyboardRect() @@ -806,7 +805,6 @@ namespace QtAndroidInput static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean visibility) { - m_softwareKeyboardVisible = visibility; if (!visibility) m_softwareKeyboardRect = QRect(); diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index f6d096b667..4d8e50391b 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -953,7 +953,8 @@ void QAndroidInputContext::showInputPanel() return; QRect rect = cursorRect(); - QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(), + if (!isInputPanelVisible()) + QtAndroidInput::showSoftwareKeyboard(rect.left(), rect.top(), rect.width(), rect.height(), inputItemRectangle().height(), query->value(Qt::ImHints).toUInt(), query->value(Qt::ImEnterKeyType).toUInt()); -- cgit v1.2.3 From f21a3a451ff531fc1ed6bcf24a188db49fc02cd2 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 16 Apr 2021 16:11:07 +0200 Subject: SQLite: Handle tables and fields with a dot in the name correctly Fixes: QTBUG-91885 Change-Id: Iba76bb50266dd4fb5f50e4ea1549d1d2bb6e3431 Reviewed-by: Edward Welbourne (cherry picked from commit 66acee69a1563488e5950645c171d6be73dd5f70) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp | 33 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 2fcb132be8..6ecb089f76 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -74,13 +74,18 @@ Q_DECLARE_METATYPE(sqlite3_stmt*) QT_BEGIN_NAMESPACE -static QString _q_escapeIdentifier(const QString &identifier) +static QString _q_escapeIdentifier(const QString &identifier, QSqlDriver::IdentifierType type) { QString res = identifier; + // If it contains [ and ] then we assume it to be escaped properly already as this indicates + // the syntax is exactly how it should be + if (identifier.contains(QLatin1Char('[')) && identifier.contains(QLatin1Char(']'))) + return res; if (!identifier.isEmpty() && !identifier.startsWith(QLatin1Char('"')) && !identifier.endsWith(QLatin1Char('"'))) { res.replace(QLatin1Char('"'), QLatin1String("\"\"")); res.prepend(QLatin1Char('"')).append(QLatin1Char('"')); - res.replace(QLatin1Char('.'), QLatin1String("\".\"")); + if (type == QSqlDriver::TableName) + res.replace(QLatin1Char('.'), QLatin1String("\".\"")); } return res; } @@ -905,13 +910,24 @@ static QSqlIndex qGetTableInfo(QSqlQuery &q, const QString &tableName, bool only { QString schema; QString table(tableName); - int indexOfSeparator = tableName.indexOf(QLatin1Char('.')); + const int indexOfSeparator = tableName.indexOf(QLatin1Char('.')); if (indexOfSeparator > -1) { - schema = tableName.left(indexOfSeparator).append(QLatin1Char('.')); - table = tableName.mid(indexOfSeparator + 1); + const int indexOfCloseBracket = tableName.indexOf(QLatin1Char(']')); + if (indexOfCloseBracket != tableName.size() - 1) { + // Handles a case like databaseName.tableName + schema = tableName.left(indexOfSeparator + 1); + table = tableName.mid(indexOfSeparator + 1); + } else { + const int indexOfOpenBracket = tableName.lastIndexOf(QLatin1Char('['), indexOfCloseBracket); + if (indexOfOpenBracket > 0) { + // Handles a case like databaseName.[tableName] + schema = tableName.left(indexOfOpenBracket); + table = tableName.mid(indexOfOpenBracket); + } + } } - q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + _q_escapeIdentifier(table) + QLatin1Char(')')); - + q.exec(QLatin1String("PRAGMA ") + schema + QLatin1String("table_info (") + + _q_escapeIdentifier(table, QSqlDriver::TableName) + QLatin1Char(')')); QSqlIndex ind; while (q.next()) { bool isPk = q.value(5).toInt(); @@ -973,8 +989,7 @@ QVariant QSQLiteDriver::handle() const QString QSQLiteDriver::escapeIdentifier(const QString &identifier, IdentifierType type) const { - Q_UNUSED(type); - return _q_escapeIdentifier(identifier); + return _q_escapeIdentifier(identifier, type); } static void handle_sqlite_callback(void *qobj,int aoperation, char const *adbname, char const *atablename, -- cgit v1.2.3 From 89e2a96182fdafa531cd9ca72c7ffc8131be019c Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 11 Mar 2021 14:40:39 +1000 Subject: wasm: fix timestamp for events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This partially reverts 7ba6ce9ed5c3e3a775f5ea2fcbbbc1f628e0624a Change-Id: Id76911f5abb729098325640cc9226be01f91aab1 Fixes: QTBUG-91720 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/wasm/qwasmeventtranslator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp index d8a838c75d..c059227c89 100644 --- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp +++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp @@ -817,7 +817,7 @@ int QWasmEventTranslator::handleTouch(int eventType, const EmscriptenTouchEvent quint64 QWasmEventTranslator::getTimestamp() { - return QDeadlineTimer::current().deadlineNSecs() / 1000; + return static_cast(emscripten_performance_now()); } struct KeyMapping { Qt::Key from, to; }; -- cgit v1.2.3 From 4343fd921cac5b71c0a968a93550ff8e87f39159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Geh=C3=B6r?= Date: Fri, 26 Feb 2021 12:26:51 +0200 Subject: [Android] Fix select handles misplacement on QDialog Get select handles {Left, Right}Point from a mapToGlobal with a cursorRectangle of anchorRectangle of the selected word/text Change-Id: I3425104c90f0efe6a1e4337328cf06dc93685b6f Task-number: QTBUG-90799 Reviewed-by: Rami Potinkara Reviewed-by: Ville Voutilainen (cherry picked from commit 56b54743e001c4af196c1e4786118d88b1d2cd2f) Reviewed-by: Assam Boudjelthia --- .../platforms/android/qandroidinputcontext.cpp | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index 4d8e50391b..b1a50d92ad 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -95,6 +95,7 @@ private: static QAndroidInputContext *m_androidInputContext = 0; static char const *const QtNativeInputConnectionClassName = "org/qtproject/qt5/android/QtNativeInputConnection"; static char const *const QtExtractedTextClassName = "org/qtproject/qt5/android/QtExtractedText"; +static char const *const QtObjectType = "QDialog"; static jclass m_extractedTextClass = 0; static jmethodID m_classConstructorMethodID = 0; static jfieldID m_partialEndOffsetFieldID = 0; @@ -646,7 +647,7 @@ void QAndroidInputContext::updateSelectionHandles() } auto curRect = im->cursorRectangle(); - QPoint cursorPoint = qGuiApp->focusWindow()->mapToGlobal(QPoint(curRect.x() + (curRect.width() / 2), curRect.y() + curRect.height())); + QPoint cursorPoint(window->mapToGlobal(QPoint(curRect.x() + (curRect.width() / 2), curRect.y() + curRect.height()))); QPoint editMenuPoint(cursorPoint.x(), cursorPoint.y()); m_handleMode &= ShowEditPopup; m_handleMode |= ShowCursor; @@ -666,10 +667,12 @@ void QAndroidInputContext::updateSelectionHandles() if (cpos > anchor) std::swap(leftRect, rightRect); - QPoint leftPoint(leftRect.bottomLeft().toPoint() * pixelDensity); - QPoint righPoint(rightRect.bottomRight().toPoint() * pixelDensity); - QPoint editPoint(leftRect.united(rightRect).topLeft().toPoint() * pixelDensity); - QtAndroidInput::updateHandles(m_handleMode, editPoint, EditContext::AllButtons, leftPoint, righPoint, + QPoint leftPoint(window->mapToGlobal(leftRect.bottomLeft().toPoint())); + QPoint righPoint(window->mapToGlobal(rightRect.bottomRight().toPoint())); + QPoint editPoint(window->mapToGlobal(leftRect.united(rightRect) + .topLeft().toPoint())); + QtAndroidInput::updateHandles(m_handleMode, editPoint * pixelDensity, EditContext::AllButtons, + leftPoint * pixelDensity, righPoint * pixelDensity, query.value(Qt::ImCurrentSelection).toString().isRightToLeft()); m_hideCursorHandleTimer.stop(); } @@ -693,7 +696,17 @@ void QAndroidInputContext::handleLocationChanged(int handleId, int x, int y) double pixelDensity = window ? QHighDpiScaling::factor(window) : QHighDpiScaling::factor(QtAndroid::androidPlatformIntegration()->screen()); - QPointF point(x / pixelDensity, y / pixelDensity); + auto object = m_focusObject->parent(); + int dialogMoveX = 0; + while (object) { + if (QString::compare(object->metaObject()->className(), + QtObjectType, Qt::CaseInsensitive) == 0) { + dialogMoveX += object->property("x").toInt(); + } + object = object->parent(); + }; + + QPointF point((x / pixelDensity) - dialogMoveX, y / pixelDensity); point.setY(point.y() - leftRect.width() / 2); QInputMethodQueryEvent query(Qt::ImCursorPosition | Qt::ImAnchorPosition -- cgit v1.2.3 From 5a8f1cfab7e692367c4dddbcc6775864c5a4c246 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 13 Jan 2021 17:40:18 +0100 Subject: macOS: Don't override action set during drop handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the drop has been handled, the target might have accepted a specific action by calling QDropEvent::setDropAction. Don't override that with the operation received by the OS if the drag'n'drop operation takes place within the same application. If the operation comes from outside, we have no choice but to trust the OS. This way the drag-site will get the action accepted by the drop-site when QDrag::drag returns. Fixes: QTBUG-77427 Change-Id: I0e4c86adeeea66b345966a03a3251fa62263b3e8 Reviewed-by: Tor Arne Vestbø (cherry picked from commit a014300898bd3bd574ef19bba7123d4b5a07789b) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qnsview_dragging.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview_dragging.mm b/src/plugins/platforms/cocoa/qnsview_dragging.mm index 1d3820997c..0dab09e421 100644 --- a/src/plugins/platforms/cocoa/qnsview_dragging.mm +++ b/src/plugins/platforms/cocoa/qnsview_dragging.mm @@ -297,7 +297,9 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); Q_ASSERT(nativeDrag); nativeDrag->exitDragLoop(); - nativeDrag->setAcceptedAction(qt_mac_mapNSDragOperation(operation)); + // for internal drag'n'drop, don't override the action the drop event accepted + if (!nativeDrag->currentDrag()) + nativeDrag->setAcceptedAction(qt_mac_mapNSDragOperation(operation)); // Qt starts drag-and-drop on a mouse button press event. Cococa in // this case won't send the matching release event, so we have to -- cgit v1.2.3 From 8ce794b4a738e8f80681de237095d5c71a542546 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 18 May 2020 14:04:30 +0200 Subject: Windows: Update the hasFrame setting when changing window flags Since changing the window flags can make it frameless or have a frame then it should ensure that the hasFrame setting is updated accordingly when the window flags do. Change-Id: I7bf4995d7967623b117426d8750e63fa97967e2c Fixes: QTBUG-84029 Reviewed-by: Friedemann Kleint (cherry picked from commit 60ec350bc79d562c0611bc31e8655729272c31d6) Reviewed-by: Liang Qi --- src/plugins/platforms/windows/qwindowswindow.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 62825eb3f5..22551ba26e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -2156,6 +2156,7 @@ QWindowsWindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt, QWindowsWindowData result = m_data; result.flags = creationData.flags; result.embedded = creationData.embedded; + result.hasFrame = (creationData.style & (WS_DLGFRAME | WS_THICKFRAME)); return result; } -- cgit v1.2.3 From 6bbba5576c9477c61721bc4fbb761752d98c23d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Geh=C3=B6r?= Date: Thu, 25 Mar 2021 07:45:14 +0200 Subject: Android: Fix screen flicker issues When changing focus between TextInput fields there is a flicker of the QQuickWidget Fixes: QTBUG-66727 Change-Id: I9f31f43dee1bbbf213422978a35e752a8ceff56c Reviewed-by: Rami Potinkara --- src/plugins/platforms/android/androidjnimain.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 1578ec68b1..cf90eaacf0 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -644,11 +644,12 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, jint widthPixels, jint heightPixels, jint desktopWidthPixels, jint desktopHeightPixels, jdouble xdpi, jdouble ydpi, - jdouble scaledDensity, jdouble density) + jdouble scaledDensity, jdouble density, bool forceUpdate) { // Android does not give us the correct screen size for immersive mode, but // the surface does have the right size + bool updateDesktopSize = m_desktopWidthPixels != desktopWidthPixels; widthPixels = qMax(widthPixels, desktopWidthPixels); heightPixels = qMax(heightPixels, desktopHeightPixels); @@ -669,7 +670,9 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, m_androidPlatformIntegration->setDisplayMetrics(qRound(double(widthPixels) / xdpi * 25.4), qRound(double(heightPixels) / ydpi * 25.4)); m_androidPlatformIntegration->setScreenSize(widthPixels, heightPixels); - m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels); + if (updateDesktopSize || forceUpdate) { + m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels); + } } } @@ -795,7 +798,7 @@ static JNINativeMethod methods[] = { {"quitQtCoreApplication", "()V", (void *)quitQtCoreApplication}, {"terminateQt", "()V", (void *)terminateQt}, {"waitForServiceSetup", "()V", (void *)waitForServiceSetup}, - {"setDisplayMetrics", "(IIIIDDDD)V", (void *)setDisplayMetrics}, + {"setDisplayMetrics", "(IIIIDDDDZ)V", (void *)setDisplayMetrics}, {"setSurface", "(ILjava/lang/Object;II)V", (void *)setSurface}, {"updateWindow", "()V", (void *)updateWindow}, {"updateApplicationState", "(I)V", (void *)updateApplicationState}, -- cgit v1.2.3 From 68c016cf0925b700235c5780b50ed554428a2fdb Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Thu, 29 Apr 2021 13:46:15 +0200 Subject: QVnc: clip requested screen region to available screen image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Avoid potential oob memory access. Fixes: QTBUG-91770 Change-Id: I34fff1cf8dec5275572a027288b0e8310359d9f8 Reviewed-by: Tor Arne Vestbø Reviewed-by: Allan Sandfeld Jensen (cherry picked from commit c494c1e8754ed13b409133196d9db00bf7e0f2b5) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/vnc/qvnc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp index 4e7979d5c2..a6de472c8c 100644 --- a/src/plugins/platforms/vnc/qvnc.cpp +++ b/src/plugins/platforms/vnc/qvnc.cpp @@ -477,6 +477,9 @@ void QRfbRawEncoder::write() // server->screen()->geometry().height()); // } + const QImage screenImage = client->server()->screenImage(); + rgn &= screenImage.rect(); + const auto rectsInRegion = rgn.rectCount(); { @@ -492,8 +495,6 @@ void QRfbRawEncoder::write() if (rectsInRegion <= 0) return; - const QImage screenImage = client->server()->screenImage(); - for (const QRect &tileRect: rgn) { const QRfbRect rect(tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height()); -- cgit v1.2.3 From 8319b54b9ff895002483d61559d754e83780cf56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tama=CC=81s=20Martinec?= Date: Tue, 4 May 2021 13:49:18 +0300 Subject: iOS: Keep undo/redo widgets enabled on the undo shortcut bar after undo Having two undo/redo operations on the rebuilt undo stack always enables the undo/redo widgets on the shorcut bar. This might be more desirable than the current behavior that only allows one undo from the shortcut bar. Fixes: QTBUG-63393 Change-Id: I2c99f27895def47b58534035461ceb7b4e5c3057 Reviewed-by: Richard Moe Gustavsen (cherry picked from commit 3b155973c494e847b821f0b5675a061f4e424a6c) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/ios/qiostextresponder.mm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 4c841d9e08..09735c1a02 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -514,15 +514,23 @@ // from within a undo callback. NSUndoManager *undoMgr = self.undoManager; [undoMgr removeAllActions]; + + [undoMgr beginUndoGrouping]; + [undoMgr registerUndoWithTarget:self selector:@selector(undo) object:nil]; + [undoMgr endUndoGrouping]; [undoMgr beginUndoGrouping]; [undoMgr registerUndoWithTarget:self selector:@selector(undo) object:nil]; [undoMgr endUndoGrouping]; - // Schedule an operation that we immediately pop off to be able to schedule a redo + // Schedule operations that we immediately pop off to be able to schedule redos + [undoMgr beginUndoGrouping]; + [undoMgr registerUndoWithTarget:self selector:@selector(registerRedo) object:nil]; + [undoMgr endUndoGrouping]; [undoMgr beginUndoGrouping]; [undoMgr registerUndoWithTarget:self selector:@selector(registerRedo) object:nil]; [undoMgr endUndoGrouping]; [undoMgr undo]; + [undoMgr undo]; // Note that, perhaps because of a bug in UIKit, the buttons on the shortcuts bar ends up // disabled if a undo/redo callback doesn't lead to a [UITextInputDelegate textDidChange]. @@ -530,6 +538,11 @@ // become disabled when there is nothing more to undo (Qt didn't change anything upon receiving // an undo request). This seems to be OK behavior, so we let it stay like that unless it shows // to cause problems. + + // QTBUG-63393: Having two operations on the rebuilt undo stack keeps the undo/redo widgets + // always enabled on the shortcut bar. This workaround was found by experimenting with + // removing the removeAllActions call, and is related to the unknown internal implementation + // details of how the shortcut bar updates the dimming of its buttons. }); } -- cgit v1.2.3 From 2db6c0967b9522a95fbfc7b648ef90eba9e73676 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Tue, 11 May 2021 13:22:57 +0200 Subject: cocoa: be more careful about rejecting frame strut events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The m_buttons property is meant to hold the currently pressed mouse buttons done on the contents part of a QNSView. But m_buttons can sometimes get out of sync with AppKit (NSEvent.pressedMouseButtons). One way this is shown to happen is if you do a mouse press on a native child widget (that is backed by it's own QNSView), and then convert the widget to a top-level window before the release. In that case, the underlying QNSView will be reparented from one NSWindow to another, which will result in the old NSWindow getting the mouseUp call instead of the new window. The result is that we don't update m_buttons for the reparented QNSView, which will instead be left as "pressed". As a result of m_buttons being stuck in a faulty state, we also refuse to send out QEvent::NonClientAreaMouseMove events to the top-level widget. This because QNSView thinks that it's already in a dragging state that started on the content part of the view (and not on the strut). As a result, it can sometimes be impossible to dock a QDockWidget back into a QMainWindow, since we basically don't send out any frame-drag events to Qt for the new dock window. We can reason that if you start a mouse press on the frame strut, you cannot at the same time have an active mouse press on the view contents. This patch will therefore remove the buttons that we know was pressed on the frame strut from m_buttons. This will at least (be one way to) clear the faulty pressed state, and will let us send mouse press/drag/release (and after that, move) frame strut events to Qt. Task-number: QTBUG-70137 Change-Id: If51e1fe57d2531b659d39de85658893dae6391e3 Reviewed-by: Tor Arne Vestbø (cherry picked from commit 78b6050d60ba97ffb66e79bcde6ea306108e41dd) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qnsview_mouse.mm | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qnsview_mouse.mm b/src/plugins/platforms/cocoa/qnsview_mouse.mm index 9d33b933b0..3c98bcb3b7 100644 --- a/src/plugins/platforms/cocoa/qnsview_mouse.mm +++ b/src/plugins/platforms/cocoa/qnsview_mouse.mm @@ -103,21 +103,14 @@ if (!m_platformWindow) return; - // get m_buttons in sync - // Don't send frme strut events if we are in the middle of a mouse drag. - if (m_buttons != Qt::NoButton) - return; - switch (theEvent.type) { case NSEventTypeLeftMouseDown: - case NSEventTypeLeftMouseDragged: m_frameStrutButtons |= Qt::LeftButton; break; case NSEventTypeLeftMouseUp: m_frameStrutButtons &= ~Qt::LeftButton; break; case NSEventTypeRightMouseDown: - case NSEventTypeRightMouseDragged: m_frameStrutButtons |= Qt::RightButton; break; case NSEventTypeRightMouseUp: @@ -132,6 +125,22 @@ break; } + // m_buttons can sometimes get out of sync with the button state in AppKit + // E.g if the QNSView where a drag starts is reparented to another window + // while the drag is ongoing, it will not get the corresponding mouseUp + // call. This will result in m_buttons to be stuck on Qt::LeftButton. + // Since we know which buttons was pressed/released directly on the frame + // strut, we can rectify m_buttons here so that we at least don't return early + // from the drag test underneath because of the faulty m_buttons state. + // FIXME: get m_buttons in sync with AppKit/NSEvent all over in QNSView. + m_buttons &= ~m_frameStrutButtons; + + if (m_buttons != Qt::NoButton) { + // Don't send frame strut events if we are in the middle of + // a mouse drag that didn't start on the frame strut. + return; + } + NSWindow *window = [self window]; NSPoint windowPoint = [theEvent locationInWindow]; -- cgit v1.2.3 From f83ededa19ec1ce059c5c96d94c4a29ae7d1273e Mon Sep 17 00:00:00 2001 From: Aleksei Nikiforov Date: Tue, 3 Sep 2019 13:07:25 +0300 Subject: Qt xcb: remove false detects of Qt::GroupSwitchModifier In some cases, if X11 is configured with CapsLock as keyboard language switch key, and CapsLock is toggled via Shift+CapsLock key combination, toggled CapsLock is falsely detected as Qt::GroupSwitchModifier for subsequent key events. This change fixes this false detect, but doesn't fix detection of Qt::GroupSwitchModifier which is likely still broken. Fixes: QTBUG-49771 Change-Id: I485e2d4f3c654707c62adaba367c1b8afb3fc36c Reviewed-by: Liang Qi (cherry picked from commit 25a7034d78aeb12726a1052d64c0aa3314a1f69d) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index b2ce353ae9..73b36172de 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -60,11 +60,11 @@ Qt::KeyboardModifiers QXcbKeyboard::translateModifiers(int s) const ret |= Qt::ShiftModifier; if (s & XCB_MOD_MASK_CONTROL) ret |= Qt::ControlModifier; - if (s & rmod_masks.alt) + if ((s & rmod_masks.alt) == rmod_masks.alt) ret |= Qt::AltModifier; - if (s & rmod_masks.meta) + if ((s & rmod_masks.meta) == rmod_masks.meta) ret |= Qt::MetaModifier; - if (s & rmod_masks.altgr) + if ((s & rmod_masks.altgr) == rmod_masks.altgr) ret |= Qt::GroupSwitchModifier; return ret; } -- cgit v1.2.3 From 743f4c7ca3ec800bc29c44c6963d34e14e5fb324 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 7 May 2021 15:31:55 +0200 Subject: iOS: Accessibility: Set the correct traits for EditableText MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the correct accessibility traits for EditableText are not available as a direct enum value, then we depend on the defaults for a UITextField to give us this information. Done-with: Tor Arne Vestbø Fixes: QTBUG-93494 Change-Id: If428414aec5ce571f0f8c0ecccffdbaf1c908120 Reviewed-by: Morten Johan Sørvig (cherry picked from commit 08cd5580df382af5ddfe1c0c44bc9dd68e4cd1e7) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/ios/quiaccessibilityelement.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/quiaccessibilityelement.mm b/src/plugins/platforms/ios/quiaccessibilityelement.mm index 43b6e913fe..be3f713b98 100644 --- a/src/plugins/platforms/ios/quiaccessibilityelement.mm +++ b/src/plugins/platforms/ios/quiaccessibilityelement.mm @@ -158,8 +158,16 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacAccessibilityElement); if (state.searchEdit) traits |= UIAccessibilityTraitSearchField; - if (iface->role() == QAccessible::Button) + const auto accessibleRole = iface->role(); + if (accessibleRole == QAccessible::Button) { traits |= UIAccessibilityTraitButton; + } else if (accessibleRole == QAccessible::EditableText) { + static auto defaultTextFieldTraits = []{ + auto *textField = [[[UITextField alloc] initWithFrame:CGRectZero] autorelease]; + return textField.accessibilityTraits; + }(); + traits |= defaultTextFieldTraits; + } if (iface->valueInterface()) traits |= UIAccessibilityTraitAdjustable; -- cgit v1.2.3 From c5d381a5920379affe146957b6c2b9e80d5dccf4 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 7 May 2021 13:25:42 +0200 Subject: iOS: Accessibility: Don't cut off the last character from the text value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The second parameter is the position of the first character not to be returned when calling text(). So it needs to be passed the length of the text, otherwise the last character is cut off. Task-number: QTBUG-93494 Change-Id: I7dd8324b3939220de125ba819b7b77588b21bd4b Reviewed-by: Tor Arne Vestbø (cherry picked from commit 5c29f981fa069907678f961cf58ecefd64bf268b) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/ios/quiaccessibilityelement.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/ios/quiaccessibilityelement.mm b/src/plugins/platforms/ios/quiaccessibilityelement.mm index be3f713b98..d2792838c0 100644 --- a/src/plugins/platforms/ios/quiaccessibilityelement.mm +++ b/src/plugins/platforms/ios/quiaccessibilityelement.mm @@ -123,8 +123,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QMacAccessibilityElement); if (val) { return val->currentValue().toString().toNSString(); } else if (QAccessibleTextInterface *text = iface->textInterface()) { - // FIXME doesn't work? - return text->text(0, text->characterCount() - 1).toNSString(); + return text->text(0, text->characterCount()).toNSString(); } return [super accessibilityHint]; -- cgit v1.2.3 From b6a7c9b1bde0f70a08f4f03b9a8a4328e7f8abee Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Wed, 19 May 2021 12:46:16 +0200 Subject: QXcb: don't dereference pointer before checking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The virtualDesktop pointer is expected to be populated by queryPointer, but that method handles the case that there either is no reply, or that the reply doesn't match, in which case the pointer remains nullptr. Don't dereference it afterwards without checking. Addresses code checker warning a179d1087759bb6ca9c3380257bd70d6 Change-Id: I5877f26fd3b49327c0de3f2c918bb606bee8ac57 Reviewed-by: Tor Arne Vestbø (cherry picked from commit c2258e85a32b66cf7cbc59a4789e68c31c9955be) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/xcb/qxcbcursor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 4b877deb30..fd62dbf012 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -668,7 +668,8 @@ void QXcbCursor::setPos(const QPoint &pos) { QXcbVirtualDesktop *virtualDesktop = nullptr; queryPointer(connection(), &virtualDesktop, nullptr); - xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y()); + if (virtualDesktop) + xcb_warp_pointer(xcb_connection(), XCB_NONE, virtualDesktop->root(), 0, 0, 0, 0, pos.x(), pos.y()); xcb_flush(xcb_connection()); } -- cgit v1.2.3 From 82878f08e64aec460d4c45533c2e0f1bc485b3ac Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 25 May 2021 17:09:09 +0200 Subject: macOS: don't show invisible separator items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Give QCocoaMenu access to the item's visibility property by adding a public getter, and respect that state when syncing the separator to the corresponding QCocoaNSMenuItems. Fixes: QTBUG-88651 Change-Id: I7e238e5d3be141ec8f4e8f6f3ab22d761094d2d2 Reviewed-by: Tor Arne Vestbø Reviewed-by: Morten Johan Sørvig (cherry picked from commit a3f3af8a8fb8f8b09d1685df5ab836244f850a62) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qcocoamenu.mm | 10 +++++++--- src/plugins/platforms/cocoa/qcocoamenuitem.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 3e467fc361..943e271e9e 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -294,9 +294,13 @@ void QCocoaMenu::syncSeparatorsCollapsible(bool enable) for (NSMenuItem *item in m_nativeMenu.itemArray) { if (item.separatorItem) { - if (auto *cocoaItem = qt_objc_cast(item).platformMenuItem) - cocoaItem->setVisible(!previousIsSeparator); - item.hidden = previousIsSeparator; + // hide item if previous was a separator, or if it's explicitly hidden + bool itemVisible = !previousIsSeparator; + if (auto *cocoaItem = qt_objc_cast(item).platformMenuItem) { + cocoaItem->setVisible(!previousIsSeparator && cocoaItem->isVisible()); + itemVisible = cocoaItem->isVisible(); + } + item.hidden = !itemVisible; } if (!item.hidden) { diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h index 969f17fd07..16f135fe4a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.h +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h @@ -117,6 +117,7 @@ public: inline bool isMerged() const { return m_merged; } inline bool isEnabled() const { return m_enabled && m_parentEnabled; } inline bool isSeparator() const { return m_isSeparator; } + inline bool isVisible() const { return m_isVisible; } QCocoaMenu *menu() const { return m_menu; } MenuRole effectiveRole() const; -- cgit v1.2.3 From 0096d1545bc85dbd0556014d4fbbeba77d4fd5b4 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Thu, 27 May 2021 11:44:30 +0200 Subject: macOS: respect underline attribute in menu item fonts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When we draw menu item text with CoreText instead of QPainter, then we need to translate QFont::underline() explicitly to an entry in the attribute dictionary. Task-number: QTBUG-73990 Change-Id: I7e0c258f7cf80a89b29517fa8122576342654de1 Reviewed-by: Tor Arne Vestbø (cherry picked from commit 5ac479f5990a4c2b09ea34fb98d10c17d405aa5e) Reviewed-by: Qt Cherry-pick Bot --- 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 8c159e4107..22cf75f12b 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -4380,8 +4380,10 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // line-break the string if it doesn't fit the given rect. It's better to draw outside // the rect and possibly overlap something than to have part of the text disappear. [s.toNSString() drawAtPoint:CGPointMake(xpos, yPos) - withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c, - NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0]}]; + withAttributes:@{ NSFontAttributeName:f, NSForegroundColorAttributeName:c, + NSObliquenessAttributeName: [NSNumber numberWithDouble: myFont.italic() ? 0.3 : 0.0], + NSUnderlineStyleAttributeName: [NSNumber numberWithInt: myFont.underline() ? NSUnderlineStyleSingle + : NSUnderlineStyleNone]}]; d->restoreNSGraphicsContext(cgCtx); } else { -- cgit v1.2.3 From 1547ecba0d3f5caf7bda2a6d68724e4c982f9e75 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 6 May 2021 12:50:48 +1000 Subject: wasm: fix unicode keyboard handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can simplify and reduce the lookup table by casting to unicode for all printable keys. This means that non US/ASCII keyboards will have better support. Fixes: QTBUG-84494 Change-Id: I60aa6320cf1b5d82910ed77e136246d301bfc09a Reviewed-by: Morten Johan Sørvig (cherry picked from commit 7c233d4034237e268a513741ce69a0cd6ef47519) Reviewed-by: Qt Cherry-pick Bot --- .../platforms/wasm/qwasmeventtranslator.cpp | 154 ++------------------- 1 file changed, 9 insertions(+), 145 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp index c059227c89..e50662ec2c 100644 --- a/src/plugins/platforms/wasm/qwasmeventtranslator.cpp +++ b/src/plugins/platforms/wasm/qwasmeventtranslator.cpp @@ -136,139 +136,11 @@ static constexpr const auto KeyTbl = qMakeArray( Emkb2Qt< Qt::Key_F21, 'F','2','1' >, Emkb2Qt< Qt::Key_F22, 'F','2','2' >, Emkb2Qt< Qt::Key_F23, 'F','2','3' >, - Emkb2Qt< Qt::Key_Space, ' ' >, - Emkb2Qt< Qt::Key_Comma, ',' >, - Emkb2Qt< Qt::Key_Minus, '-' >, - Emkb2Qt< Qt::Key_Period, '.' >, - Emkb2Qt< Qt::Key_Slash, '/' >, - Emkb2Qt< Qt::Key_0, 'D','i','g','i','t','0' >, - Emkb2Qt< Qt::Key_1, 'D','i','g','i','t','1' >, - Emkb2Qt< Qt::Key_2, 'D','i','g','i','t','2' >, - Emkb2Qt< Qt::Key_3, 'D','i','g','i','t','3' >, - Emkb2Qt< Qt::Key_4, 'D','i','g','i','t','4' >, - Emkb2Qt< Qt::Key_5, 'D','i','g','i','t','5' >, - Emkb2Qt< Qt::Key_6, 'D','i','g','i','t','6' >, - Emkb2Qt< Qt::Key_7, 'D','i','g','i','t','7' >, - Emkb2Qt< Qt::Key_8, 'D','i','g','i','t','8' >, - Emkb2Qt< Qt::Key_9, 'D','i','g','i','t','9' >, - Emkb2Qt< Qt::Key_Semicolon, ';' >, - Emkb2Qt< Qt::Key_Equal, '=' >, - Emkb2Qt< Qt::Key_A, 'K','e','y','A' >, - Emkb2Qt< Qt::Key_B, 'K','e','y','B' >, - Emkb2Qt< Qt::Key_C, 'K','e','y','C' >, - Emkb2Qt< Qt::Key_D, 'K','e','y','D' >, - Emkb2Qt< Qt::Key_E, 'K','e','y','E' >, - Emkb2Qt< Qt::Key_F, 'K','e','y','F' >, - Emkb2Qt< Qt::Key_G, 'K','e','y','G' >, - Emkb2Qt< Qt::Key_H, 'K','e','y','H' >, - Emkb2Qt< Qt::Key_I, 'K','e','y','I' >, - Emkb2Qt< Qt::Key_J, 'K','e','y','J' >, - Emkb2Qt< Qt::Key_K, 'K','e','y','K' >, - Emkb2Qt< Qt::Key_L, 'K','e','y','L' >, - Emkb2Qt< Qt::Key_M, 'K','e','y','M' >, - Emkb2Qt< Qt::Key_N, 'K','e','y','N' >, - Emkb2Qt< Qt::Key_O, 'K','e','y','O' >, - Emkb2Qt< Qt::Key_P, 'K','e','y','P' >, - Emkb2Qt< Qt::Key_Q, 'K','e','y','Q' >, - Emkb2Qt< Qt::Key_R, 'K','e','y','R' >, - Emkb2Qt< Qt::Key_S, 'K','e','y','S' >, - Emkb2Qt< Qt::Key_T, 'K','e','y','T' >, - Emkb2Qt< Qt::Key_U, 'K','e','y','U' >, - Emkb2Qt< Qt::Key_V, 'K','e','y','V' >, - Emkb2Qt< Qt::Key_W, 'K','e','y','W' >, - Emkb2Qt< Qt::Key_X, 'K','e','y','X' >, - Emkb2Qt< Qt::Key_Y, 'K','e','y','Y' >, - Emkb2Qt< Qt::Key_Z, 'K','e','y','Z' >, - Emkb2Qt< Qt::Key_BracketLeft, '[' >, - Emkb2Qt< Qt::Key_Backslash, '\\' >, - Emkb2Qt< Qt::Key_BracketRight, ']' >, - Emkb2Qt< Qt::Key_Apostrophe, '\'' >, - Emkb2Qt< Qt::Key_QuoteLeft, 'B','a','c','k','q','u','o','t','e' >, - Emkb2Qt< Qt::Key_multiply, 'N','u','m','p','a','d','M','u','l','t','i','p','l','y' >, - Emkb2Qt< Qt::Key_Minus, 'N','u','m','p','a','d','S','u','b','t','r','a','c','t' >, - Emkb2Qt< Qt::Key_Period, 'N','u','m','p','a','d','D','e','c','i','m','a','l' >, - Emkb2Qt< Qt::Key_Plus, 'N','u','m','p','a','d','A','d','d' >, - Emkb2Qt< Qt::Key_division, 'N','u','m','p','a','d','D','i','v','i','d','e' >, - Emkb2Qt< Qt::Key_Equal, 'N','u','m','p','a','d','E','q','u','a','l' >, - Emkb2Qt< Qt::Key_0, 'N','u','m','p','a','d','0' >, - Emkb2Qt< Qt::Key_1, 'N','u','m','p','a','d','1' >, - Emkb2Qt< Qt::Key_2, 'N','u','m','p','a','d','2' >, - Emkb2Qt< Qt::Key_3, 'N','u','m','p','a','d','3' >, - Emkb2Qt< Qt::Key_4, 'N','u','m','p','a','d','4' >, - Emkb2Qt< Qt::Key_5, 'N','u','m','p','a','d','5' >, - Emkb2Qt< Qt::Key_6, 'N','u','m','p','a','d','6' >, - Emkb2Qt< Qt::Key_7, 'N','u','m','p','a','d','7' >, - Emkb2Qt< Qt::Key_8, 'N','u','m','p','a','d','8' >, - Emkb2Qt< Qt::Key_9, 'N','u','m','p','a','d','9' >, - Emkb2Qt< Qt::Key_Comma, 'N','u','m','p','a','d','C','o','m','m','a' >, - Emkb2Qt< Qt::Key_Enter, 'N','u','m','p','a','d','E','n','t','e','r' >, Emkb2Qt< Qt::Key_Paste, 'P','a','s','t','e' >, Emkb2Qt< Qt::Key_AltGr, 'A','l','t','R','i','g','h','t' >, Emkb2Qt< Qt::Key_Help, 'H','e','l','p' >, - Emkb2Qt< Qt::Key_Equal, '=' >, Emkb2Qt< Qt::Key_yen, 'I','n','t','l','Y','e','n' >, - - Emkb2Qt< Qt::Key_Exclam, '\x21' >, - Emkb2Qt< Qt::Key_QuoteDbl, '\x22' >, - Emkb2Qt< Qt::Key_NumberSign, '\x23' >, - Emkb2Qt< Qt::Key_Dollar, '\x24' >, - Emkb2Qt< Qt::Key_Percent, '\x25' >, - Emkb2Qt< Qt::Key_Ampersand, '\x26' >, - Emkb2Qt< Qt::Key_ParenLeft, '\x28' >, - Emkb2Qt< Qt::Key_ParenRight, '\x29' >, - Emkb2Qt< Qt::Key_Asterisk, '\x2a' >, - Emkb2Qt< Qt::Key_Plus, '\x2b' >, - Emkb2Qt< Qt::Key_Colon, '\x3a' >, - Emkb2Qt< Qt::Key_Semicolon, '\x3b' >, - Emkb2Qt< Qt::Key_Less, '\x3c' >, - Emkb2Qt< Qt::Key_Equal, '\x3d' >, - Emkb2Qt< Qt::Key_Greater, '\x3e' >, - Emkb2Qt< Qt::Key_Question, '\x3f' >, - Emkb2Qt< Qt::Key_At, '\x40' >, - Emkb2Qt< Qt::Key_BracketLeft, '\x5b' >, - Emkb2Qt< Qt::Key_Backslash, '\x5c' >, - Emkb2Qt< Qt::Key_BracketRight, '\x5d' >, - Emkb2Qt< Qt::Key_AsciiCircum, '\x5e' >, - Emkb2Qt< Qt::Key_Underscore, '\x5f' >, - Emkb2Qt< Qt::Key_QuoteLeft, '\x60'>, - Emkb2Qt< Qt::Key_BraceLeft, '\x7b'>, - Emkb2Qt< Qt::Key_Bar, '\x7c'>, - Emkb2Qt< Qt::Key_BraceRight, '\x7d'>, - Emkb2Qt< Qt::Key_AsciiTilde, '\x7e'>, - Emkb2Qt< Qt::Key_Space, '\x20' >, - Emkb2Qt< Qt::Key_Comma, '\x2c' >, - Emkb2Qt< Qt::Key_Minus, '\x2d' >, - Emkb2Qt< Qt::Key_Period, '\x2e' >, - Emkb2Qt< Qt::Key_Slash, '\x2f' >, - Emkb2Qt< Qt::Key_Apostrophe, '\x27' >, - Emkb2Qt< Qt::Key_Menu, 'C','o','n','t','e','x','t','M','e','n','u' >, - - Emkb2Qt< Qt::Key_Agrave, '\xc3','\xa0' >, - Emkb2Qt< Qt::Key_Aacute, '\xc3','\xa1' >, - Emkb2Qt< Qt::Key_Acircumflex, '\xc3','\xa2' >, - Emkb2Qt< Qt::Key_Adiaeresis, '\xc3','\xa4' >, - Emkb2Qt< Qt::Key_AE, '\xc3','\xa6' >, - Emkb2Qt< Qt::Key_Atilde, '\xc3','\xa3' >, - Emkb2Qt< Qt::Key_Aring, '\xc3','\xa5' >, - Emkb2Qt< Qt::Key_Ccedilla, '\xc3','\xa7' >, - Emkb2Qt< Qt::Key_Egrave, '\xc3','\xa8' >, - Emkb2Qt< Qt::Key_Eacute, '\xc3','\xa9' >, - Emkb2Qt< Qt::Key_Ecircumflex, '\xc3','\xaa' >, - Emkb2Qt< Qt::Key_Ediaeresis, '\xc3','\xab' >, - Emkb2Qt< Qt::Key_Icircumflex, '\xc3','\xae' >, - Emkb2Qt< Qt::Key_Idiaeresis, '\xc3','\xaf' >, - Emkb2Qt< Qt::Key_Ocircumflex, '\xc3','\xb4' >, - Emkb2Qt< Qt::Key_Odiaeresis, '\xc3','\xb6' >, - Emkb2Qt< Qt::Key_Ograve, '\xc3','\xb2' >, - Emkb2Qt< Qt::Key_Oacute, '\xc3','\xb3' >, - Emkb2Qt< Qt::Key_Ooblique, '\xc3','\xb8' >, - Emkb2Qt< Qt::Key_Otilde, '\xc3','\xb5' >, - Emkb2Qt< Qt::Key_Ucircumflex, '\xc3','\xbb' >, - Emkb2Qt< Qt::Key_Udiaeresis, '\xc3','\xbc' >, - Emkb2Qt< Qt::Key_Ugrave, '\xc3','\xb9' >, - Emkb2Qt< Qt::Key_Uacute, '\xc3','\xba' >, - Emkb2Qt< Qt::Key_Ntilde, '\xc3','\xb1' >, - Emkb2Qt< Qt::Key_ydiaeresis, '\xc3','\xbf' > + Emkb2Qt< Qt::Key_Menu, 'C','o','n','t','e','x','t','M','e','n','u' > >::Data{} ); @@ -469,29 +341,21 @@ Qt::Key QWasmEventTranslator::translateEmscriptKey(const EmscriptenKeyboardEvent if (it1 != KeyTbl.end() && (qstrcmp(searchKey1.em, it1->em) == 0)) { qtKey = static_cast(it1->qt); } - - } else if (qstrncmp(emscriptKey->code, "Key", 3) == 0 || qstrncmp(emscriptKey->code, "Numpad", 6) == 0 || - qstrncmp(emscriptKey->code, "Digit", 5) == 0) { - emkb2qt_t searchKey{emscriptKey->code, 0}; // search emcsripten code - auto it1 = std::lower_bound(KeyTbl.cbegin(), KeyTbl.cend(), searchKey); - if (it1 != KeyTbl.end() && !(searchKey < *it1)) { - qtKey = static_cast(it1->qt); - } } - if (qtKey == Qt::Key_unknown) { - emkb2qt_t searchKey{emscriptKey->key, 0}; // search unicode key + emkb2qt_t searchKey{emscriptKey->key, 0}; + // search key auto it1 = std::lower_bound(KeyTbl.cbegin(), KeyTbl.cend(), searchKey); if (it1 != KeyTbl.end() && !(searchKey < *it1)) { qtKey = static_cast(it1->qt); } } - if (qtKey == Qt::Key_unknown) {//try harder with shifted number keys - emkb2qt_t searchKey1{emscriptKey->key, 0}; - for (auto it1 = KeyTbl.cbegin(); it1 != KeyTbl.end(); ++it1) - if (it1 != KeyTbl.end() && (qstrcmp(searchKey1.em, it1->em) == 0)) { - qtKey = static_cast(it1->qt); - } + + if (qtKey == Qt::Key_unknown) { + // cast to unicode key + QString str = QString::fromUtf8(emscriptKey->key); + ushort c = str.unicode()->toUpper().unicode(); // uppercase + qtKey = static_cast(c); } return qtKey; -- cgit v1.2.3 From 8fc1a885d19a2dfb1a3a684aea1cfa41967e041f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pekka=20Geh=C3=B6r?= Date: Sun, 4 Apr 2021 09:59:41 +0200 Subject: Android: Fix Application becomes unresponsive issue Block key events until the plugin is running. Fixes: QTBUG-67944 Pick-to: 5.15 Change-Id: Iea47f2e94d850141834a7e8fc26218be2cacf660 Reviewed-by: Assam Boudjelthia (cherry picked from commit 2262a9cd2d135d5ea2ade42460496c88d8b2c292) --- src/plugins/platforms/android/androidjnimain.cpp | 5 +++++ src/plugins/platforms/android/androidjnimain.h | 1 + src/plugins/platforms/android/qandroidplatformintegration.cpp | 5 +++++ 3 files changed, 11 insertions(+) (limited to 'src/plugins') diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index cf90eaacf0..be8717db0a 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -238,6 +238,11 @@ namespace QtAndroid QJNIObjectPrivate::callStaticMethod(m_applicationClass, "notifyObjectFocus","(I)V", accessibilityObjectId); } + void notifyQtAndroidPluginRunning(bool running) + { + QJNIObjectPrivate::callStaticMethod(m_applicationClass, "notifyQtAndroidPluginRunning","(Z)V", running); + } + jobject createBitmap(QImage img, JNIEnv *env) { if (!m_bitmapClass) diff --git a/src/plugins/platforms/android/androidjnimain.h b/src/plugins/platforms/android/androidjnimain.h index 2e3b0b368e..fd02bfeab6 100644 --- a/src/plugins/platforms/android/androidjnimain.h +++ b/src/plugins/platforms/android/androidjnimain.h @@ -98,6 +98,7 @@ namespace QtAndroid void notifyAccessibilityLocationChange(); void notifyObjectHide(uint accessibilityObjectId); void notifyObjectFocus(uint accessibilityObjectId); + void notifyQtAndroidPluginRunning(bool running); const char *classErrorMsgFmt(); const char *methodErrorMsgFmt(); diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index bf73ff2f98..f137db28dd 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -90,6 +90,7 @@ Qt::ScreenOrientation QAndroidPlatformIntegration::m_orientation = Qt::PrimaryOr Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::PrimaryOrientation; bool QAndroidPlatformIntegration::m_showPasswordEnabled = false; +static bool m_running = false; void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { @@ -158,6 +159,10 @@ void QAndroidPlatformNativeInterface::customEvent(QEvent *event) api->accessibility()->setActive(QtAndroidAccessibility::isActive()); #endif // QT_NO_ACCESSIBILITY + if (!m_running) { + m_running = true; + QtAndroid::notifyQtAndroidPluginRunning(m_running); + } api->flushPendingUpdates(); } -- cgit v1.2.3