[Libreoffice-commits] core.git: vcl/qt5 vcl/README.vars.md vcl/skia vcl/unx
vcl/README.vars.md |2 ++ vcl/qt5/QtGraphics_Text.cxx |3 ++- vcl/skia/x11/textrender.cxx |4 +++- vcl/unx/generic/gdi/cairotextrender.cxx |3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) New commits: commit 9137bd2dd3ab66ffa783fc15a1add1e9cf541460 Author: Frank Steiner AuthorDate: Thu Nov 23 14:31:10 2023 +0100 Commit: Caolán McNamara CommitDate: Fri Nov 24 09:45:29 2023 +0100 enable using medium/full font hinting even with subpixel positioning Change-Id: I1be0670d59163070dccf035ec9c7b0cd4f818c69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159766 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/vcl/README.vars.md b/vcl/README.vars.md index fd92541a1e11..92931b51f170 100644 --- a/vcl/README.vars.md +++ b/vcl/README.vars.md @@ -15,6 +15,8 @@ These are the general environment variables used in the VCL: * `SAL_NON_APPLICATION_FONT_USE` - control use of non-bundled fonts, values are `deny` or `abort`; for now only works on platforms using fontconfig (i.e., on Linux, but neither on macOS nor on Windows); also see gb_CppunitTest_set_non_application_font_use for using it in unit tests +* `SAL_ALLOW_DEFAULT_HINTING` - use default font hinting for the platform. Enables medium/full hinting + style which is otherwise reverted to (s)light. * `LO_COLLECT_UIINFO` - enable the uitesting logging, value is expected to be a relative file name that will be used to write the log under `instdir/uitest/`. diff --git a/vcl/qt5/QtGraphics_Text.cxx b/vcl/qt5/QtGraphics_Text.cxx index c7486da26d2e..19837d510f13 100644 --- a/vcl/qt5/QtGraphics_Text.cxx +++ b/vcl/qt5/QtGraphics_Text.cxx @@ -160,8 +160,9 @@ std::unique_ptr QtGraphics::GetTextLayout(int nFallbackLevel) static QRawFont GetRawFont(const QFont& rFont, bool bWithoutHintingInTextDirection) { QFont::HintingPreference eHinting = rFont.hintingPreference(); +static bool bAllowDefaultHinting = getenv("SAL_ALLOW_DEFAULT_HINTING") != nullptr; bool bAllowedHintStyle -= !bWithoutHintingInTextDirection += !bWithoutHintingInTextDirection || bAllowDefaultHinting || (eHinting == QFont::PreferNoHinting || eHinting == QFont::PreferVerticalHinting); if (bWithoutHintingInTextDirection && !bAllowedHintStyle) { diff --git a/vcl/skia/x11/textrender.cxx b/vcl/skia/x11/textrender.cxx index b4083636d2a0..acc930e070e5 100644 --- a/vcl/skia/x11/textrender.cxx +++ b/vcl/skia/x11/textrender.cxx @@ -81,8 +81,10 @@ void SkiaTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGr font.setSubpixel(true); SkFontHinting eHinting = font.getHinting(); +static bool bAllowDefaultHinting = getenv("SAL_ALLOW_DEFAULT_HINTING") != nullptr; bool bAllowedHintStyle -= eHinting == SkFontHinting::kNone || eHinting == SkFontHinting::kSlight; += bAllowDefaultHinting + || (eHinting == SkFontHinting::kNone || eHinting == SkFontHinting::kSlight); if (!bAllowedHintStyle) font.setHinting(SkFontHinting::kSlight); } diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index 9b998066954b..7e7ce9ca700f 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -418,12 +418,13 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); const bool bDisableAA = !rStyleSettings.GetUseFontAAFromSystem() && !rGraphics.getAntiAlias(); +static bool bAllowDefaultHinting = getenv("SAL_ALLOW_DEFAULT_HINTING") != nullptr; const cairo_font_options_t* pFontOptions = GetSalInstance()->GetCairoFontOptions(); if (pFontOptions || bDisableAA || bSubpixelPositioning) { cairo_hint_style_t eHintStyle = pFontOptions ? cairo_font_options_get_hint_style(pFontOptions) : CAIRO_HINT_STYLE_DEFAULT; -bool bAllowedHintStyle = !bSubpixelPositioning || (eHintStyle == CAIRO_HINT_STYLE_NONE || eHintStyle == CAIRO_HINT_STYLE_SLIGHT); +bool bAllowedHintStyle = !bSubpixelPositioning || bAllowDefaultHinting || (eHintStyle == CAIRO_HINT_STYLE_NONE || eHintStyle == CAIRO_HINT_STYLE_SLIGHT); if (bDisableAA || !bAllowedHintStyle || bSubpixelPositioning) {
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit a182f283dabf5753e857a66386ef32226be47f49 Author: Michael Weghorn AuthorDate: Mon Nov 6 16:16:24 2023 +0100 Commit: Michael Weghorn CommitDate: Tue Nov 7 07:58:28 2023 +0100 qt a11y: Map AccessibleStateType::INDETERMINATE to Qt equivalent `QAccessible::State` has a `checkStateMixed` state flag [1] that matches what `AccessibleStateType::INDETERMINATE` is for, and Qt's AT-SPI adapter maps that to the AT-SPI equivalent, `ATSPI_STATE_INDETERMINATE`, so add the corresponding mapping. [1] https://doc.qt.io/qt-6/qaccessible-state.html [2] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/qspi_constant_mappings.cpp?id=c5d9e4a7a78b82ed31e5225c169de4718dfe4f05#n41 Change-Id: Ic16f50344040f3d4ff7ad4ef0002abf5a7ae3dcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159004 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index cbd750a4da38..47eb08b7e8c7 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -606,7 +606,7 @@ void lcl_addState(QAccessible::State* state, sal_Int64 nState) // No match break; case AccessibleStateType::INDETERMINATE: -// No match +state->checkStateMixed = true; break; case AccessibleStateType::MANAGES_DESCENDANTS: // No match
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 66fa5aeec5dbeba978f70fe464fbc87c3aba8ed2 Author: Michael Weghorn AuthorDate: Mon Nov 6 11:06:16 2023 +0100 Commit: Michael Weghorn CommitDate: Tue Nov 7 07:57:58 2023 +0100 qt a11y: Set passwordEdit state for PASSWORD_TEXT The Qt API doesn't have a separate role to distinguish password edits from other text edits, but has a `passwordEdit` state. Set that state for objects that have role `AccessibleRole::PASSWORD_TEXT`. With this in place, password entries, e.g. the one in the "Tools" -> "Options" -> "Security" -> "Password for Web Connections" -> "Master Password" dialog, are exposed via the `ATSPI_ROLE_PASSWORD_TEXT` role with the qt6 VCL plugin on Linux, because Qt's AT-SPI adapter takes the `passwordEdit` state into account when mapping the Qt a11y roles to AT-SPI ones. [1] [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=c5d9e4a7a78b82ed31e5225c169de4718dfe4f05#n1637 Change-Id: Icb3f0935e703e2786c5704007cad7eea9070f8a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158987 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index cba67bc60cc8..cbd750a4da38 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -465,6 +465,8 @@ QAccessible::Role QtAccessibleWidget::role() const case AccessibleRole::BLOCK_QUOTE: return QAccessible::Paragraph; case AccessibleRole::PASSWORD_TEXT: +// Qt API doesn't have a separate role to distinguish password edits, +// but a 'passwordEdit' state return QAccessible::EditableText; case AccessibleRole::POPUP_MENU: return QAccessible::PopupMenu; @@ -687,6 +689,9 @@ QAccessible::State QtAccessibleWidget::state() const lcl_addState(&state, nState); } +if (xAc->getAccessibleRole() == AccessibleRole::PASSWORD_TEXT) +state.passwordEdit = true; + return state; }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) New commits: commit d2daaedf2e3b30ff28f4a9a33b6b70738273f9e3 Author: Michael Weghorn AuthorDate: Tue Oct 24 12:01:05 2023 +0200 Commit: Michael Weghorn CommitDate: Tue Oct 24 14:55:24 2023 +0200 qt a11y: Take current type into account when setting new value As the `XAccessibleValue` documentation [1] describes, the underlying implementations can used different types of numerical values. Qt's `QAccessibleValueInterface` uses `QVariant`, so could in theory also support different numerical types. The AT-SPI Value interface however always uses double. [2] So far, `QtAccessibleWidget::setCurrentValue` was also always extracting a double value from the `QVariant` param and creating an `Any` from that. This however would result in any `XAccessibleValue::setCurrentValue` implementations assuming to be passed an integer would fail to extract a proper new value from the Any. As an example, selecting a currently checked checkbox (e.g. the "Automatic" checkbox in Writer's "Paragraph" formatting dialog, "Indents & Spacing" tab) in Accerciser's treeview of LO's a11y hierarchy woul result in the checkbox to be unchecked, because Accerciser reads the current and then sets the same value again when selecting an item with its "Interface View" tab active. Prevent that from happening by passing a `sal_Int32`/`sal_Int64` value again if the current value is also using that type. [1] offapi/com/sun/star/accessibility/XAccessibleValue.idl [2] https://gitlab.gnome.org/GNOME/at-spi2-core/-/blob/7cc4cee53ddbd22631fd110f0e5ce045dec2e411/xml/Value.xml Change-Id: I8674fc37798491fd0b57543acb491edbd4a5a056 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158380 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 3407eb574d5c..cec049340f07 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -1282,7 +1282,17 @@ void QtAccessibleWidget::setCurrentValue(const QVariant& value) Reference xValue(xAc, UNO_QUERY); if (!xValue.is()) return; -xValue->setCurrentValue(Any(value.toDouble())); + +// Different types of numerical values for XAccessibleValue are possible. +// If current value has an integer type, also use that for the new value, to make +// sure underlying implementations expecting that can handle the value properly. +const Any aCurrentValue = xValue->getCurrentValue(); +if (aCurrentValue.getValueTypeClass() == css::uno::TypeClass::TypeClass_LONG) +xValue->setCurrentValue(Any(static_cast(value.toInt(; +else if (aCurrentValue.getValueTypeClass() == css::uno::TypeClass::TypeClass_HYPER) + xValue->setCurrentValue(Any(static_cast(value.toLongLong(; +else +xValue->setCurrentValue(Any(value.toDouble())); } // QAccessibleTableInterface
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit 0d293754a9d87afeff399af3559a1e95239d1ac5 Author: Christian Lohmaier AuthorDate: Sat Oct 21 15:15:31 2023 +0200 Commit: Christian Lohmaier CommitDate: Mon Oct 23 19:16:28 2023 +0200 fix wasm build (int vs sal_Int32 mismatch) error: non-const lvalue reference to type 'sal_Int32' (aka 'long') cannot bind to a value of unrelated type 'int' in file /home/tdf/jenkins/workspace/lo_gerrit/tb/src_wasm/vcl/qt5/QtAccessibleWidget.cxx (since refactoring in 15a6e23c4fc160c50a316da3d18980a02fc10ce8 ) Change-Id: I2689701839ba18b5cffae13afcaa5b1a32b5e4b9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158305 Reviewed-by: Michael Weghorn Tested-by: Jenkins diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 83a50b0a39b6..3407eb574d5c 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -885,9 +885,13 @@ QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOff // Qt doesn't have the strict separation into text and object attributes, but also // supports text-specific attributes that are object attributes according to the // IAccessible2 spec. +sal_Int32 nStart = 0; +sal_Int32 nEnd = 0; const OUString aRet = AccessibleTextAttributeHelper::GetIAccessible2TextAttributes( -xText, IA2AttributeType::TextAttributes | IA2AttributeType::ObjectAttributes, offset, -*startOffset, *endOffset); +xText, IA2AttributeType::TextAttributes | IA2AttributeType::ObjectAttributes, +static_cast(offset), nStart, nEnd); +*startOffset = static_cast(nStart); +*endOffset = static_cast(nEnd); return toQString(aRet); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8ee5b9ae2100671601c7152a201e51bfb3efa028 Author: Andrea Gelmini AuthorDate: Sun Oct 22 03:33:06 2023 +0200 Commit: Julien Nabet CommitDate: Sun Oct 22 13:03:49 2023 +0200 Fix typo Change-Id: Iae66bf4a14fd3cdcc8c735832cd6cdc8f73b21ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158317 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index b1b8f4574c78..83a50b0a39b6 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -883,7 +883,7 @@ QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOff } // Qt doesn't have the strict separation into text and object attributes, but also -// suppports text-specific attributes that are object attributes according to the +// supports text-specific attributes that are object attributes according to the // IAccessible2 spec. const OUString aRet = AccessibleTextAttributeHelper::GetIAccessible2TextAttributes( xText, IA2AttributeType::TextAttributes | IA2AttributeType::ObjectAttributes, offset,
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) New commits: commit be8b031d8b3c66b223ea2478f1129427f3a362bd Author: Michael Weghorn AuthorDate: Thu Sep 7 09:51:38 2023 +0200 Commit: Michael Weghorn CommitDate: Thu Sep 7 13:24:08 2023 +0200 qt a11y: Forward CHILD event for removed child No longer comment out the code to send a `QAccessible::ObjectDestroyed` event when receiving an `AccessibleEventId::CHILD` event with its `OldValue` set. The underlying issues causing crashes previously seem to be fixed, I can no longer reproduce these on Debian testing with Orca 44.1-2 when using the font color popup as described in commit 734d10ed3612d75edcee145475ddd0b0165efeac Author: Michael Weghorn Date: Fri Apr 14 16:57:09 2023 +0300 qt a11y: Send QAccessible::ObjectCreated event for correct object > Adapting this for the case where a child has > been removed (bridged to Qt as `QAccessible::ObjectDestroyed` > event) would currently results in crashes when closing the > application e.g. after using the character font color popup in > the Writer toolbar. This needs further investigation, so don't > send the event for now, but add a `SAL_WARN`. Change-Id: Ib8f21850dd56645cf64a74be0e1ff8242615b928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156647 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 951286a6c1c1..c5d64d4650ed 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -216,16 +216,8 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible } if (aEvent.OldValue >>= xChild) { -// Forwarding as QAccessible::ObjectDestroyed event currently results in crashes on close -// e.g. after using the character font color popup in the Writer toolbar, which -// needs further investigation, so don't send the event for now. -/* -QAccessible::updateAccessibility( -new QAccessibleEvent(QtAccessibleRegistry::getQObject(xChild), QAccessible::ObjectDestroyed)); -*/ -SAL_WARN("vcl.qt", - "Not forwarding AccessibleEventId::CHILD event for removed child " - "since it may cause crashes."); +QAccessible::updateAccessibility(new QAccessibleEvent( +QtAccessibleRegistry::getQObject(xChild), QAccessible::ObjectDestroyed)); return; } SAL_WARN("vcl.qt",
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx | 42 ++ 1 file changed, 26 insertions(+), 16 deletions(-) New commits: commit 4f60660bca1796184a4fe079b5ecdd562a36aa32 Author: Michael Weghorn AuthorDate: Fri Sep 1 17:50:19 2023 +0200 Commit: Michael Weghorn CommitDate: Fri Sep 1 20:29:02 2023 +0200 qt: Set window title etc. in main thread These QWidget methods need to be called in the main thread. Otherwise, opening the Update dialog ("Help" -> "Check for Updates", enabled by `--enable-online-update` autogen switch) triggers asserts like the one below with a self-compiled Qt 6 development build (qtbase dev branch as of c802a9e987c9e38c01580f467eab92a651b3e033). ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff780160e0. Receiver '' (of type 'QtWidget') was created in thread 0x0x555fcd30", file /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp, line 537 Thread 40 "InitUpdateCheck" received signal SIGABRT, Aborted. [Switching to Thread 0x7fff76c0 (LWP 1516868)] __pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 44 ./nptl/pthread_kill.c: No such file or directory. (gdb) bt #0 __pthread_kill_implementation (threadid=, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 #1 0x778a815f in __pthread_kill_internal (signo=6, threadid=) at ./nptl/pthread_kill.c:78 #2 0x7785a472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x778444b2 in __GI_abort () at ./stdlib/abort.c:79 #4 0x7fffe32eb45a in qAbort() () at /home/michi/development/git/qt5/qtbase/src/corelib/global/qglobal.cpp:161 #5 0x7fffe32f9ee5 in qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) (context=..., message=...) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:2057 #6 0x7fffe32f620c in QMessageLogger::fatal(char const*, ...) const (this=0x7fff7fffb980, msg=0x7fffe37fd9a0 "ASSERT failure in %s: \"%s\", file %s, line %d") at /home/michi/development/git/qt5/qtbase/src/corelib/global/qlogging.cpp:938 #7 0x7fffe32e9d54 in qt_assert_x(char const*, char const*, char const*, int) (where=0x7fffe38131e9 "QCoreApplication::sendEvent", what=0x7fff78180110 "Cannot send events to objects owned by a different thread. Current thread 0x0x7fff780160e0. Receiver '' (of type 'QtWidget') was created in thread 0x0x555fcd30", file=0x7fffe3812e18 "/home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp", line=537) at /home/michi/development/git/qt5/qtbase/src/corelib/global/qassert.cpp:77 #8 0x7fffe33a4d74 in QCoreApplicationPrivate::checkReceiverThread(QObject*) (receiver=0x5d27d5d0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:537 #9 0x7fffe19a3a81 in QApplication::notify(QObject*, QEvent*) (this=0x555fcb80, receiver=0x5d27d5d0, e=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qapplication.cpp:2584 #10 0x7fffe33a5ed0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x5d27d5d0, event=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1125 #11 0x7fffe33a6991 in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=0x5d27d5d0, event=0x7fff7fffc0b0) at /home/michi/development/git/qt5/qtbase/src/corelib/kernel/qcoreapplication.cpp:1559 #12 0x7fffe1a279b4 in QWidget::setWindowTitle(QString const&) (this=0x5d27d5d0, title=...) at /home/michi/development/git/qt5/qtbase/src/widgets/kernel/qwidget.cpp:6119 #13 0x7fffe3c9d4c4 in QtFrame::SetTitle(rtl::OUString const&) (this=0x55619d20, rTitle="Check for Updates") at /home/michi/development/git/libreoffice/vcl/qt6/../qt5/QtFrame.cxx:365 #14 0x7fffedd98d44 in vcl::Window::SetText(rtl::OUString const&) (this=0x7fff7803cd90, rStr="Check for Updates") at /home/michi/development/git/libreoffice/vcl/source/window/window.cxx:3042 #15 0x7fffedd311c9 in SystemWindow::SetText(rtl::OUString const&) (this=0x7fff7803cd90, rStr="Check for Updates") at /home/michi/development/git/libreoffice/vcl/source/window/syswin.cxx:1048 #16 0x7048bd6b in VCLXWindow::setProperty(rtl::OUString const&, com::sun::star::uno::Any const&) (this=0x7fff7804ac00, PropertyName="Title", Value=uno::Any("string": "Check for Updates")) at /home/michi/development/git/libreoffice/toolkit/source/awt/vclxwindow.cxx:1515 #17 0x703e486d in VCLXContainer::setProperty(rtl::OUString const
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit b73a8731c6f71a9a7cedc8e97afcd5a89b55cfe9 Author: Michael Weghorn AuthorDate: Thu Jul 27 10:10:56 2023 +0200 Commit: Michael Weghorn CommitDate: Thu Jul 27 11:52:12 2023 +0200 qt a11y: Return app as parent for top-level objects If an accessible object does not have a parent in the LO a11y hierarchy or in the QObject hierarchy, return the app as accessible parent. Top-level items (like dialogs) don't have another accessible parent, but are children of the app. This can also be seen e.g. in Accerciser: For example Writer's "Page Style" dialog is listed as a child of the application, but it had no parent without this change in place, breaking automatically selecting the bookmarked a11y object in Accerciser's treeview of the LO a11y hierarchy when restoring the bookmark, since that relies being able to walk up the a11y hierarchy. This is in line with what Qt itself does, s. e.g. qtbase commit [1]: commit 6ec35ff8c56222a317b838b6aac390eb6974de85 Author: Michael Weghorn Date: Sat Jul 8 15:16:12 2023 +0200 a11y: Report app as parent for top-level item views As happens for other widgets (s. QAccessibleWidget::parentObject), report the app as accessible parent for item views that don't have another parent set. Otherwise, the accessible tree is broken when there's a top-level item view: The application has the item view as a child, but the child does not have any parent set. Extend a QListView autotest accordingly. Fixes: QTBUG-115135 Pick-to: 6.6 6.5 Change-Id: Ie06874681180a30fc6248dc98f80c4158d837278 Reviewed-by: Volker Hilsheimer [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=6ec35ff8c56222a317b838b6aac390eb6974de85 Change-Id: Ia20bf1d5311dd918eb7563161745cdb70edc0787 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154982 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 23dc41ce3e01..8a2cf2ed8b91 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -332,7 +332,8 @@ QAccessibleInterface* QtAccessibleWidget::parent() const if (pObj && pObj->parent()) return QAccessible::queryAccessibleInterface(pObj->parent()); -return nullptr; +// return app as parent for top-level objects +return QAccessible::queryAccessibleInterface(qApp); } QAccessibleInterface* QtAccessibleWidget::child(int index) const
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit bc662b15bf56bd405cb86e592e4ade9917ab49d1 Author: Michael Weghorn AuthorDate: Wed Jul 12 08:33:20 2023 +0200 Commit: Michael Weghorn CommitDate: Wed Jul 12 12:20:51 2023 +0200 qt a11y: Check child index in QtAccessibleWidget::child Check the child index is valid. Otherwise, calling the method with an invalid index would result in a crash due to a com::sun::star::lang::IndexOutOfBoundsException, e.g. when manually using an invalid index in Accerciser's IPython console: In [12]: acc.get_child_count() Out[12]: 3 In [13]: acc.get_child_at_index(3) In [14]: Change-Id: I95f680a5ac6ee1052f3046a83000fa5b07009239 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154345 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 84b398c006cc..23dc41ce3e01 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -340,6 +340,13 @@ QAccessibleInterface* QtAccessibleWidget::child(int index) const Reference xAc = getAccessibleContextImpl(); if (!xAc.is()) return nullptr; + +if (index < 0 || index >= xAc->getAccessibleChildCount()) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::child called with invalid index: " << index); +return nullptr; +} + return QAccessible::queryAccessibleInterface( QtAccessibleRegistry::getQObject(xAc->getAccessibleChild(index))); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtGraphics_GDI.cxx | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) New commits: commit 389b801cea9c9f3c311dcbe9d32df62a66e5ea4a Author: Dr. David Alan Gilbert AuthorDate: Wed May 10 23:55:14 2023 +0100 Commit: Michael Weghorn CommitDate: Sat May 13 06:36:47 2023 +0200 tdf#148251 qt: Use std::swap instead of using temporary values Another std::swap case in drawLine Change-Id: I207fe3c8c6c88532c23faf3aa3188acdcda3a5b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151654 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index 08116f85a529..28bab34a7cca 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -198,19 +198,10 @@ void QtGraphicsBackend::drawLine(tools::Long nX1, tools::Long nY1, tools::Long n QtPainter aPainter(*this); aPainter.drawLine(nX1, nY1, nX2, nY2); -tools::Long tmp; if (nX1 > nX2) -{ -tmp = nX1; -nX1 = nX2; -nX2 = tmp; -} +std::swap(nX1, nX2); if (nY1 > nY2) -{ -tmp = nY1; -nY1 = nY2; -nY2 = tmp; -} +std::swap(nY1, nY2); aPainter.update(nX1, nY1, nX2 - nX1 + 1, nY2 - nY1 + 1); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx |5 - 1 file changed, 5 deletions(-) New commits: commit 4849c98eb44b62324293254c946de41668ecd494 Author: Michael Weghorn AuthorDate: Fri Apr 28 20:44:14 2023 +0300 Commit: Michael Weghorn CommitDate: Fri Apr 28 21:56:50 2023 +0200 qt a11y: Forward changes to active state Forwarding of a11y state change events had in general been implemented in commit 8c3e8af0e60865ec6d38e2117efdb4ed2f10a20c Author: Michael Weghorn Date: Fri Jun 17 17:29:19 2022 +0200 qt a11y: Forward STATE_CHANGED event as such , but that commit explicitly did not yet enable forwarding of changes to the `active` state; quoting from the commit message: > For some reason, forwarding changes to state `AccessibleStateType::ACTIVE` > resulted in Orca becoming unresponsive (stop talking) quite quickly. > That needs further analysis, so that state change isn't forwarded > to Qt for now. I no longer see this problem on Debian testing with Orca 43.1-1, current LO master and qtbase dev branch as of commit 589c6d066f84833a7c3dda1638037f4b2e91b7aa plus the pending Qt Gerrit change [1] ("a11y atspi: Implement TableCell methods Get{Column,Row}HeaderCells") in place. Without the latter qtbase change, I can observe Orca becoming unresponsive quite quickly when moving around in Calc after pressing Shift, which may be due to waiting for a timeout instead of receiving the proper reply to the AT-SPI methods that that Gerrit change implements. (S.a. QTBUG-113110 [2] for another scenario using a simple pyatspi script to trigger what is potentially the same underlying issue.) Therefore, drop the old workaround. With this LO and the Qt change in place, Orca announces the focused and selected cell(s) in Calc with the qt6 VCL plugin and these steps: 1) start LO Calc with the qt6 VCL plugin 2) press Shift and wait a few seconds 3) move around using the arrow keys 4) select cells using Shift + arrow keys Ideally, this should also work without step 2, but apparently that step currently somehow triggers something relevant (creation of relevant a11y objects and registration of their listeners?) that doesn't yet happen without step 2. [1] https://codereview.qt-project.org/c/qt/qtbase/+/473907 [2] https://bugreports.qt.io/browse/QTBUG-113110 Change-Id: Icff8bbe7a6ee233407804c9098166945cdef4315 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151176 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 59d7dd0a8717..951286a6c1c1 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -59,13 +59,8 @@ void QtAccessibleEventListener::HandleStateChangedEvent( switch (nState) { case AccessibleStateType::ACTIVE: -// ignore for now, since it somehow causes Orca to become unresponsive quite quickly -// TODO: analyze further and fix root cause -/* aState.active = true; break; -*/ -return; case AccessibleStateType::BUSY: aState.busy = true; break;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtMenu.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit d446be648385a451c60ba3bd1657906f72a63e75 Author: Michael Weghorn AuthorDate: Wed Apr 12 16:41:38 2023 +0300 Commit: Michael Weghorn CommitDate: Wed Apr 12 17:07:21 2023 +0200 qt: Don't show non-visible menu entries Take the visibility of the menu item (that e.g. gets set in `QtMenu::ShowItem`) into account when updating the menu in `QtMenu::DoFullMenuUpdate`. With this in place, only the relevant entry is shown in the context menu for items in the character table in the special characters dialog (Writer: "Insert" -> "Special Character") while previously, the "Add to favorites" and "Remove from favorites" entries would both be shown at the same time regardless of whether the character was present in the favorites or not. (Both entries would actually do the same: add the character if it was not present in the favorites, remove it if it was already there...). Change-Id: Ica5f07d6009d97db2df0540293b096565bf1dd52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150285 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index fe281d6d2369..dca03050c30e 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -478,7 +478,8 @@ void QtMenu::DoFullMenuUpdate(Menu* pMenuBar) const bool bShowDisabled = bool(pMenuBar->GetMenuFlags() & MenuFlags::AlwaysShowDisabledEntries) || !bool(pMenuBar->GetMenuFlags() & MenuFlags::HideDisabledEntries); -const bool bVisible = bShowDisabled || mpVCLMenu->IsItemEnabled(pSalMenuItem->mnId); +const bool bVisible = pSalMenuItem->mbVisible + && (bShowDisabled || mpVCLMenu->IsItemEnabled(pSalMenuItem->mnId)); pSalMenuItem->getAction()->setVisible(bVisible); if (pSalMenuItem->mpSubMenu != nullptr)
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |9 + 1 file changed, 9 insertions(+) New commits: commit 574a5519e23e8ed50c54fb27587afb1b5b5c13c5 Author: Michael Weghorn AuthorDate: Sat Apr 1 20:08:13 2023 +0300 Commit: Michael Weghorn CommitDate: Sun Apr 2 00:33:08 2023 +0200 tdf#152979 qt: Re-add workaround for X11 modality change w/ hide/show Essentially add back the workaround originally added in commit e770bacc85a0eec96de77068d61b03f374b3cdec Date: Sun Jun 2 21:01:33 2019 + Qt5 workaround modal change after show bug but then dropped again in commit 2dc6bdd1d5789ace0500cad90f5d2eb930888bb9 Date: Wed Jun 5 17:39:45 2019 + tdf#125692 SalObject always holds a SystemChildWindow , since it turns out that it is still needed for other use cases than the original one from tdf#125692, as the freeze of the basic IDE dialog dialog preview described in tdf#152979. The qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window issue mentioned there is apparently also worked around in upstream Qt tests, s. this qtbase commit [1]: commit 3714e51436eebb64873c58dc36cf89ef8f139f09 Author: Volker Hilsheimer Date: Mon Sep 20 13:44:26 2021 +0200 QWidgetWindow: Stabilize test on Xcb Showing, hiding, and showing a window can result in the Xcb QPA plugin warning about qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window The point of the test is to verify that we get a paint event on a window that is shown again after having been hidden, not to verify that async windowing systems can handle a show/hide/show sequence. So wait for the window being exposed before we hide it. Pick-to: 6.2 5.15 Change-Id: If91a9926613645e78e332dacff34bd57e4034b6f Reviewed-by: Tor Arne Vestbø Decrease the sleep from the original 250 ms to 100 ms, since tdf#152979 comment 14 mentions that this is enough. [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3714e51436eebb64873c58dc36cf89ef8f139f09 Change-Id: I57ed520d0df85b7a3bcf47c2f9314754649482ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149912 Tested-by: Jenkins Reviewed-by: Rafael Lima diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 4bdd36e08cbd..74dfc98445af 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -619,7 +619,16 @@ void QtFrame::SetModal(bool bModal) // modality change is only effective if the window is hidden if (bWasVisible) +{ pChild->hide(); +if (QGuiApplication::platformName() == "xcb") +{ +SAL_WARN("vcl.qt", "SetModal called after Show - apply delay"); +// tdf#152979 give QXcbConnection some time to avoid +// "qt.qpa.xcb: internal error: void QXcbWindow::setNetWmStateOnUnmappedWindow() called on mapped window" +QThread::msleep(100); +} +} pChild->setWindowModality(bModal ? Qt::WindowModal : Qt::NonModal);
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 52 + 1 file changed, 7 insertions(+), 45 deletions(-) New commits: commit 02266202e5e5a97d3c97a3d502c59db884a99901 Author: Michael Weghorn AuthorDate: Mon Mar 6 15:52:44 2023 +0100 Commit: Michael Weghorn CommitDate: Mon Mar 6 19:48:09 2023 + qt a11y: Handle all QAccessible::Relation flags The bits/flags in `QAccessible::Relation` can be set in any combination, while the previous code would only properly handle the case that `QAccessible::AllRelations` is set. This would e.g. mean that QtAccessibleWidget::relations(QAccessible::FlowsTo | QAccessible::FlowsFrom) would not return both relations as it should. The previous handling of the case that just a single flag is set also looks odd, since it would use the sal_Int16 value of the UNO relation as an index into the set of relations... Fix this by always iterating over all relations and applying the filter in `lcl_appendRelation` (only append those that match the filter). (At least for AT-SPI, the previous handling should not have caused any issues in practice, since Qt's AT-SPI bridge always passes `QAccessible::AllRelations` from what I can see.) Change-Id: Icc21ac252db026f607fe8d6041252916b1d9e3a9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148352 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 13823006b6cd..237b2db64735 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -251,42 +251,12 @@ QAccessible::Relation lcl_matchUnoRelation(short relationType) } } -short lcl_matchQtRelation(QAccessible::Relation relationType) -{ -// Qt semantics is the other way around -switch (relationType) -{ -case QAccessible::Controlled: -return AccessibleRelationType::CONTROLLER_FOR; -case QAccessible::Controller: -return AccessibleRelationType::CONTROLLED_BY; -#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) -case QAccessible::DescriptionFor: -return AccessibleRelationType::DESCRIBED_BY; -case QAccessible::FlowsFrom: -return AccessibleRelationType::CONTENT_FLOWS_TO; -case QAccessible::FlowsTo: -return AccessibleRelationType::CONTENT_FLOWS_FROM; -#endif -case QAccessible::Labelled: -return AccessibleRelationType::LABEL_FOR; -case QAccessible::Label: -return AccessibleRelationType::LABELED_BY; -#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) -case QAccessible::Described: -#endif -default: -SAL_WARN("vcl.qt", "Unmatched relation: " << relationType); -} -return 0; -} - void lcl_appendRelation(QVector>* relations, -AccessibleRelation aRelation) +AccessibleRelation aRelation, QAccessible::Relation match) { QAccessible::Relation aQRelation = lcl_matchUnoRelation(aRelation.RelationType); -// skip in case there's no matching Qt relation -if (!(aQRelation & QAccessible::AllRelations)) +// skip in case there's no Qt relation matching the filter +if (!(aQRelation & match)) return; sal_uInt32 nTargetCount = aRelation.TargetSet.getLength(); @@ -313,19 +283,11 @@ QtAccessibleWidget::relations(QAccessible::Relation match) const Reference xRelationSet = xAc->getAccessibleRelationSet(); if (xRelationSet.is()) { -if (match == QAccessible::AllRelations) -{ -int count = xRelationSet->getRelationCount(); -for (int i = 0; i < count; i++) -{ -AccessibleRelation aRelation = xRelationSet->getRelation(i); -lcl_appendRelation(&relations, aRelation); -} -} -else +int count = xRelationSet->getRelationCount(); +for (int i = 0; i < count; i++) { -AccessibleRelation aRelation = xRelationSet->getRelation(lcl_matchQtRelation(match)); -lcl_appendRelation(&relations, aRelation); +AccessibleRelation aRelation = xRelationSet->getRelation(i); +lcl_appendRelation(&relations, aRelation, match); } }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) New commits: commit 46a03cb528860c7571c2ff046bef307bb7b04ac2 Author: Michael Weghorn AuthorDate: Mon Mar 6 08:49:03 2023 +0100 Commit: Michael Weghorn CommitDate: Mon Mar 6 12:17:55 2023 + qt a11y: Add mapping for relations added in Qt 6.6 Map `AccessibleRelationType::CONTENT_FLOWS_FROM`, `AccessibleRelationType::CONTENT_FLOWS_TO` and `AccessibleRelationType::DESCRIBED_BY` to the Qt equivalents added in Qt 6.6 and vice versa. As described in more detail in commit e55713dffbe8d8eba18068f6c2af14c10b787220 Date: Fri Feb 17 15:25:37 2023 +0100 qt a11y: Invert relation type to match Qt's semantic , the "inverse" relation needs to be used when mapping to/from the Qt relation. For example the Orca screen reader on Linux makes use of the FlOWS_FROM and FLOWS_TO relations. So far, when using the qt6 VCL plugin with Orca running, moving focus to a Writer paragraph resulted in these warnings being emitted: warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 1 warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 2 and thus Orca not being able to make use of those relations. Sample use in Accerciser's Python console, with a Writer document having three paragraphs with texts "First", "second", and "third" and the a11y object of the second paragraph's a11y object selected in Accerciser's a11y tree view: In [1]: acc.queryText().getStringAtOffset(0, pyatspi.TEXT_GRANULARITY_PARAGRAPH) Out[1]: ('second', 0, 6) In [2]: acc.get_relation_set() Out[2]: [, ] In [3]: first_relation = acc.get_relation_set()[0] In [4]: first_relation.get_n_targets() Out[4]: 1 In [5]: first_relation.get_relation_type() Out[5]: In [6]: first_relation.get_target(0) Out[6]: In [7]: first_relation.get_target(0).queryText().getStringAtOffset(0, 1) Out[7]: ('First', 0, 5) In [8]: second_relation = acc.get_relation_set()[1] In [9]: second_relation.get_n_targets() Out[9]: 1 In [10]: second_relation.get_relation_type() Out[10]: In [11]: second_relation.get_target(0).queryText().getStringAtOffset(0,1) Out[11]: ('third', 0, 5) (QTBUG-105864 [1] also has a sample doc and pyatspi script that can be used for testing.) Qt commit adding the relations [2]: commit f5358e5932bc8701621389c265c4ea86c92c536c Author: Michael Weghorn Date: Fri Feb 17 13:48:38 2023 +0100 a11y: Add new relations DescriptionFor, Described, Flows{From,To} This is equivalent to the corresponding relation types defined in the IAccessible2 spec [1] (IA2_RELATION_DESCRIPTION_FOR, IA2_RELATION_DESCRIBED_BY, IA2_RELATION_FLOWS_FROM, IA2_RELATION_FLOWS_TO) and for AT-SPI on Linux [2] (relation types ATSPI_RELATION_DESCRIPTION_FOR, ATSPI_RELATION_DESCRIBED_BY, ATSPI_RELATION_FLOWS_FROM, ATSPI_RELATION_FLOWS_TO). User Interface Automation (UIA) on Windows also has corresponding properties for 3 of them [3]: UIA_DescribedByPropertyId, UIA_FlowsFromPropertyId, UIA_FlowsToPropertyId. This commit adds the new flags and implements the mapping for the AT-SPI case. Note that the relation type is conceptually always "inverted" when comparing Qt and AT-SPI (or Qt and UIA) as clarified in afbfe30093d49eff0ec4c28c220d33c233b9f807. "QAccessible::Description" instead of "QAccessible::DescriptionFor" would align better with the naming scheme of the other relations, but that is already used in the Text enum. [1] https://accessibility.linuxfoundation.org/a11yspecs/ia2/docs/html/group__grp_relations.html [2] https://lazka.github.io/pgi-docs/Atspi-2.0/enums.html#Atspi.RelationType [3] https://docs.microsoft.com/en-us/windows/win32/winauto/uiauto-automation-element-propids [ChangeLog][QtGui][QAccessible::RelationFlag] Added new relation flags DescriptionFor, Described, FlowsFrom and FlowsTo. Fixes: QTBUG-105864 Change-Id: If2d46099eeea75e177358c821d1ae833a553bd0e Reviewed-by: Jan Arve Sæther [1] https://bugreports.qt.io/browse/QTBUG-105864 [2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f5358e5932bc8701621389c265c4ea86c92c536c Change-Id: I6e5d78fb26f62a6f1745d4f94647e8dc0fe2abfd Reviewed-on: https://gerrit.libreoffice.org/c/core/+
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtGraphics_Controls.cxx | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) New commits: commit 0e0054dfd7dbf382325696cefb24a6bc48474293 Author: Michael Weghorn AuthorDate: Fri Mar 3 07:42:46 2023 +0100 Commit: Michael Weghorn CommitDate: Sat Mar 4 07:42:41 2023 + tdf#153803 qt: Let Qt style draw combobox popup borders ... and listbox popup borders as well. Declare suppport for native drawing of focus for pushbuttons, since the Qt-based VCL plugins take care of drawing focus for controls. As far as I can see, there is no need to actually implement drawing of focus separately for the Qt-based VCL plugins, though, since that is already handled by the `ControlState::FOCUSED` state when drawing the entire control. Support for this is what `ComboBox::ImplInit` and `ListBox::ImplInit` check and if it's not supported, they enable double buffering for the window (which would have the result that the `pWin` in `ImplDrawFrame` in vcl/source/window/decoview.cxx would be nullptr and thus no native drawing of the frame would happen), s.a. commit d4714b0fdb81e6e561ae526cc517ecc9a40a603e Date: Mon Jun 17 17:02:54 2019 +0200 tdf#101978 vcl combobox/listbox floating window: avoid flicker With this in place, the border in the popup windows for listboxes and comboboxes are drawn by the Qt style. Yet another way to achieve this would be to support drawing `ControlPart::ListboxWindow` for `ControlType::Listbox`, so that the other rendering path in `ImplSmallBorderWindowView::DrawWindow` is taken, but that is currently complicated by the fact that bounding and content rect are not really used consequently there, so that would have to be cleaned up first, s.a. the commit message in commit 5c96e813bed3293605f8d746f188cc051d1e5949 Date: Thu Feb 2 15:27:37 2023 + tdf#150451 Fix borders in Editbox controls (kf5) for more details. Change-Id: I8cd2396e7075a475e53e016acbb16d6fb54bad2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148160 Tested-by: Jenkins Reviewed-by: Rafael Lima diff --git a/vcl/qt5/QtGraphics_Controls.cxx b/vcl/qt5/QtGraphics_Controls.cxx index d3ebf5e34bf4..81ab7a7edc7b 100644 --- a/vcl/qt5/QtGraphics_Controls.cxx +++ b/vcl/qt5/QtGraphics_Controls.cxx @@ -91,11 +91,10 @@ bool QtGraphics_Controls::isNativeControlSupported(ControlType type, ControlPart case ControlType::ListNode: return (part == ControlPart::Entire); +case ControlType::Pushbutton: case ControlType::Radiobutton: case ControlType::Checkbox: return (part == ControlPart::Entire) || (part == ControlPart::Focus); -case ControlType::Pushbutton: -return (part == ControlPart::Entire); case ControlType::ListHeader: return (part == ControlPart::Button); @@ -310,6 +309,11 @@ bool QtGraphics_Controls::drawNativeControl(ControlType type, ControlPart part, if (type == ControlType::Pushbutton) { const PushButtonValue& rPBValue = static_cast(value); +if (part == ControlPart::Focus) +// Nothing to do. Drawing focus separately is not needed because that's +// already handled by the ControlState::FOCUSED state being set when +// drawing the entire control +return true; assert(part == ControlPart::Entire); QStyleOptionButton option; if (nControlState & ControlState::DEFAULT) @@ -740,6 +744,8 @@ bool QtGraphics_Controls::getNativeControlRegion(ControlType type, ControlPart p retVal = true; } } +else if (part == ControlPart::Focus) +retVal = true; break; case ControlType::Editbox: case ControlType::MultilineEditbox:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |4 1 file changed, 4 insertions(+) New commits: commit 00a602ca8e75ab5cf050e092289ef7165b343165 Author: Michael Weghorn AuthorDate: Wed Mar 1 10:54:13 2023 +0100 Commit: Michael Weghorn CommitDate: Wed Mar 1 13:24:21 2023 + tdf#153869 qt: Unminimize window when requested Remove the `Qt::WindowMinimized` state from the widget's window states if the `SalFrameToTop::RestoreWhenMin` flag is set to request restoring the minimized window. Change-Id: I0cb67f28c1e9c3f48a9a234702a4aaa7e3ffec8d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148036 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 1b9f8ae88175..554485a6b83c 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -768,7 +768,11 @@ void QtFrame::ToTop(SalFrameToTop nFlags) if (isWindow() && !(nFlags & SalFrameToTop::GrabFocusOnly)) pWidget->raise(); if ((nFlags & SalFrameToTop::RestoreWhenMin) || (nFlags & SalFrameToTop::ForegroundTask)) +{ +if (nFlags & SalFrameToTop::RestoreWhenMin) +pWidget->setWindowState(pWidget->windowState() & ~Qt::WindowMinimized); pWidget->activateWindow(); +} else if ((nFlags & SalFrameToTop::GrabFocus) || (nFlags & SalFrameToTop::GrabFocusOnly)) { if (!(nFlags & SalFrameToTop::GrabFocusOnly))
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtData.cxx | 293 - 1 file changed, 92 insertions(+), 201 deletions(-) New commits: commit db6ed07f4c1a086e4962ff16d3ede9aea9e60952 Author: Michael Weghorn AuthorDate: Tue Feb 21 08:23:10 2023 +0100 Commit: Michael Weghorn CommitDate: Tue Feb 21 08:32:20 2023 + tdf#144302 tdf#15 qt: Load cursor from icon theme Load cursor from the icon theme similar to how the gtk VCL plugins do it. This not only allows using the themed cursor icons, but also helps avoid QTBUG-95434 [1] ("Bitmap cursors not supported on QtWayland") that would result in no cursor being shown on Wayland at all when our custom bitmap cursors are used. [1] https://bugreports.qt.io/browse/QTBUG-95434 Change-Id: Id65db4e7d71b8cee8a514c06c21c59dcc2afa889 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147379 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtData.cxx b/vcl/qt5/QtData.cxx index 7d2d0418e80e..cc2883ae80ca 100644 --- a/vcl/qt5/QtData.cxx +++ b/vcl/qt5/QtData.cxx @@ -24,135 +24,13 @@ #include #include +#include #include +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - +#include +#include #include QtData::QtData() @@ -176,17 +54,29 @@ QtData::QtData() // outline dtor b/c of FreetypeManager incomplete type QtData::~QtData() {} -static QCursor* getQCursorFromXBM(const unsigned char* pBitmap, const unsigned char* pMask, - int nWidth, int nHeight, int nXHot, int nYHot) +static QCursor* getQCursorFromIconTheme(const OUString& rIconName, int nXHot, int nYHot) { -QBitmap aPixmap = QBitmap::fromData(QSize(nWidth, nHeight), pBitmap); -QBitmap aMask = QBitmap::fromData(QSize(nWidth, nHeight), pMask); -return new QCursor(aPixmap, aMask, nXHot, nYHot); +const OUString sIconTheme = Application::GetSettings().GetStyleSettings().DetermineIconTheme(); +const OUString sUILang = Application::GetSettings().GetUILanguageTag().getBcp47(); +auto xMemStream = ImageTree::get().getImageStream(rIconName, sIconTheme, sUILang); +if (!xMemStream) +return nullptr; +auto nLength = xMemStream->TellEnd(); +if (!nLength) +{ +SAL_WARN("vcl.qt", "Cannot load cursor pixmap from empty stream."); +return nullptr; +} + +const unsigned char* pData = static_cast(xMemStream->GetData()); +QPixmap aPixmap; +aPixmap.loadFromData(pData, nLength); +return new QCursor(aPixmap, nXHot, nYHot); } -#define MAKE_CURSOR(vcl_name, name) \ + +#define MAKE_CURSOR(vcl_name, name, icon_name) \ case vcl_name: \ -pCursor = getQCursorFromXBM(name##curs##_bits, name##mask##_bits, name##curs_width,\ -name##curs_height, name##curs_x_hot, name##curs_y_hot);\ +pCursor = getQCursorFromIconTheme(icon_name, name##curs_x_hot, name##curs_y_hot); \ break #define MAP_BUILTIN(vcl_name, qt_enum) \ @@ -239,72 +129,73 @@ QCursor& QtData::getCursor(PointerStyle ePointerStyle) MAP_BUILTIN(PointerStyle::Move, Qt::SizeAllCursor); MAP_BUILTIN(PointerStyle::Null, Qt::BlankCursor); -MAKE_CURSOR(PointerStyle::Magnify, magnify_); -MAKE_CURSOR(PointerStyle::Fill, fi
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) New commits: commit e55713dffbe8d8eba18068f6c2af14c10b787220 Author: Michael Weghorn AuthorDate: Fri Feb 17 15:25:37 2023 +0100 Commit: Michael Weghorn CommitDate: Mon Feb 20 06:15:56 2023 + qt a11y: Invert relation type to match Qt's semantic As Jan Arve Sæther pointed out in a review comment [1] for a pending Qt change to add more a11y relation types to Qt, Qt's semantic for relations is basically the other way around (i.e. inversed) as compared to the semantic used by AT-SPI or LO. For example, if an a11y interface `interfaceA` is the label for another a11y interface `interfaceB`, interfaceA->relations() will contain a pair { interfaceB, QAccessible::Labelled } since the target `interfaceB` is labelled by `interfaceA`. On the other hand in LO, the `XAccessibleRelationSet` for an `XAccessibleContext` has the role that the a11y object itself has *for* the targets, i.e. in that case the interfaceA->getAccessibleRelationSet() would contain an item of type `AccessibleRelationType::LABEL_FOR` because `interfaceA` is a label for the relation target `interfaceB`. Therefore, adapt the mapping between the relation types accordingly. AT-SPI's semantic/handling matches the one that LO has again, which is taken care of by the fact that Qt maps the relation types the other way around in it's AT-SPI bridge again. [2] There's also a pending Qt change [3] to clarify the Qt doc. [1] https://codereview.qt-project.org/c/qt/qtbase/+/428174/comment/eef0cf38_e6ff7dea/ [2] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/qspi_constant_mappings.cpp?id=e8322a4cc043e1a150cc4c6b86ee2f9cf858cd24#n98 [3] https://codereview.qt-project.org/c/qt/qtbase/+/460414 Change-Id: Ic30d878afc477ad3c6a188d22f35078034f8123c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147223 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index e2807dd6fecf..7a55bae884f5 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -220,15 +220,16 @@ sal_Int16 lcl_matchQtTextBoundaryType(QAccessible::TextBoundaryType boundaryType QAccessible::Relation lcl_matchUnoRelation(short relationType) { +// Qt semantics is the other way around switch (relationType) { -case AccessibleRelationType::CONTROLLER_FOR: -return QAccessible::Controller; case AccessibleRelationType::CONTROLLED_BY: +return QAccessible::Controller; +case AccessibleRelationType::CONTROLLER_FOR: return QAccessible::Controlled; -case AccessibleRelationType::LABEL_FOR: -return QAccessible::Label; case AccessibleRelationType::LABELED_BY: +return QAccessible::Label; +case AccessibleRelationType::LABEL_FOR: return QAccessible::Labelled; case AccessibleRelationType::INVALID: case AccessibleRelationType::CONTENT_FLOWS_FROM: @@ -245,15 +246,16 @@ QAccessible::Relation lcl_matchUnoRelation(short relationType) short lcl_matchQtRelation(QAccessible::Relation relationType) { +// Qt semantics is the other way around switch (relationType) { -case QAccessible::Controller: -return AccessibleRelationType::CONTROLLER_FOR; case QAccessible::Controlled: +return AccessibleRelationType::CONTROLLER_FOR; +case QAccessible::Controller: return AccessibleRelationType::CONTROLLED_BY; -case QAccessible::Label: -return AccessibleRelationType::LABEL_FOR; case QAccessible::Labelled: +return AccessibleRelationType::LABEL_FOR; +case QAccessible::Label: return AccessibleRelationType::LABELED_BY; default: SAL_WARN("vcl.qt", "Unmatched relation: " << relationType);
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtGraphics_Controls.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 70b0c2d84bf5b3b2e94c8da18845c4210a87b7a8 Author: Andrea Gelmini AuthorDate: Fri Feb 10 12:40:41 2023 +0100 Commit: Julien Nabet CommitDate: Fri Feb 10 13:19:21 2023 + Fix typo Change-Id: I14c04884eab36560c96dbc59b809a5871d87b75f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146750 Reviewed-by: Julien Nabet Tested-by: Julien Nabet diff --git a/vcl/qt5/QtGraphics_Controls.cxx b/vcl/qt5/QtGraphics_Controls.cxx index f2e48f655149..0c5b85d28a11 100644 --- a/vcl/qt5/QtGraphics_Controls.cxx +++ b/vcl/qt5/QtGraphics_Controls.cxx @@ -762,7 +762,7 @@ bool QtGraphics_Controls::getNativeControlRegion(ControlType type, ControlPart p int nBottom = qMax(nLine, upscale(fo.rect.bottom() - aSubRect.bottom(), Round::Ceil)); boundingRect.adjust(nLeft, nTop, nRight, nBottom); -// tdf#150451: ensure a minimium size that fits text content + frame at top and bottom. +// tdf#150451: ensure a minimum size that fits text content + frame at top and bottom. // Themes may use the widget type for determining the actual frame width to use, // so pass a dummy QLineEdit //
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtGraphics_Controls.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 6f4b8b7cfe2907b7da46eec6951a0e09b836a6de Author: Michael Weghorn AuthorDate: Tue Jan 31 16:08:53 2023 +0100 Commit: Michael Weghorn CommitDate: Wed Feb 1 06:27:55 2023 + tdf#152073 qt: Draw background when drawing frame For native drawing of a frame (border), use the window background color as default color. As mentioned in commit f39f21d92ec83c3a5062f29dd26214fc83012c06 ("tdf#138010 (IV) VclScrolledWindow: Use actual border width"), the Qt/KDE Breeze style uses a frame width of 2, with the actual 1 pixel border being surrounded by a 1 pixel padding/margin. Transparent background did not ensure that the 1 pixel padding/margin is repainted and could thus result in artifacts from what was painted to that location previously (s. the Basic IDE editor example from tdf#152073). Use the window background for the default image color when drawing a frame to avoid this. The gtk3 VCL plugin also explicitly draws a background for the corresponding code path, using `gtk_render_background`. An alternative might be to explicitly draw the background further up the call stack, or pass an explicit background color from `DecorationView::DrawFrame` and only apply a default color in `QtGraphics_Controls::drawNativeControl` when a background color (other than `COL_DEFAULT`) is passed to that method. Sample bt for gtk3: 1 GtkSalGraphics::drawNativeControl salnativewidgets-gtk.cxx 1835 0x7fffe6271f92 2 SalGraphics::DrawNativeControlsalgdilayout.cxx 807 0x7fffee887739 3 OutputDevice::DrawNativeControl nativecontrols.cxx 287 0x7fffee58906e 4 (anonymous namespace)::ImplDrawFrame decoview.cxx 600 0x7fffee1b2055 5 DecorationView::DrawFrame decoview.cxx 886 0x7fffee1b32c8 6 ImplSmallBorderWindowView::DrawWindow brdwin.cxx 742 0x7fffee0ea3ea 7 ImplBorderWindow::Paint brdwin.cxx 1630 0x7fffee0ee99a 8 PaintHelper::DoPaint paint.cxx313 0x7fffee0c9f1c 9 vcl::Window::ImplCallPaintpaint.cxx617 0x7fffee0cb4b3 10 PaintHelper::~PaintHelper paint.cxx552 0x7fffee0cae14 11 vcl::Window::ImplCallPaintpaint.cxx623 0x7fffee0cb513 Many thanks to Rafael Lima for the very helpful analysis in [1] and [2]. [1] https://bugs.documentfoundation.org/show_bug.cgi?id=152073#c2 [2] https://bugs.documentfoundation.org/show_bug.cgi?id=152073#c3 Change-Id: I08e6d05d0fc3d0e54952a65cd28dee92615df0a3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146419 Reviewed-by: Rafael Lima Tested-by: Jenkins diff --git a/vcl/qt5/QtGraphics_Controls.cxx b/vcl/qt5/QtGraphics_Controls.cxx index e6e3d820da59..e08b84719e61 100644 --- a/vcl/qt5/QtGraphics_Controls.cxx +++ b/vcl/qt5/QtGraphics_Controls.cxx @@ -283,6 +283,7 @@ bool QtGraphics_Controls::drawNativeControl(ControlType type, ControlPart part, break; } [[fallthrough]]; // QPalette::Window +case ControlType::Frame: case ControlType::Menubar: case ControlType::WindowBackground: m_image->fill(QApplication::palette().color(QPalette::Window).rgb());
[Libreoffice-commits] core.git: vcl/qt5 vcl/source vcl/unx
vcl/qt5/QtFontFace.cxx |4 vcl/source/font/PhysicalFontFace.cxx |4 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |4 3 files changed, 12 deletions(-) New commits: commit 2df9b7cd3fa03077c9809dab9b94a20dd89002fb Author: Caolán McNamara AuthorDate: Fri Nov 18 12:42:56 2022 + Commit: Caolán McNamara CommitDate: Mon Nov 21 09:55:06 2022 +0100 stop setting OpenSymbol as a "Symbol" font which has a specific meaning of a Windows Symbol encoding Change-Id: I6e5d079303fccfabc8204fc0dbae0870efb839a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142947 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/vcl/qt5/QtFontFace.cxx b/vcl/qt5/QtFontFace.cxx index d45fadafe87e..351f59739544 100644 --- a/vcl/qt5/QtFontFace.cxx +++ b/vcl/qt5/QtFontFace.cxx @@ -108,8 +108,6 @@ void QtFontFace::fillAttributesFromQFont(const QFont& rFont, FontAttributes& rFA QFontInfo aFontInfo(rFont); rFA.SetFamilyName(toOUString(aFontInfo.family())); -if (IsOpenSymbol(toOUString(aFontInfo.family( -rFA.SetSymbolFlag(true); rFA.SetStyleName(toOUString(aFontInfo.styleName())); rFA.SetPitch(aFontInfo.fixedPitch() ? PITCH_FIXED : PITCH_VARIABLE); rFA.SetWeight(QtFontFace::toFontWeight(aFontInfo.weight())); @@ -142,8 +140,6 @@ QtFontFace* QtFontFace::fromQFontDatabase(const QString& aFamily, const QString& FontAttributes aFA; aFA.SetFamilyName(toOUString(aFamily)); -if (IsOpenSymbol(aFA.GetFamilyName())) -aFA.SetSymbolFlag(true); aFA.SetStyleName(toOUString(aStyle)); aFA.SetPitch(isFixedPitch ? PITCH_FIXED : PITCH_VARIABLE); aFA.SetWeight(QtFontFace::toFontWeight(weigh)); diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx index cf9849162d15..cd4254d131db 100644 --- a/vcl/source/font/PhysicalFontFace.cxx +++ b/vcl/source/font/PhysicalFontFace.cxx @@ -45,10 +45,6 @@ PhysicalFontFace::PhysicalFontFace(const FontAttributes& rDFA) , mpHbFace(nullptr) , mpHbUnscaledFont(nullptr) { -// OpenSymbol is a unicode font, but it still deserves the symbol flag -if (!IsSymbolFont()) -if (IsOpenSymbol(GetFamilyName())) -SetSymbolFlag(true); } PhysicalFontFace::~PhysicalFontFace() diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 3477ce1cbf42..db2bd614336e 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -516,10 +516,6 @@ void FreetypeFont::GetFontMetric(ImplFontMetricDataRef const & rxTo) const rxTo->SetOrientation(mrFontInstance.GetFontSelectPattern().mnOrientation); -//Always consider [open]symbol as symbol fonts -if ( IsOpenSymbol( rxTo->GetFamilyName() ) ) -rxTo->SetSymbolFlag( true ); - FT_Activate_Size( maSizeFT ); rxTo->ImplCalcLineSpacing(&mrFontInstance);
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) New commits: commit 155e8b1683f10847ff18e75287e2466220242bb1 Author: Michael Weghorn AuthorDate: Fri Sep 9 12:20:05 2022 +0200 Commit: Michael Weghorn CommitDate: Fri Sep 16 12:03:42 2022 +0200 tdf#117173: qt a11y: Forward changes to SHOWING state While Qt doesn't have an equivalent state for the SHOWING state used in LibreOffice and in IAccessible2, it has separate `QAccessible::ObjectHide` and `QAccessible::ObjectShow` event types used to indicate that an object changed state to being (no longer) displayed, so use those. In fact, Qt's `AtspiAdaptor` handles those by mapping them to state change events for the AT-SPI "showing" state again. [1] [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=ce16eb2679f69b28d2debd1ce18a99f7279b4295#n896 Change-Id: Iae2b9ec26403d9a9887e86c4155ba64a73f19b60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139812 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 16a5a074b8cb..f9a4d7b1a2c1 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -132,6 +132,20 @@ void QtAccessibleEventListener::HandleStateChangedEvent( case AccessibleStateType::SELECTED: aState.selected = true; break; +case AccessibleStateType::SHOWING: +{ +// Qt does not have an equivalent for the SHOWING state, +// but has separate event types +QAccessible::Event eEventType; +sal_Int64 nNewState = 0; +if ((rEvent.NewValue >>= nNewState) && nNewState == AccessibleStateType::SHOWING) +eEventType = QAccessible::ObjectShow; +else +eEventType = QAccessible::ObjectHide; +QAccessible::updateAccessibility( +new QAccessibleEvent(pQAccessibleInterface, eEventType)); +break; +} // These don't seem to have a matching Qt equivalent case AccessibleStateType::ARMED: case AccessibleStateType::DEFUNC: @@ -141,7 +155,6 @@ void QtAccessibleEventListener::HandleStateChangedEvent( case AccessibleStateType::MANAGES_DESCENDANTS: case AccessibleStateType::OPAQUE: case AccessibleStateType::SENSITIVE: -case AccessibleStateType::SHOWING: case AccessibleStateType::STALE: case AccessibleStateType::TRANSIENT: case AccessibleStateType::VERTICAL:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtMenu.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit ea9de214311780119a0974e03b38fd835b5074f5 Author: Michael Weghorn AuthorDate: Wed Sep 14 10:40:18 2022 +0200 Commit: Michael Weghorn CommitDate: Wed Sep 14 14:18:46 2022 +0200 tdf#150882 qt: Report menu bar height when not hidden `QWidget::isVisible` only returns `true` if the widget is actually visible on screen. Therefore, even if the menu itself has been set to be visible in `QtMenu::ShowMenuBar`, the call to `mpQMenuBar->isVisible()` will still return `false` as long as the corresponding window the menu belongs to isn't shown on screen (yet). However, since the menu bar height may be used to calculate the position of other items (e.g. in the macro dialog) before the corresponding window gets shown, what should be relevant is whether the menu bar itself is meant to be hidden or not. Therefore, use `QWidget::isHidden` instead. Quoting the Qt doc [1] for `QWidget`'s `visible` property: > This property holds whether the widget is visible > > Calling setVisible(true) or show() sets the widget to visible status if > all its parent widgets up to the window are visible. If an ancestor is > not visible, the widget won't become visible until all its ancestors are > shown. [...] > > Calling setVisible(false) or hide() hides a widget explicitly. An > explicitly hidden widget will never become visible, even if all its > ancestors become visible, unless you show it. This makes the menu show properly in the macro dialog while still not reserving any space for the menu in the main window in case of using the "Tabbed" interface (where no "traditional" menu is present). [1] https://doc.qt.io/qt-6/qwidget.html#visible-prop Change-Id: Ifb6e22db8224013f06320d090a19d80d9e38a990 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139910 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index c1e4cb0e1a29..dd259f32f979 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -847,7 +847,7 @@ bool QtMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& r int QtMenu::GetMenuBarHeight() const { -if (!validateQMenuBar() || !mpQMenuBar->isVisible()) +if (!validateQMenuBar() || mpQMenuBar->isHidden()) return 0; return mpQMenuBar->height() * mpFrame->devicePixelRatioF(); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 36 1 file changed, 36 insertions(+) New commits: commit 5226e3889155ea22465d488174a6f8720085628a Author: Michael Weghorn AuthorDate: Fri Sep 2 08:03:03 2022 +0200 Commit: Michael Weghorn CommitDate: Fri Sep 2 10:26:06 2022 +0200 tdf#150683 qt a11y: Add bound checks for table methods Since the row/column indices come from outside (usually from assistive technology like a screen reader), validate them before using them when calling the corresponding methods on the XAccessibleTable{,Selection} interfaces. Otherwise, calling the corresponding UNO methods will result in a crash due to an `IndexOutOfBoundsException` being thrown. Change-Id: I4d018d16b99f1c2c7b88c1c9e03f16d40ec3345c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139250 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index e2e99e6de208..60d64fa98731 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -1484,6 +1484,15 @@ QAccessibleInterface* QtAccessibleWidget::cellAt(int row, int column) const Reference xTable(xAc, UNO_QUERY); if (!xTable.is()) return nullptr; + +if (row < 0 || row >= xTable->getAccessibleRowCount() || column < 0 +|| column >= xTable->getAccessibleColumnCount()) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::cellAt called with invalid row/column index (" + << row << ", " << column << ")"); +return nullptr; +} + return QAccessible::queryAccessibleInterface( QtAccessibleRegistry::getQObject(xTable->getAccessibleCellAt(row, column))); } @@ -1522,6 +1531,13 @@ bool QtAccessibleWidget::isColumnSelected(int nColumn) const if (!xTable.is()) return false; +if (nColumn < 0 || nColumn >= xTable->getAccessibleColumnCount()) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::isColumnSelected called with invalid column index " + << nColumn); +return false; +} + return xTable->isAccessibleColumnSelected(nColumn); } @@ -1535,6 +1551,13 @@ bool QtAccessibleWidget::isRowSelected(int nRow) const if (!xTable.is()) return false; +if (nRow < 0 || nRow >= xTable->getAccessibleRowCount()) +{ +SAL_WARN("vcl.qt", + "QtAccessibleWidget::isRowSelected called with invalid row index " << nRow); +return false; +} + return xTable->isAccessibleRowSelected(nRow); } @@ -1570,6 +1593,13 @@ bool QtAccessibleWidget::selectColumn(int column) if (!xAc.is()) return false; +if (column < 0 || column >= columnCount()) +{ +SAL_WARN("vcl.qt", + "QtAccessibleWidget::selectColumn called with invalid column index " << column); +return false; +} + Reference xTableSelection(xAc, UNO_QUERY); if (!xTableSelection.is()) return false; @@ -1582,6 +1612,12 @@ bool QtAccessibleWidget::selectRow(int row) if (!xAc.is()) return false; +if (row < 0 || row >= rowCount()) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::selectRow called with invalid row index " << row); +return false; +} + Reference xTableSelection(xAc, UNO_QUERY); if (!xTableSelection.is()) return false;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtInstance.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit c1fe2b6da61f4bd55c7551b4f0c1b379ed814ffe Author: Michael Weghorn AuthorDate: Thu Sep 1 17:15:27 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Sep 1 20:26:01 2022 +0200 qt: Add include needed with qtbase dev branch `qVersion()` has been moved to a different header in qtbase commit [1]: commit 50b05e3e2ad969abf4b939d5db2253380e47d775 (gerrit/dev) Author: Sona Kurazyan Date: Tue Aug 30 10:37:00 2022 +0200 Move qVersion() from qglobal.h to qlibraryinfo.h Since qVersion() might be called also from C code, disable the parts of qlibraryinfo.h that are relevant only for C++ code if __cplusplus is not defined. [ChangeLog][Potentially Source-Incompatible Changes] qVersion() is moved from qglobal.h to qlibraryinfo.h, '#include ' needs to be added where it's used. Task-number: QTBUG-99313 Change-Id: I3363ef3fa4073114e5151cb3a2a1e8282ad42a4d Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne [1] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=50b05e3e2ad969abf4b939d5db2253380e47d775 Change-Id: Iafeb0ed6a77420f9a303d8ec4d3c5ba29c6f4b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139221 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 5522ea15c31a..9c4d3def970e 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -39,6 +39,7 @@ #include #include +#include #include #include #include
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 12 1 file changed, 4 insertions(+), 8 deletions(-) New commits: commit 1dbf4a111486ee4e5e2d9da0bbf5544742ae7805 Author: Michael Weghorn AuthorDate: Thu Sep 1 11:11:39 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Sep 1 15:26:43 2022 +0200 tdf#150683 qt a11y: Avoid using 32-bit child index here Passing the `QObject` of the child directly in the `QAccessibleEvent` ctor generally has the same effect as setting the parent in the ctor and then passing the child index via `QAccessibleEvent::setChild`. In both cases, `QAccessibleEvent::accessibleInterface` will return the `QAccessibleInterface*` for the child afterwards. However, the latter only works correctly with child indices that fit into 32 bit, which isn't the case for all cells in a Calc spreadsheet with 16k column support. Change-Id: Iaa7b936df237f82dc21a00d3ac419a1519a95226 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139147 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 3716472b2d96..16a5a074b8cb 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -344,14 +344,10 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible return; } -// use the QAccessibleEvent ctor taking a QObject* instead of the one that takes QAccessibleInterface* -// to work around QTBUG-105988 -QAccessibleEvent* pSelectionAddEvent -= new QAccessibleEvent(pQAccessibleInterface->object(), eEventType); -// Qt expects the index of the (un)selected child to be set in the event -sal_Int32 nChildIndex = xContext->getAccessibleIndexInParent(); -pSelectionAddEvent->setChild(nChildIndex); -QAccessible::updateAccessibility(pSelectionAddEvent); +// Qt expects the event to be sent for the (un)selected child +QObject* pChildObject = QtAccessibleRegistry::getQObject(xChildAcc); +assert(pChildObject); +QAccessible::updateAccessibility(new QAccessibleEvent(pChildObject, eEventType)); return; } case AccessibleEventId::SELECTION_CHANGED_WITHIN:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 36 +- 1 file changed, 31 insertions(+), 5 deletions(-) New commits: commit dce8fda483f38eb8624c89c20c07a1af68e3952e Author: Michael Weghorn AuthorDate: Fri Aug 26 17:00:01 2022 +0200 Commit: Michael Weghorn CommitDate: Fri Aug 26 19:38:27 2022 +0200 qt a11y: Set the (un)selected child in selection add/remove event Qt itself sets the child index when sending `QAccessible::SelectionAdd` or `QAccessible::SelectionRemove` events for its own widgets and the handling in its AT-SPI adapter assumes that this is the case, so do so here as well. Work around QTBUG-105988 [1] by using the `QAccessibleEvent` ctor that takes a `QObject*` instead of the one that takes the `QAccesibleInterface*`, since calling `QAccessibleEvent::setChild` in the event object would otherwise break things. When used in combination with the suggested Qt changes to send AT-SPI `SelectionChanged` events for these event types and `QAccessible::SelectionWithin` [2] [3], the suggested Qt changes to add support for the AT-SPI selection interface [4] [5] and a corresponding LibreOffice demo change [6] that implements the suggested `QAccessibleSelectionInterface`, this makes Orca announce selected Calc cells for the qt6 VCL plugin. [1] https://bugreports.qt.io/browse/QTBUG-105988 [2] https://codereview.qt-project.org/c/qt/qtbase/+/429146 [3] https://codereview.qt-project.org/c/qt/qtbase/+/429147 [4] https://codereview.qt-project.org/c/qt/qtbase/+/428566 [5] https://codereview.qt-project.org/c/qt/qtbase/+/428567 [6] https://gerrit.libreoffice.org/c/core/+/138750 Change-Id: Id1cd28aa8cab208d7713ddd46ede5a7acd73334a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138882 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 9dbc3f3e5504..3716472b2d96 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -321,13 +321,39 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible new QAccessibleEvent(pQAccessibleInterface, QAccessible::TableSummaryChanged)); return; case AccessibleEventId::SELECTION_CHANGED_ADD: -QAccessible::updateAccessibility( -new QAccessibleEvent(pQAccessibleInterface, QAccessible::SelectionAdd)); -return; case AccessibleEventId::SELECTION_CHANGED_REMOVE: -QAccessible::updateAccessibility( -new QAccessibleEvent(pQAccessibleInterface, QAccessible::SelectionRemove)); +{ +QAccessible::Event eEventType; +if (aEvent.EventId == AccessibleEventId::SELECTION_CHANGED_ADD) +eEventType = QAccessible::SelectionAdd; +else +eEventType = QAccessible::SelectionRemove; + +uno::Reference xChildAcc; +aEvent.NewValue >>= xChildAcc; +if (!xChildAcc.is()) +{ +SAL_WARN("vcl.qt", + "Selection add/remove event without the (un)selected accessible set"); +return; +} +Reference xContext = xChildAcc->getAccessibleContext(); +if (!xContext.is()) +{ +SAL_WARN("vcl.qt", "No valid XAccessibleContext for (un)selected accessible."); +return; +} + +// use the QAccessibleEvent ctor taking a QObject* instead of the one that takes QAccessibleInterface* +// to work around QTBUG-105988 +QAccessibleEvent* pSelectionAddEvent += new QAccessibleEvent(pQAccessibleInterface->object(), eEventType); +// Qt expects the index of the (un)selected child to be set in the event +sal_Int32 nChildIndex = xContext->getAccessibleIndexInParent(); +pSelectionAddEvent->setChild(nChildIndex); +QAccessible::updateAccessibility(pSelectionAddEvent); return; +} case AccessibleEventId::SELECTION_CHANGED_WITHIN: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::SelectionWithin));
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) New commits: commit 8ce3d4f8b000e11d63d37546c5f574e57db46551 Author: Michael Weghorn AuthorDate: Thu Aug 25 16:58:06 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 25 18:37:02 2022 +0200 qt a11y: Forward text selection change event as such Change-Id: I7e208d964c5b5badb0a3ea3a19c3ca3cc7fa4ff4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138838 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index dd2ee1b2eae6..9dbc3f3e5504 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -30,6 +30,7 @@ #include #include +#include using namespace css; using namespace css::accessibility; @@ -222,9 +223,21 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible new QAccessibleEvent(pQAccessibleInterface, QAccessible::VisibleDataChanged)); return; case AccessibleEventId::TEXT_SELECTION_CHANGED: +{ +QAccessibleTextInterface* pTextInterface = pQAccessibleInterface->textInterface(); +if (!pTextInterface) +{ +SAL_WARN("vcl.qt", "TEXT_SELECTION_CHANGED event received for object not " + "implementing text interface"); +return; +} +int nStartOffset = 0; +int nEndOffset = 0; +pTextInterface->selection(0, &nStartOffset, &nEndOffset); QAccessible::updateAccessibility( -new QAccessibleEvent(pQAccessibleInterface, QAccessible::Selection)); +new QAccessibleTextSelectionEvent(pQAccessibleInterface, nStartOffset, nEndOffset)); return; +} case AccessibleEventId::TEXT_ATTRIBUTE_CHANGED: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::AttributeChanged));
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) New commits: commit 9d2c9a592ad697fd332b9bccb63e30c955f49422 Author: Michael Weghorn AuthorDate: Thu Aug 25 13:56:53 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 25 14:55:31 2022 +0200 qt a11y: Work around Qt ignoring ActiveDescendantChanged events While Qt has a `QAccessible::ActiveDescendantChanged` event type, events of that type are just ignored in Qt's AT-SPI adapter [1]. Work around that by sending a "focused" event for the child instead, for which handling inside Qt has been added in [2]. While adding support for properly handling `QAccessible::ActiveDescendantChanged` in Qt might be worth looking into at some point, this appears to work just fine for now and e.g. makes Orca announce the focused cell in Calc when moving between cells using the keyboard in the qt6 VCL plugin. [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=0131dbd2f95449c09758208d8b190c9238a5c46a#n1121 [2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=f3509565480107c2587212f7d55cc5f92facc417 Change-Id: I809695de427b6438d37a5a4840044e7ca3d4cd08 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138809 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 53256181ea4e..dd2ee1b2eae6 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include @@ -171,9 +172,23 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible new QAccessibleEvent(pQAccessibleInterface, QAccessible::ActionChanged)); return; case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED: -QAccessible::updateAccessibility( -new QAccessibleEvent(pQAccessibleInterface, QAccessible::ActiveDescendantChanged)); +{ +// Qt has a QAccessible::ActiveDescendantChanged event type, but events of +// that type are currently just ignored on Qt side and not forwarded to AT-SPI. +// Send a state change event for the focused state of the newly +// active descendant instead +uno::Reference xActiveAccessible; +aEvent.NewValue >>= xActiveAccessible; +if (!xActiveAccessible.is()) +return; + +QObject* pQtAcc = QtAccessibleRegistry::getQObject(xActiveAccessible); +QAccessibleInterface* pInterface = QAccessible::queryAccessibleInterface(pQtAcc); +QAccessible::State aState; +aState.focused = true; +QAccessible::updateAccessibility(new QAccessibleStateChangeEvent(pInterface, aState)); return; +} case AccessibleEventId::CARET_CHANGED: { sal_Int32 nNewCursorPos = 0;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |4 1 file changed, 4 insertions(+) New commits: commit 2523b5451507c53bb3a10350e016651db82eb1d1 Author: Michael Weghorn AuthorDate: Mon Aug 22 12:10:17 2022 +0200 Commit: Michael Weghorn CommitDate: Mon Aug 22 14:42:49 2022 +0200 qt a11y: Don't set invalid Qt relations When no matching relation type is found when when trying to match LO's `AccessibleRelationType` to a corresponding Qt equivalent, don't set an invalid value, but skip this relation. Previously, when navigating to a Writer paragraph with the qt6 VCL plugin and Orca enabled, this would show up on stderr: warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 1 warn:vcl.qt:220606:220606:vcl/qt6/../qt5/QtAccessibleWidget.cxx:218: Unmatched relation: 2 Cannot return AT-SPI relation for: QFlags() Cannot return AT-SPI relation for: QFlags() This addresses the warnings emitted by the Qt library (lines 3 and 4). The first two warnings are from LO and remain for now, as long as Qt does not implement an equivalent for `AccessibleRelationType::CONTENT_FLOWS_FROM` and `AccessibleRelationType::CONTENT_FLOWS_TO`. Change-Id: If2cb5394b27d23926e4d4093ba8ab477997a16ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138671 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index e9106f32785a..6bef5de36473 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -242,6 +242,10 @@ void lcl_appendRelation(QVector
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 99 + 1 file changed, 99 insertions(+) New commits: commit 31e40de94c2e1c54b80ba963e26207125ee365e7 Author: Michael Weghorn AuthorDate: Fri Aug 19 16:15:07 2022 +0200 Commit: Michael Weghorn CommitDate: Fri Aug 19 21:49:19 2022 +0200 qt a11y: Report underline text attribute The IAccessible2 doc for text attributes [1] that specifies the format of text attributes also generally used by Qt has three different attributes for underlined text: * "text-underline-style" * "text-underline-type" * "text-underline-width" Map from LO's underline type to all of them where possible. Note however that Qt's AT-SPI adapter only actually maps "text-underline-type" to an AT-SPI equivalent, so e.g. `awt::FontUnderline::WAVE` will just be reported by the Orca screen reader as "underline: single". [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes Change-Id: I8fdca8ff23e0ca9f3e400617b03843439e8e8304 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138532 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 41d4a81a1b15..e9106f32785a 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -866,6 +867,88 @@ OUString lcl_ConvertFontSlant(awt::FontSlant eFontSlant) } } +// s. https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes +// for values +void lcl_ConvertFontUnderline(sal_Int16 nFontUnderline, OUString& rUnderlineStyle, + OUString& rUnderlineType, OUString& rUnderlineWidth) +{ +rUnderlineStyle = u""; +rUnderlineType = u"single"; +rUnderlineWidth = u"auto"; + +switch (nFontUnderline) +{ +case awt::FontUnderline::BOLD: +rUnderlineWidth = u"bold"; +return; +case awt::FontUnderline::BOLDDASH: +rUnderlineWidth = u"bold"; +rUnderlineStyle = u"dash"; +return; +case awt::FontUnderline::BOLDDASHDOT: +rUnderlineWidth = u"bold"; +rUnderlineStyle = u"dot-dash"; +return; +case awt::FontUnderline::BOLDDASHDOTDOT: +rUnderlineWidth = u"bold"; +rUnderlineStyle = u"dot-dot-dash"; +return; +case awt::FontUnderline::BOLDDOTTED: +rUnderlineWidth = u"bold"; +rUnderlineStyle = u"dotted"; +return; +case awt::FontUnderline::BOLDLONGDASH: +rUnderlineWidth = u"bold"; +rUnderlineStyle = u"long-dash"; +return; +case awt::FontUnderline::BOLDWAVE: +rUnderlineWidth = u"bold"; +rUnderlineStyle = u"wave"; +return; +case awt::FontUnderline::DASH: +rUnderlineStyle = u"dash"; +return; +case awt::FontUnderline::DASHDOT: +rUnderlineStyle = u"dot-dash"; +return; +case awt::FontUnderline::DASHDOTDOT: +rUnderlineStyle = u"dot-dot-dash"; +return; +case awt::FontUnderline::DONTKNOW: +rUnderlineWidth = u""; +rUnderlineStyle = u""; +rUnderlineType = u""; +return; +case awt::FontUnderline::DOTTED: +rUnderlineStyle = u"dotted"; +return; +case awt::FontUnderline::DOUBLE: +rUnderlineType = u"double"; +return; +case awt::FontUnderline::DOUBLEWAVE: +rUnderlineStyle = u"wave"; +rUnderlineType = u"double"; +return; +case awt::FontUnderline::LONGDASH: +rUnderlineStyle = u"long-dash"; +return; +case awt::FontUnderline::NONE: +rUnderlineWidth = u"none"; +rUnderlineStyle = u"none"; +rUnderlineType = u"none"; +return; +case awt::FontUnderline::SINGLE: +rUnderlineType = u"single"; +return; +case awt::FontUnderline::SMALLWAVE: +case awt::FontUnderline::WAVE: +rUnderlineStyle = u"wave"; +return; +default: +assert(false && "Unhandled font underline type"); +} +} + /** Converts Color to "rgb(r,g,b)" as specified in https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes. */ OUString lcl_ConvertColor(Color aColor) { @@ -939,6 +1022,22 @@ QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOff const awt::FontSlant eFontSlant = *o3tl::doAccess(prop.Value); sValue = lcl_ConvertFontSlant(eFontSlant); } +else if (prop.Name == "CharUnderline") +{ +OUStr
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) New commits: commit 1188364a28324b50ce40983fe5890cc960c7649f Author: Michael Weghorn AuthorDate: Fri Aug 19 14:46:25 2022 +0200 Commit: Michael Weghorn CommitDate: Fri Aug 19 21:48:54 2022 +0200 qt a11y: Report (background) color text attribute ... using the "rgb(r,g,b)" format as specified in the IAccessible2 spec. Tested that Orca correctly announced both, text and background color in Writer when requesting it to announce the formatting using the Orca_Key+F keyboard shortcut (with Orca_Key being Numpad_Insert by default). Change-Id: Ie8b90dff872d7719617d68cd074efdab10d44dd5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138531 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 9064335c7157..41d4a81a1b15 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -865,6 +865,13 @@ OUString lcl_ConvertFontSlant(awt::FontSlant eFontSlant) return ""; } } + +/** Converts Color to "rgb(r,g,b)" as specified in https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes. */ +OUString lcl_ConvertColor(Color aColor) +{ +return u"rgb(" + OUString::number(aColor.GetRed()) + u"," + OUString::number(aColor.GetGreen()) + + u"," + OUString::number(aColor.GetBlue()) + u")"; +} } // Text attributes are returned in format specified in IAccessible2 spec, since that @@ -904,7 +911,19 @@ QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOff { OUString sAttribute; OUString sValue; -if (prop.Name == "CharFontName") +if (prop.Name == "CharBackColor") +{ +sAttribute = "background-color"; +sValue = lcl_ConvertColor( +Color(ColorTransparency, *o3tl::doAccess(prop.Value))); +} +else if (prop.Name == "CharColor") +{ +sAttribute = "color"; +sValue = lcl_ConvertColor( +Color(ColorTransparency, *o3tl::doAccess(prop.Value))); +} +else if (prop.Name == "CharFontName") { sAttribute = "font-family"; sValue = *o3tl::doAccess(prop.Value);
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 29 + 1 file changed, 29 insertions(+) New commits: commit 99841da686625428b8ad2e219dd19e5fbfb145f5 Author: Michael Weghorn AuthorDate: Tue Jul 20 13:23:21 2021 +0200 Commit: Michael Weghorn CommitDate: Fri Aug 19 21:48:29 2022 +0200 qt a11y: Report font style text attribute (e.g. italic) While the Qt doc for `QAccessibleTextInterface::attributes` [1] doesn't mention what format the returned string should have to report the attributes, the expected format for the text attributes is as specified in the IAccessible2 doc for text attributes [2], and Qt's AT-SPI adapter then converts that to the format as needed for AT-SPI, s. [3]. Tested that Orca correctly announces "style: italic" when requesting it to announce the formatting using the Orca_Key+F keyboard shortcut (with Orca_Key being Numpad_Insert by default). [1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes [2] https://doc.qt.io/qt-6/qaccessibletextinterface.html#attributes [3] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=4842cc176881ae22e14ca193fba46c6a04d09530#n1924 Change-Id: I9877d1be0b6c9b82815e57f35ae28abe2ed99851 Include Change-Id: Iddf974540c71f91d4078c2f99daa320474a445a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138530 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 876b735b0e48..9064335c7157 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -845,8 +846,30 @@ OUString lcl_convertFontWeight(double fontWeight) // awt::FontWeight::DONTKNOW || fontWeight == awt::FontWeight::NORMAL return "normal"; } + +OUString lcl_ConvertFontSlant(awt::FontSlant eFontSlant) +{ +switch (eFontSlant) +{ +case awt::FontSlant::FontSlant_NONE: +return "normal"; +case awt::FontSlant::FontSlant_OBLIQUE: +case awt::FontSlant::FontSlant_REVERSE_OBLIQUE: +return "oblique"; +case awt::FontSlant::FontSlant_ITALIC: +case awt::FontSlant::FontSlant_REVERSE_ITALIC: +return "italic"; +case awt::FontSlant::FontSlant_DONTKNOW: +case awt::FontSlant::FontSlant_MAKE_FIXED_SIZE: +default: +return ""; +} +} } +// Text attributes are returned in format specified in IAccessible2 spec, since that +// is what Qt handles: +// https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOffset) const { if (startOffset == nullptr || endOffset == nullptr) @@ -891,6 +914,12 @@ QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOff sAttribute = "font-size"; sValue = OUString::number(*o3tl::doAccess(prop.Value)) + "pt"; } +else if (prop.Name == "CharPosture") +{ +sAttribute = "font-style"; +const awt::FontSlant eFontSlant = *o3tl::doAccess(prop.Value); +sValue = lcl_ConvertFontSlant(eFontSlant); +} else if (prop.Name == "CharWeight") { sAttribute = "font-weight";
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 04af1b4e1ce5e3e74bad517a238957bf9aaccdcd Author: Michael Weghorn AuthorDate: Tue Aug 16 14:25:18 2022 +0200 Commit: Michael Weghorn CommitDate: Tue Aug 16 22:29:57 2022 +0200 qt a11y: Drop duplicate nullptr check There is already a check whether `object` is a nullptr just a few lines above, so this check is superfluous since commit f29e3dbe015571d49d4262f4623a165a0cbc94a3 Author: Michael Weghorn Date: Tue Aug 16 09:39:01 2022 +0200 qt a11y: Replace dynamic_cast with static_cast Reported by cppcheck: > .../vcl/qt5/QtAccessibleWidget.cxx:751: Condition 'pXAccessible' is always true Change-Id: Iab69c967d97fc01dad617a25503cc5b5e50a3b4f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138366 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 09d01c6e496f..876b735b0e48 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -748,7 +748,7 @@ QAccessibleInterface* QtAccessibleWidget::customFactory(const QString& classname if (classname == QLatin1String("QtXAccessible") && object) { QtXAccessible* pXAccessible = static_cast(object); -if (pXAccessible && pXAccessible->m_xAccessible.is()) +if (pXAccessible->m_xAccessible.is()) { QtAccessibleWidget* pRet = new QtAccessibleWidget(pXAccessible->m_xAccessible, object); // clear the reference in the QtXAccessible, no longer needed now that the QtAccessibleWidget holds one
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) New commits: commit a3f3453c00f701ea51f67896e633bb6b6a6a2d71 Author: Michael Weghorn AuthorDate: Tue Aug 16 10:38:46 2022 +0200 Commit: Michael Weghorn CommitDate: Tue Aug 16 13:13:46 2022 +0200 qt a11y: Implement QtAccessibleWidget::indexOfChild With this in place, selecting an object in Accerciser's tree view of the LO a11y hierarchy and then calling the method to get the child index returns the actual child index instead of just 0, e.g.: In [24]: acc.getIndexInParent() Out[24]: 4 Change-Id: Ia3d4811226d6ffc82b86ed5a9abf3332b8b50b0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138347 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 9d2b17f86de7..7fa4cd297778 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -145,7 +145,23 @@ int QtAccessibleWidget::childCount() const return xAc->getAccessibleChildCount(); } -int QtAccessibleWidget::indexOfChild(const QAccessibleInterface* /* child */) const { return 0; } +int QtAccessibleWidget::indexOfChild(const QAccessibleInterface* pChild) const +{ +const QtAccessibleWidget* pAccessibleWidget = dynamic_cast(pChild); +if (!pAccessibleWidget) +{ +SAL_WARN( +"vcl.qt", +"QtAccessibleWidget::indexOfChild called with child that is no QtAccessibleWidget"); +return -1; +} + +Reference xContext = pAccessibleWidget->getAccessibleContextImpl(); +if (!xContext.is()) +return -1; + +return xContext->getAccessibleIndexInParent(); +} namespace {
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit f29e3dbe015571d49d4262f4623a165a0cbc94a3 Author: Michael Weghorn AuthorDate: Tue Aug 16 09:39:01 2022 +0200 Commit: Michael Weghorn CommitDate: Tue Aug 16 11:43:44 2022 +0200 qt a11y: Replace dynamic_cast with static_cast The Qt doc on implementing accessible plugins [1] says: > Note that `object` will always be an instance of `classname`. Therefore, `static_cast` can be used here to avoid the cost of `dynamic_cast`. [1] https://doc.qt.io/qt-6/accessible-qwidget.html#implementing-accessible-plugins Change-Id: I57721c927808fa710b7d790c54d01bd899146a60 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138341 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index c0ed4a2096f7..9d2b17f86de7 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -730,7 +730,7 @@ QAccessibleInterface* QtAccessibleWidget::customFactory(const QString& classname } if (classname == QLatin1String("QtXAccessible") && object) { -QtXAccessible* pXAccessible = dynamic_cast(object); +QtXAccessible* pXAccessible = static_cast(object); if (pXAccessible && pXAccessible->m_xAccessible.is()) return new QtAccessibleWidget(pXAccessible->m_xAccessible, object); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 2de74491a5a7b2183cce977f8ffaf81d0df11d75 Author: Michael Weghorn AuthorDate: Wed Aug 10 16:59:50 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 11 08:47:21 2022 +0200 qt a11y: Use correct coord system in QtAccessibleWidget::childAt `QAccessibleInterface::childAt` uses screen coordinates, but `XAccessibleComponent::getAccessibleAtPoint` wants local coordinates (i.e. coordinates relative to the object's top left corner), so convert accordingly. Change-Id: I61ab695ea6fdaf336903a0dc7d4c50c90a14e656 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138096 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 90f345919ef7..c0ed4a2096f7 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -711,8 +711,11 @@ QAccessibleInterface* QtAccessibleWidget::childAt(int x, int y) const return nullptr; Reference xAccessibleComponent(xAc, UNO_QUERY); +// convert from screen to local coordinates +QPoint aLocalCoords = QPoint(x, y) - rect().topLeft(); return QAccessible::queryAccessibleInterface( -new QtXAccessible(xAccessibleComponent->getAccessibleAtPoint(awt::Point(x, y; +new QtXAccessible(xAccessibleComponent->getAccessibleAtPoint( +awt::Point(aLocalCoords.x(), aLocalCoords.y(); } QAccessibleInterface* QtAccessibleWidget::customFactory(const QString& classname, QObject* object)
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 86 - 1 file changed, 76 insertions(+), 10 deletions(-) New commits: commit 38289a8abed7dc2a34035d579bf8f0dbbf058d67 Author: Michael Weghorn AuthorDate: Wed Aug 10 15:21:39 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 11 08:46:19 2022 +0200 qt a11y: Implement QtAccessibleWidget::text{After,Before}Offset In a quick test with a Writer paragraph having the text "Abcd efgh ijkl" selected in Accerciser's treeview of the LO a11y hierarchy, the results of running these commands looked as expected: In [28]: text = acc.queryText() In [29]: text.getTextBeforeOffset(4, pyatspi.text.TEXT_BOUNDARY_CHAR) Out[29]: ('d', 3, 4) In [30]: text.getTextAfterOffset(4, pyatspi.text.TEXT_BOUNDARY_CHAR) Out[30]: ('e', 5, 6) In [31]: text.getTextBeforeOffset(4, pyatspi.text.TEXT_BOUNDARY_WORD_START) Out[31]: ('Abcd', 0, 4) In [32]: text.getTextAfterOffset(4, pyatspi.text.TEXT_BOUNDARY_WORD_START) Out[32]: ('efgh', 5, 9) Change-Id: Icc310c05634763e92c298e793d87a603b654ac4c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138092 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index ac60b3746803..90f345919ef7 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -1023,12 +1023,46 @@ QString QtAccessibleWidget::text(int startOffset, int endOffset) const return toQString(xText->getTextRange(startOffset, endOffset)); } -QString QtAccessibleWidget::textAfterOffset(int /* offset */, -QAccessible::TextBoundaryType /* boundaryType */, -int* /* startOffset */, int* /* endOffset */) const +QString QtAccessibleWidget::textAfterOffset(int nOffset, +QAccessible::TextBoundaryType eBoundaryType, +int* pStartOffset, int* pEndOffset) const { -SAL_INFO("vcl.qt", "Unsupported QAccessibleTextInterface::textAfterOffset"); -return QString(); +if (pStartOffset == nullptr || pEndOffset == nullptr) +return QString(); + +*pStartOffset = -1; +*pEndOffset = -1; + +Reference xText(getAccessibleContextImpl(), UNO_QUERY); +if (!xText.is()) +return QString(); + +const int nCharCount = characterCount(); +// -1 is special value for text length +if (nOffset == -1) +nOffset = nCharCount; +else if (nOffset < -1 || nOffset > nCharCount) +{ +SAL_WARN("vcl.qt", + "QtAccessibleWidget::textAfterOffset called with invalid offset: " << nOffset); +return QString(); +} + +if (eBoundaryType == QAccessible::NoBoundary) +{ +if (nOffset == nCharCount) +return QString(); +*pStartOffset = nOffset + 1; +*pEndOffset = nCharCount; +return text(nOffset + 1, nCharCount); +} + +sal_Int16 nUnoBoundaryType = lcl_matchQtTextBoundaryType(eBoundaryType); +assert(nUnoBoundaryType > 0); +const TextSegment aSegment = xText->getTextBehindIndex(nOffset, nUnoBoundaryType); +*pStartOffset = aSegment.SegmentStart; +*pEndOffset = aSegment.SegmentEnd; +return toQString(aSegment.SegmentText); } QString QtAccessibleWidget::textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, @@ -1069,12 +1103,44 @@ QString QtAccessibleWidget::textAtOffset(int offset, QAccessible::TextBoundaryTy return toQString(segment.SegmentText); } -QString QtAccessibleWidget::textBeforeOffset(int /* offset */, - QAccessible::TextBoundaryType /* boundaryType */, - int* /* startOffset */, int* /* endOffset */) const +QString QtAccessibleWidget::textBeforeOffset(int nOffset, + QAccessible::TextBoundaryType eBoundaryType, + int* pStartOffset, int* pEndOffset) const { -SAL_INFO("vcl.qt", "Unsupported QAccessibleTextInterface::textBeforeOffset"); -return QString(); +if (pStartOffset == nullptr || pEndOffset == nullptr) +return QString(); + +*pStartOffset = -1; +*pEndOffset = -1; + +Reference xText(getAccessibleContextImpl(), UNO_QUERY); +if (!xText.is()) +return QString(); + +const int nCharCount = characterCount(); +// -1 is special value for text length +if (nOffset == -1) +nOffset = nCharCount; +else if (nOffset < -1 || nOffset > nCharCount) +{ +SAL_WARN("vcl.qt", + "QtAccessibleWidget::textBeforeOffset called with invalid offset: " << nOffset); +return QString(); +} + +if (eBoundaryType == QAccessible::NoBoundary) +
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 96 - 1 file changed, 85 insertions(+), 11 deletions(-) New commits: commit 69ecff82d0e5a0592f9bf6aa4fee364ff1c9754c Author: Michael Weghorn AuthorDate: Wed Aug 10 08:47:07 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 11 08:46:03 2022 +0200 qt a11y: Check range for offset passed to text methods Otherwise LO crashes when invalid offsets are passed from AT when using the qt5/qt6/kf5 VCL plugins. One scenario that resulted in a crash: * start Accerciser * start Calc * press F2 in cell A1 to enter edit mode * navigate to the "Cell A1" object representing the editable cell, then to its paragraph child in Accerciser's treeview of the LO a11y hierarchy * in Accerciser's "Interface Viewer", type Enter, then any character This would crash due to a `com::sun::star::lang::IndexOutOfBoundsException` being thrown by one of the methods of the XAccessibleText/XAccessibleEditableText interfaces. Change-Id: I1b8c6057ca1e4e4485d516418bb82cd1a6697ce1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138078 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index a7d0457801e6..ac60b3746803 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -844,7 +844,10 @@ QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOff offset = nTextLength - 1; if (offset < 0 || offset > nTextLength) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::attributes called with invalid offset: " << offset); return QString(); +} const Sequence attribs = xText->getCharacterAttributes(offset, Sequence()); @@ -887,6 +890,7 @@ int QtAccessibleWidget::characterCount() const return xText->getCharacterCount(); return 0; } + QRect QtAccessibleWidget::characterRect(int nOffset) const { Reference xText(getAccessibleContextImpl(), UNO_QUERY); @@ -931,11 +935,21 @@ void QtAccessibleWidget::removeSelection(int /* selectionIndex */) { SAL_INFO("vcl.qt", "Unsupported QAccessibleTextInterface::removeSelection"); } + void QtAccessibleWidget::scrollToSubstring(int startIndex, int endIndex) { Reference xText(getAccessibleContextImpl(), UNO_QUERY); -if (xText.is()) -xText->scrollSubstringTo(startIndex, endIndex, AccessibleScrollType_SCROLL_ANYWHERE); +if (!xText.is()) +return; + +sal_Int32 nTextLength = xText->getCharacterCount(); +if (startIndex < 0 || startIndex > nTextLength || endIndex < 0 || endIndex > nTextLength) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::scrollToSubstring called with invalid offset."); +return; +} + +xText->scrollSubstringTo(startIndex, endIndex, AccessibleScrollType_SCROLL_ANYWHERE); } void QtAccessibleWidget::selection(int selectionIndex, int* startOffset, int* endOffset) const @@ -960,25 +974,55 @@ int QtAccessibleWidget::selectionCount() const return 1; // Only 1 selection supported atm return 0; } + void QtAccessibleWidget::setCursorPosition(int position) { Reference xText(getAccessibleContextImpl(), UNO_QUERY); -if (xText.is()) -xText->setCaretPosition(position); +if (!xText.is()) +return; + +if (position < 0 || position > xText->getCharacterCount()) +{ +SAL_WARN("vcl.qt", + "QtAccessibleWidget::setCursorPosition called with invalid offset: " << position); +return; +} + +xText->setCaretPosition(position); } + void QtAccessibleWidget::setSelection(int /* selectionIndex */, int startOffset, int endOffset) { Reference xText(getAccessibleContextImpl(), UNO_QUERY); -if (xText.is()) -xText->setSelection(startOffset, endOffset); +if (!xText.is()) +return; + +sal_Int32 nTextLength = xText->getCharacterCount(); +if (startOffset < 0 || startOffset > nTextLength || endOffset < 0 || endOffset > nTextLength) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::setSelection called with invalid offset."); +return; +} + +xText->setSelection(startOffset, endOffset); } + QString QtAccessibleWidget::text(int startOffset, int endOffset) const { Reference xText(getAccessibleContextImpl(), UNO_QUERY); -if (xText.is()) -return toQString(xText->getTextRange(startOffset, endOffset)); -return QString(); +if (!xText.is()) +return QString(); + +sal_Int32 nTextLength = xText->getCharacterCount(); +if (startOffset < 0 || startOffset > nTextLength || endOffset < 0 || endOffset > nTextLength) +{ +SAL_WARN("vcl.qt", "QtAccessibleWidget::text called with invalid offset."); +return QString(); +} + +return toQString(xText->getTextRange(startOffset, endO
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) New commits: commit 892bd0dfc1b107a5b00af36a0d0db1f9f9c05147 Author: Michael Weghorn AuthorDate: Tue Aug 9 11:31:30 2022 +0200 Commit: Michael Weghorn CommitDate: Tue Aug 9 13:33:07 2022 +0200 qt a11y: Return actual range of text with same attributes The start and end offset returned by `QAccessibleTextInterface::attributes` should indicate the start and end of a text segment where all characters have the same text attributes (like font size, color,...). Calling `XAccessibleText::getTextAtIndex` with type `accessibility::AccessibleTextType::ATTRIBUTE_RUN` gives exactly that information, so make use of it instead of claiming that only the character itself has those attributes. This is e.g. used in Accerciser's "Interface Viewer" for the text interface, to display the indices and highlight the text portion in which all characters have the same attributes. Change-Id: Iefb096f30c9df74f035d2fda86299d9a5de5d604 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138008 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 940d8c29f513..a7d0457801e6 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -872,8 +872,11 @@ QString QtAccessibleWidget::attributes(int offset, int* startOffset, int* endOff if (!sAttribute.isEmpty() && !sValue.isEmpty()) aRet += sAttribute + ":" + sValue + ";"; } -*startOffset = offset; -*endOffset = offset + 1; + +accessibility::TextSegment aAttributeRun += xText->getTextAtIndex(offset, accessibility::AccessibleTextType::ATTRIBUTE_RUN); +*startOffset = aAttributeRun.SegmentStart; +*endOffset = aAttributeRun.SegmentEnd; return toQString(aRet); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtWidget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1703c3bb70b1faa522c33ebdc1a8f353c60367e5 Author: Michael Weghorn AuthorDate: Tue Aug 9 09:01:52 2022 +0200 Commit: Michael Weghorn CommitDate: Tue Aug 9 10:00:27 2022 +0200 tdf#149818 qt: Handle double mouse click again Qt has `QEvent::MouseButtonDblClick` as a specialized type for "Mouse press again" [1] in addition to just `QEvent::MouseButtonPress` for a single click. Handle that as mouse button down event in LO as well, to make handling of double-click work again after commit 393c9f736b10d1ea82979e9c2c43c8f91ba5831d Date: Tue Apr 19 16:00:31 2022 +0200 Qt use QEvent::type to handle the event correctly [1] https://doc.qt.io/qt-6/qevent.html Change-Id: I9964b554bf71f30861ed0868e7a8000c84de50ac Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138006 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index ead9979fcf21..c204d1be19a9 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -184,7 +184,7 @@ void QtWidget::handleMouseButtonEvent(const QtFrame& rFrame, const QMouseEvent* } SalEvent nEventType; -if (pEvent->type() == QEvent::MouseButtonPress) +if (pEvent->type() == QEvent::MouseButtonPress || pEvent->type() == QEvent::MouseButtonDblClick) nEventType = SalEvent::MouseButtonDown; else nEventType = SalEvent::MouseButtonUp;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) New commits: commit 3cf7b358799dfde4da1df3f0b9d6cf726d22a22b Author: Michael Weghorn AuthorDate: Thu Aug 4 14:13:35 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 4 22:42:23 2022 +0200 qt a11y: Implement QtAccessibleWidget::offsetAtPoint Since `QAccessibleTextInterface::offsetAtPoint` uses screen coordinates, but `XAccessibleText::getIndexAtPoint` takes local coordinates (i.e. position within the object itself), convert that first. Tested as follows: 1) start new document in Writer 2) paste this text into the first paragraph: "Hello world, this is some test text. Lorem ipsum." 3) start Accerciser 4) select the paragraph in Accerciser's tree view of the LO a11y hierarchy. 5) use Accerciser's IPython console to check the results returned by calling the corresponding AT-SPI methods: In [69]: acc.queryText().getOffsetAtPoint(acc.get_position(pyatspi.component.XY_SCREEN).x + 200, acc.get_position(pyatspi.component.XY_SCREEN).y + 5, pyatspi.component.XY_SCREEN) Out[69]: 20 In [70]: acc.queryText().getOffsetAtPoint(acc.get_position(pyatspi.component.XY_SCREEN).x + 250, acc.get_position(pyatspi.component.XY_SCREEN).y + 5, pyatspi.component.XY_SCREEN) Out[70]: 27 In [71]: acc.queryText().getOffsetAtPoint(acc.get_position(pyatspi.component.XY_SCREEN).x + 300, acc.get_position(pyatspi.component.XY_SCREEN).y + 5, pyatspi.component.XY_SCREEN) Out[71]: 37 With this change and the Qt changes mentioned in commit 35be93f83ac866ef18f0e06853c9818cd1d1bd56 Date: Wed Aug 3 09:18:46 2022 +0200 qt a11y: Implement QtAccessibleWidget::characterRect , the results with the qt6 VCL plugin are the same as with the gtk3 one. Change-Id: Ie75fa9b7a64c413251c771f0379d9f3a3b200c30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137795 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 493292537050..940d8c29f513 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -912,11 +912,18 @@ int QtAccessibleWidget::cursorPosition() const return 0; } -int QtAccessibleWidget::offsetAtPoint(const QPoint& /* point */) const +int QtAccessibleWidget::offsetAtPoint(const QPoint& rPoint) const { -SAL_INFO("vcl.qt", "Unsupported QAccessibleTextInterface::offsetAtPoint"); -return 0; +Reference xText(getAccessibleContextImpl(), UNO_QUERY); +if (!xText.is()) +return -1; + +// convert from screen to local coordinates +QPoint aLocalCoords = rPoint - rect().topLeft(); +awt::Point aPoint(aLocalCoords.x(), aLocalCoords.y()); +return xText->getIndexAtPoint(aPoint); } + void QtAccessibleWidget::removeSelection(int /* selectionIndex */) { SAL_INFO("vcl.qt", "Unsupported QAccessibleTextInterface::removeSelection");
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 40 1 file changed, 36 insertions(+), 4 deletions(-) New commits: commit 12f96c3d0f61018cfa83c940765311aa9015f60a Author: Michael Weghorn AuthorDate: Thu Aug 4 13:27:32 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 4 19:34:50 2022 +0200 qt a11y: implement QtAccessibleWidget::{row,column}HeaderCells Implement these methods inherited from `QAccessibleTableCellInterface` by retrieving all row/column headers from the table (= cell's parent object) and only returning those for the row/column that the cell itself is in. Tested with Accerciser and the qt6 VCL plugin as follows: 1) start LO Writer, "Table" -> "Insert Table" 2) select to create table with 2 rows, 2 columns 3) make sure "Heading" is checked, "Heading rows": 1 4) "Insert" 5) in the first row, type "First heading" into first column, "Second heading" into second column 5) start Accerciser 7) select the table element in Accerciser's treeview of the a11y hierarchy 8) type these in Accerciser's IPython console: In [10]: acc.queryTable().getColumnHeader(0).name Out[10]: 'A1' In [11]: acc.queryTable().getColumnHeader(0).get_child_at_index(0).queryText().getText(0, -1) Out[11]: 'First heading' In [12]: acc.queryTable().getColumnHeader(1).name Out[12]: 'B1' In [13]: acc.queryTable().getColumnHeader(1).get_child_at_index(0).queryText().getText(0, -1) Out[13]: 'Second heading' Change-Id: I69b9bd10bfe4076de9e4a05fe4aff97d1bfa4118 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137794 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 0e9c083043a2..493292537050 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -1371,8 +1371,24 @@ bool QtAccessibleWidget::unselectRow(int row) // QAccessibleTableCellInterface QList QtAccessibleWidget::columnHeaderCells() const { -SAL_WARN("vcl.qt", "Unsupported QAccessibleTableCellInterface::columnHeaderCells"); -return QList(); +Reference xTable = getAccessibleTableForParent(); +if (!xTable.is()) +return QList(); + +Reference xHeaders = xTable->getAccessibleColumnHeaders(); +if (!xHeaders.is()) +return QList(); + +const sal_Int32 nCol = columnIndex(); +QList aHeaderCells; +for (sal_Int32 nRow = 0; nRow < xHeaders->getAccessibleRowCount(); nRow++) +{ +Reference xCell = xHeaders->getAccessibleCellAt(nRow, nCol); +QAccessibleInterface* pInterface += QAccessible::queryAccessibleInterface(new QtXAccessible(xCell)); +aHeaderCells.push_back(pInterface); +} +return aHeaderCells; } int QtAccessibleWidget::columnIndex() const @@ -1421,8 +1437,24 @@ int QtAccessibleWidget::columnExtent() const QList QtAccessibleWidget::rowHeaderCells() const { -SAL_WARN("vcl.qt", "Unsupported QAccessibleTableCellInterface::rowHeaderCells"); -return QList(); +Reference xTable = getAccessibleTableForParent(); +if (!xTable.is()) +return QList(); + +Reference xHeaders = xTable->getAccessibleRowHeaders(); +if (!xHeaders.is()) +return QList(); + +const sal_Int32 nRow = rowIndex(); +QList aHeaderCells; +for (sal_Int32 nCol = 0; nCol < xHeaders->getAccessibleColumnCount(); nCol++) +{ +Reference xCell = xHeaders->getAccessibleCellAt(nRow, nCol); +QAccessibleInterface* pInterface += QAccessible::queryAccessibleInterface(new QtXAccessible(xCell)); +aHeaderCells.push_back(pInterface); +} +return aHeaderCells; } int QtAccessibleWidget::rowExtent() const
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 32 1 file changed, 28 insertions(+), 4 deletions(-) New commits: commit c03a262c477b73aa170c6a38703d0930486255e5 Author: Michael Weghorn AuthorDate: Thu Aug 4 11:52:43 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 4 19:34:27 2022 +0200 qt a11y: Implement QtAccessibleWidget::selectedCell{s,Count} Change-Id: I728456d27211916010c0174fa71b0125c7530707 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137793 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 789de70d1311..0e9c083043a2 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -1250,14 +1251,37 @@ bool QtAccessibleWidget::selectRow(int row) int QtAccessibleWidget::selectedCellCount() const { -SAL_INFO("vcl.qt", "Unsupported QAccessibleTableInterface::selectedCellCount"); -return 0; +Reference xAcc = getAccessibleContextImpl(); +if (!xAcc.is()) +return 0; + +Reference xSelection(xAcc, UNO_QUERY); +if (!xSelection.is()) +return 0; + +return xSelection->getSelectedAccessibleChildCount(); } QList QtAccessibleWidget::selectedCells() const { -SAL_INFO("vcl.qt", "Unsupported QAccessibleTableInterface::selectedCells"); -return QList(); +Reference xAcc = getAccessibleContextImpl(); +if (!xAcc.is()) +return QList(); + +Reference xSelection(xAcc, UNO_QUERY); +if (!xSelection.is()) +return QList(); + +QList aSelectedCells; +const sal_Int32 nSelected = xSelection->getSelectedAccessibleChildCount(); +for (int i = 0; i < nSelected; i++) +{ +Reference xChild = xSelection->getSelectedAccessibleChild(i); +QAccessibleInterface* pInterface += QAccessible::queryAccessibleInterface(new QtXAccessible(xChild)); +aSelectedCells.push_back(pInterface); +} +return aSelectedCells; } int QtAccessibleWidget::selectedColumnCount() const
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 7f5cab0cf4aa25cf3b84a39b0f9e41de51928fbc Author: Michael Weghorn AuthorDate: Thu Aug 4 09:42:15 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 4 16:19:08 2022 +0200 qt a11y: Map BUTTON_{DROPDOWN,MENU} to Qt equivalents There are specialised roles for these 2 button types in Qt as well. Change-Id: I67f49f0c4afc5f20a8c42fa2388f08ea9d950b91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137785 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 367981b8678a..789de70d1311 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -475,9 +475,9 @@ QAccessible::Role QtAccessibleWidget::role() const case AccessibleRole::VIEW_PORT: return QAccessible::UserRole; case AccessibleRole::BUTTON_DROPDOWN: -return QAccessible::Button; +return QAccessible::ButtonDropDown; case AccessibleRole::BUTTON_MENU: -return QAccessible::Button; +return QAccessible::ButtonMenu; case AccessibleRole::CAPTION: return QAccessible::StaticText; case AccessibleRole::CHART:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |2 ++ 1 file changed, 2 insertions(+) New commits: commit ba31e1bfdbcb836ba0fb4ea795997ce788b21e11 Author: Michael Weghorn AuthorDate: Thu Aug 4 09:29:14 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 4 13:12:40 2022 +0200 qt a11y: Map AccessibleRole::FILE_CHOOSER Qt doesn't have an extra role for this, so use the dialog role, since `AccessibleRole::FILE_CHOOSER` is for a "specialized dialog that displays the files in the directory and lets the user select a file, browse a different directory, or specify a filename." Change-Id: Ib17b573dcd149148e72e1a47922dccf6f8fb67d5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137784 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 0599b595f7fe..367981b8678a 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -373,6 +373,8 @@ QAccessible::Role QtAccessibleWidget::role() const return QAccessible::UserRole; case AccessibleRole::END_NOTE: return QAccessible::Note; +case AccessibleRole::FILE_CHOOSER: +return QAccessible::Dialog; case AccessibleRole::FILLER: return QAccessible::Whitespace; case AccessibleRole::FONT_CHOOSER:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) New commits: commit 99640693d28ca11b31a1d3855e104d2d8c5122d7 Author: Michael Weghorn AuthorDate: Wed Aug 3 16:49:48 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 4 08:35:31 2022 +0200 qt a11y: Implement QtAccessibleWidget::window Quoting the Qt doc [1]: > Returns the window associated with the underlying object. > For instance, QAccessibleWidget reimplements this and returns > the windowHandle() of the QWidget. > > It is used on some platforms to be able to notify the AT client > about state changes. The backend will traverse up all ancestors > until it finds a window. (This means that at least one interface > among the ancestors should return a valid QWindow > pointer). Check if the associated QObject is a QWidget and if so, get the associated window, otherwise walk up the a11y tree. Note however that this change alone is not yet sufficient for a window to actually be returned for any arbitrary a11y object deeper down the hierarchy. This is because walking up the a11y hierarchy currently results in new Qt a11y objects being created for the parents instead of using existing ones, and the newly created ones lack the association to the widgets. (This works in a WIP branch that remembers/caches a11y objects, but that needs some additional work before it can be merged.) [1] https://doc.qt.io/qt-5/qaccessibleinterface.html#window Change-Id: Iba05f7bd3fba30fb2ca741179abbda2d60bee980 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137753 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 1634912c8fa7..a73681cdf417 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -117,7 +117,23 @@ QtAccessibleWidget::getAccessibleTableForParent() const return Reference(xParentContext, UNO_QUERY); } -QWindow* QtAccessibleWidget::window() const { return nullptr; } +QWindow* QtAccessibleWidget::window() const +{ +assert(m_pObject); +if (m_pObject->isWidgetType()) +{ +QWidget* pWidget = static_cast(m_pObject); +QWidget* pWindow = pWidget->window(); +if (pWindow) +return pWindow->windowHandle(); +} + +QAccessibleInterface* pParent = parent(); +if (pParent) +return pParent->window(); + +return nullptr; +} int QtAccessibleWidget::childCount() const {
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) New commits: commit 2690b0079c160ab68b98d720432bb0949624c78b Author: Michael Weghorn AuthorDate: Wed Aug 3 14:14:27 2022 +0200 Commit: Michael Weghorn CommitDate: Thu Aug 4 08:34:31 2022 +0200 qt a11y: Consider QObject hierarchy to find parent The a11y hierarchy of the whole application includes a11y objects that have no LO-internal a11y objects associated with them, but are handled solely by the Qt library, like the Qt application at the root of the a11y hierarchy. Therefore, fall back to using the QObject hierarchy when looking for the parent of an a11y object. This e.g. makes the scenario of starting at the top-level application object, moving the hierarchy down two levels, then up again work, which now and ends up at the application object again. With the application a11y object ("soffice.bin") selected in the Accerciser tree view of the a11y hierarchy, this can be achieved with the following commands in Accerciser's IPython console: In [4]: acc.name Out[5]: 'soffice.bin' In [5]: acc.get_child_at_index(0).get_child_at_index(0).get_parent().get_parent().name Out[6]: 'soffice.bin' It previously failed like this, which is one of the reasons why restoring bookmarks in Accerciser didn't work when using the qt6 VCL plugin: In [1]: acc.get_child_at_index(0).get_child_at_index(0).get_parent().get_parent().name --- AttributeErrorTraceback (most recent call last) /usr/lib/python3/dist-packages/pyatspi/__init__.py in > 1 acc.get_child_at_index(00).get_child_at_index(0)0.(get_parent).(get_parent).nameAttributeError In [1]: acc.get_child_at_index(0).get_child_at_index(0) Out[2]: In [2]: acc.get_child_at_index(0).get_child_at_index(0).name Out[3]: 'VCL ImplGetDefaultWindow (Type = 362)' In [3]: acc.get_child_at_index(0).get_child_at_index(0).get_parent() In [4]: acc.get_child_at_index(0).get_child_at_index(0).get_parent() == None Out[5]: True Change-Id: Iba197a2e943671591fa0ee5641a7b330eae8822a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137747 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index fd0a858c564c..1634912c8fa7 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -275,8 +275,19 @@ QAccessibleInterface* QtAccessibleWidget::parent() const if (!xAc.is()) return nullptr; -return QAccessible::queryAccessibleInterface(new QtXAccessible(xAc->getAccessibleParent())); +if (xAc->getAccessibleParent().is()) +return QAccessible::queryAccessibleInterface(new QtXAccessible(xAc->getAccessibleParent())); + +// go via the QObject hierarchy; some a11y objects like the application +// (at the root of the a11y hierarchy) are handled solely by Qt and have +// no LO-internal a11y objects associated with them +QObject* pObj = object(); +if (pObj && pObj->parent()) +return QAccessible::queryAccessibleInterface(pObj->parent()); + +return nullptr; } + QAccessibleInterface* QtAccessibleWidget::child(int index) const { Reference xAc = getAccessibleContextImpl();
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 20 +--- 1 file changed, 17 insertions(+), 3 deletions(-) New commits: commit 35be93f83ac866ef18f0e06853c9818cd1d1bd56 Author: Michael Weghorn AuthorDate: Wed Aug 3 09:18:46 2022 +0200 Commit: Michael Weghorn CommitDate: Wed Aug 3 11:16:49 2022 +0200 qt a11y: Implement QtAccessibleWidget::characterRect With this and the suggested changes ([1], [2], [3], [4]) for 4 Qt issues I ran into ([5], [6], [7], [8]), the Accerciser scenario described in commit 7b312771d7eb33f7410167e36efdaeca6f540b1c Date: Thu Jul 14 08:35:53 2022 +0200 tdf#149952 gtk3 a11y: Return pos relative to window when requested works for the qt6 VCL plugin as well. (The complete GNOME Magnifier scenario from tdf#149952 still doesn't work with qt6, probably because a11y events are not sent (reliably) so far.) [1] https://codereview.qt-project.org/c/qt/qtbase/+/422251/1 [2] https://codereview.qt-project.org/c/qt/qtbase/+/422333/1 [3] https://codereview.qt-project.org/c/qt/qtbase/+/424510/2 [4] https://codereview.qt-project.org/c/qt/qtbase/+/424731/1 [5] https://bugreports.qt.io/browse/QTBUG-105031 [6] https://bugreports.qt.io/browse/QTBUG-105042 [7] https://bugreports.qt.io/browse/QTBUG-105281 [8] https://bugreports.qt.io/browse/QTBUG-105313 Change-Id: Iaccc89bf62c4617bee06f34ffebbd309a62212e9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137735 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 74dc79cb7023..fd0a858c564c 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -941,10 +941,24 @@ int QtAccessibleWidget::characterCount() const return xText->getCharacterCount(); return 0; } -QRect QtAccessibleWidget::characterRect(int /* offset */) const +QRect QtAccessibleWidget::characterRect(int nOffset) const { -SAL_INFO("vcl.qt", "Unsupported QAccessibleTextInterface::characterRect"); -return QRect(); +Reference xText(getAccessibleContextImpl(), UNO_QUERY); +if (!xText.is()) +return QRect(); + +if (nOffset < 0 || nOffset > xText->getCharacterCount()) +{ +SAL_WARN("vcl.qt", + "QtAccessibleWidget::characterRect called with invalid offset: " << nOffset); +return QRect(); +} + +const awt::Rectangle aBounds = xText->getCharacterBounds(nOffset); +const QRect aRect(aBounds.X, aBounds.Y, aBounds.Width, aBounds.Height); +// convert to screen coordinates +const QRect aScreenPos = rect(); +return aRect.translated(aScreenPos.x(), aScreenPos.y()); } int QtAccessibleWidget::cursorPosition() const
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtTools.cxx |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) New commits: commit e50ff311ceda513fdcff4b73546d039bb847a0b9 Author: offtkp AuthorDate: Sat Jul 16 19:08:22 2022 +0300 Commit: Tomaž Vajngerl CommitDate: Tue Jul 19 13:21:20 2022 +0200 Replace old png writer in QtTools.cxx Change-Id: I4f6438b811e7e97aedda90508423982cb82e0008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137131 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl diff --git a/vcl/qt5/QtTools.cxx b/vcl/qt5/QtTools.cxx index f9a0a0e0e328..030b3af2b5a3 100644 --- a/vcl/qt5/QtTools.cxx +++ b/vcl/qt5/QtTools.cxx @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include @@ -111,8 +111,9 @@ QImage toQImage(const Image& rImage) if (!!rImage) { SvMemoryStream aMemStm; -vcl::PNGWriter aWriter(rImage.GetBitmapEx()); -aWriter.Write(aMemStm); +auto rBitmapEx = rImage.GetBitmapEx(); +vcl::PngImageWriter aWriter(aMemStm); +aWriter.write(rBitmapEx); aImage.loadFromData(static_cast(aMemStm.GetData()), aMemStm.TellEnd()); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) New commits: commit e4066a41406b1ddd454901b4fa718cf9be2746c4 Author: Michael Weghorn AuthorDate: Tue Jul 5 18:30:02 2022 +0200 Commit: Michael Weghorn CommitDate: Tue Jul 5 20:30:00 2022 +0200 qt a11y: Implement QtAccessibleWidget::table Implement that `QAccessibleTableCellInterface::table` override by returning the parent, if it is a table. This turned out to be the missing piece when working on an implementation for the Qt library to expose the AT-SPI table cell interface for a11y objects that implement `QAccessibleTableCellInterface`, and testing the "GetTable" method by calling `acc.queryTableCell().get_table()` on a selected LO Calc cell in Accerciser's IPython console. Change-Id: I6144c613f31cafc338ccac739cd7db1bf314d4a4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136836 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 88616a555efd..44d9f896217b 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -1480,8 +1480,15 @@ int QtAccessibleWidget::rowIndex() const QAccessibleInterface* QtAccessibleWidget::table() const { -SAL_WARN("vcl.qt", "Unsupported QAccessibleTableCellInterface::table"); -return nullptr; +Reference xTable = getAccessibleTableForParent(); +if (!xTable.is()) +return nullptr; + +Reference xTableAcc(xTable, UNO_QUERY); +if (!xTableAcc.is()) +return nullptr; + +return QAccessible::queryAccessibleInterface(new QtXAccessible(xTableAcc)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 1a8132515babca53b1f1a464236e05f780cbfef3 Author: Michael Weghorn AuthorDate: Sat Jul 2 11:00:01 2022 +0200 Commit: Michael Weghorn CommitDate: Sat Jul 2 12:41:21 2022 +0200 tdf#149816 qt a11y: Report position in screen coordinates `QAccessibleInterface::rect()` is supposed to report the geometry in screen coordinates [1]. `XAccessibleComponent::getLocationOnScreen` returns the position in screen coordinates, so use that instead of `XAccessibleComponent::getLocation`, which returns the position relative to the parent. With this in place, Accerciser correctly highlights the area of the item curently selected in its treeview of the LO a11y hierarchy. [1] https://doc.qt.io/qt-6/qaccessibleinterface.html#rect Change-Id: Iefb1e8792cd3ee720feafc81744e5e6ed6a949c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136781 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 3461ec1ae38c..5e66459ce054 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -264,7 +264,7 @@ QRect QtAccessibleWidget::rect() const return QRect(); Reference xAccessibleComponent(xAc, UNO_QUERY); -awt::Point aPoint = xAccessibleComponent->getLocation(); +awt::Point aPoint = xAccessibleComponent->getLocationOnScreen(); awt::Size aSize = xAccessibleComponent->getSize(); return QRect(aPoint.X, aPoint.Y, aSize.Width, aSize.Height);
[Libreoffice-commits] core.git: vcl/qt5 vcl/unx vcl/win
vcl/qt5/QtFrame.cxx |4 vcl/unx/gtk3/salnativewidgets-gtk.cxx |5 + vcl/win/window/salframe.cxx |4 3 files changed, 13 insertions(+) New commits: commit 169ff786a6694ab412d53c911550db101fb50876 Author: Michael Weghorn AuthorDate: Fri Jul 1 10:45:13 2022 +0200 Commit: Michael Weghorn CommitDate: Sat Jul 2 06:55:15 2022 +0200 tdf#149804 Set newly introduced list box colors from system colors commit 3c6a53b9ce64180b2a03e097c1844f7496f26815 Date: Sat Apr 17 14:49:43 2021 +0200 improve the look of the macOS combobox had introduced separate style colors to be used for list/combo boxes, but since those new colors were not set explicitly for gtk3, qt5/qt6 and Windows, this resulted in style/theme/system colors no longer being used, but only the default colors introduced in above commit. This sets the style/theme/system colors for qt5/qt6, gtk3 and Windows as well, using the same values that were used previously. Change-Id: I31401af38b991e7e0cdc436b894ee0f491a22752 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136735 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 3a240b2808ca..1b9f8ae88175 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -1085,6 +1085,7 @@ void QtFrame::UpdateSettings(AllSettings& rSettings) // Text style.SetFieldTextColor(aText); style.SetFieldRolloverTextColor(aText); +style.SetListBoxWindowTextColor(aText); style.SetWindowTextColor(aText); style.SetToolTextColor(aText); @@ -1092,6 +1093,7 @@ void QtFrame::UpdateSettings(AllSettings& rSettings) style.SetFieldColor(aBase); style.SetWindowColor(aBase); style.SetActiveTabColor(aBase); +style.SetListBoxWindowBackgroundColor(aBase); style.SetAlternatingRowColor(toColor(pal.color(QPalette::Active, QPalette::AlternateBase))); // Buttons @@ -1129,6 +1131,8 @@ void QtFrame::UpdateSettings(AllSettings& rSettings) // Selection style.SetHighlightColor(aHigh); style.SetHighlightTextColor(aHighText); +style.SetListBoxWindowHighlightColor(aHigh); +style.SetListBoxWindowHighlightTextColor(aHighText); style.SetActiveColor(aHigh); style.SetActiveTextColor(aHighText); diff --git a/vcl/unx/gtk3/salnativewidgets-gtk.cxx b/vcl/unx/gtk3/salnativewidgets-gtk.cxx index 3eaffc903e16..3074dd0fbad7 100644 --- a/vcl/unx/gtk3/salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/salnativewidgets-gtk.cxx @@ -2306,6 +2306,7 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings) aStyleSet.SetButtonTextColor( aTextColor ); aStyleSet.SetDefaultActionButtonTextColor(aTextColor); aStyleSet.SetActionButtonTextColor(aTextColor); +aStyleSet.SetListBoxWindowTextColor( aTextColor ); aStyleSet.SetRadioCheckTextColor( aTextColor ); aStyleSet.SetGroupTextColor( aTextColor ); aStyleSet.SetLabelTextColor( aTextColor ); @@ -2406,6 +2407,8 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings) ::Color aHighlightTextColor = getColor( text_color ); aStyleSet.SetHighlightColor( aHighlightColor ); aStyleSet.SetHighlightTextColor( aHighlightTextColor ); +aStyleSet.SetListBoxWindowHighlightColor( aHighlightColor ); +aStyleSet.SetListBoxWindowHighlightTextColor( aHighlightTextColor ); // make active like highlight, except with a small contrast. Note, see // a GtkListBoxRow in a GtkStackSidebar for a gtk widget with a // difference between highlighted and highlighted with focus. @@ -2424,6 +2427,8 @@ bool GtkSalGraphics::updateSettings(AllSettings& rSettings) aStyleSet.SetFieldColor( aBackFieldColor ); // This baby is the default page/paper color aStyleSet.SetWindowColor( aBackFieldColor ); +// listbox background color +aStyleSet.SetListBoxWindowBackgroundColor( aBackFieldColor ); #if GTK_CHECK_VERSION(4, 0, 0) double caretAspectRatio = 0.04f; diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index b419a259c450..598b5ea70fa8 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -2714,10 +2714,14 @@ void WinSalFrame::UpdateSettings( AllSettings& rSettings ) aStyleSettings.SetActiveTabColor( aStyleSettings.GetWindowColor() ); aStyleSettings.SetToolTextColor( ImplWinColorToSal( GetSysColor( COLOR_WINDOWTEXT ) ) ); aStyleSettings.SetFieldColor( aStyleSettings.GetWindowColor() ); +aStyleSettings.SetListBoxWindowBackgroundColor( aStyleSettings.GetWindowColor() ); aStyleSettings.SetFieldTextColor( aStyleSettings.GetWindowTextColor() ); aStyleSettings.SetFieldRolloverTextColor( aStyleSettings.GetFieldTextColor() ); +aStyleSettings.SetListBoxWindowTextColor( aStyleSettings.GetFieldTe
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtMenu.cxx | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) New commits: commit ee3976f2c613f9015477ab327996c074e8516f9d Author: Michael Weghorn AuthorDate: Fri Jun 24 10:27:04 2022 +0200 Commit: Michael Weghorn CommitDate: Fri Jul 1 07:28:01 2022 +0200 tdf#149680 qt: Open native popup menu at given position Calculate the position at which to open the popup menu from the passed window and rectangle, rather than always opening the native popup menu at the cursor position. The commit message in commit 1e0b16f8695498e4eea7c2208aabf7e7664ce749 Date: Wed Feb 12 08:07:42 2020 +0100 tdf#128921 tdf#130341 tdf#122053 qt5: Native PopupMenus which had implemented native poup menus, already said: > For now, this always shows the popup menu at cursor position, which > can be changed by taking the Rectangle passed to > 'Qt5Menu::ShowNativePopupMenu' into account if there should be any > need. Change-Id: If1a44b6d53f3dcd6fa7ceec0738219f11cfc22c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136356 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index 5a4d3e859e9d..c1e4cb0e1a29 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -828,15 +828,19 @@ void QtMenu::ShowCloseButton(bool bShow) lcl_force_menubar_layout_update(*mpQMenuBar); } -bool QtMenu::ShowNativePopupMenu(FloatingWindow*, const tools::Rectangle&, +bool QtMenu::ShowNativePopupMenu(FloatingWindow* pWin, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags) { assert(mpQMenu); DoFullMenuUpdate(mpVCLMenu); mpQMenu->setTearOffEnabled(bool(nFlags & FloatWinPopupFlags::AllowTearOff)); -const QPoint aPos = QCursor::pos(); -mpQMenu->exec(aPos); +const VclPtr xParent = pWin->ImplGetWindowImpl()->mpRealParent; +const QtFrame* pFrame = static_cast(xParent->ImplGetFrame()); +assert(pFrame); +const tools::Rectangle aFloatRect = FloatingWindow::ImplConvertToAbsPos(xParent, rRect); +const QRect aRect = toQRect(aFloatRect, 1 / pFrame->devicePixelRatioF()); +mpQMenu->exec(aRect.topLeft()); return true; }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleWidget.cxx |4 1 file changed, 4 insertions(+) New commits: commit 85c564285036f92f76c1095487c5d5e12709b1e2 Author: Michael Weghorn AuthorDate: Sat Jun 18 10:54:45 2022 +0200 Commit: Michael Weghorn CommitDate: Sat Jun 18 12:36:24 2022 +0200 qt a11y: Handle special value of -1 for text offset As the note in the Qt doc for `QAccessibleTextInterface::textAtOffset` says [1]: > An offset of -1 is used for the text length and custom implementations > of this function have to return the result as if the length was passed > in as offset. Without this, LO happened to crash quite frequently with Orca enabled when moving the cursor between paragraphs in a Writer doc when using the qt6 VCL plugin in a WIP branch including more changes to qt5/qt6 a11y. [1] https://doc.qt.io/qt-6/qaccessibletextinterface.html#textAtOffset Change-Id: I5c6ca69f8a9b2edad204bb1af740d4de17668f18 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136073 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleWidget.cxx b/vcl/qt5/QtAccessibleWidget.cxx index 0211fc045c27..3461ec1ae38c 100644 --- a/vcl/qt5/QtAccessibleWidget.cxx +++ b/vcl/qt5/QtAccessibleWidget.cxx @@ -1039,6 +1039,10 @@ QString QtAccessibleWidget::textAtOffset(int offset, QAccessible::TextBoundaryTy sal_Int16 nUnoBoundaryType = lcl_matchQtTextBoundaryType(boundaryType); assert(nUnoBoundaryType > 0); +// special value of -1 for offset means text length +if (offset == -1) +offset = xText->getCharacterCount(); + const TextSegment segment = xText->getTextAtIndex(offset, nUnoBoundaryType); *startOffset = segment.SegmentStart; *endOffset = segment.SegmentEnd;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 3f8d3fd4649ef09e86c735617383a4bda0425540 Author: Jan-Marek Glogowski AuthorDate: Sun Jun 5 08:55:43 2022 +0200 Commit: Jan-Marek Glogowski CommitDate: Sun Jun 5 12:17:45 2022 +0200 tdf#137471 Qt return frame pos + client area size My code comment about "drawable area" and Michaels bug comment 12 about the "frameGeometry()" usage were both half right. LO expects the window's frame position and the drawable client area size almost everywhere when "geometry" is involved. The frame's border is stored in the decorations members of SalFrameGeometry. Change-Id: Ic00ad1f1d74d7afadcaca0c01e1a41ea7f2833de Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135434 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 4b94273e1cff..3c63060855ab 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -741,8 +741,8 @@ bool QtFrame::GetWindowState(SalFrameState* pState) } else { -// geometry() is the drawable area, which is wanted here -QRect rect = scaledQRect(asChild()->geometry(), devicePixelRatioF()); +// we want the frame position and the client area size +QRect rect = scaledQRect({ asChild()->pos(), asChild()->size() }, devicePixelRatioF()); pState->mnX = rect.x(); pState->mnY = rect.y(); pState->mnWidth = rect.width();
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtWidget.cxx | 47 ++- 1 file changed, 22 insertions(+), 25 deletions(-) New commits: commit cd2ea94969b9c63b24e35e9b8e546cea0f62340e Author: Jan-Marek Glogowski AuthorDate: Tue May 31 21:03:39 2022 +0200 Commit: Jan-Marek Glogowski CommitDate: Wed Jun 1 00:16:32 2022 +0200 Qt just resize the backing store on size change ... and if there is no need to create a Cairo surface if it doesn't exists, there is no need for a fresh QImage either. Change-Id: If607e03d246f3c31d66953b1e07a7af55659e64b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135209 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 74adcc4e974c..b2451123e7e6 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -98,38 +98,35 @@ void QtWidget::resizeEvent(QResizeEvent* pEvent) if (m_rFrame.m_bUseCairo) { -if (m_rFrame.m_pSvpGraphics) +if (m_rFrame.m_pSurface) { -cairo_surface_t* pSurface -= cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight); -cairo_surface_set_user_data(pSurface, SvpSalGraphics::getDamageKey(), -&m_rFrame.m_aDamageHandler, nullptr); -m_rFrame.m_pSvpGraphics->setSurface(pSurface, basegfx::B2IVector(nWidth, nHeight)); -UniqueCairoSurface old_surface(m_rFrame.m_pSurface.release()); -m_rFrame.m_pSurface.reset(pSurface); - -int min_width = qMin(cairo_image_surface_get_width(old_surface.get()), nWidth); -int min_height = qMin(cairo_image_surface_get_height(old_surface.get()), nHeight); - -SalTwoRect rect(0, 0, min_width, min_height, 0, 0, min_width, min_height); - -m_rFrame.m_pSvpGraphics->copySource(rect, old_surface.get()); +const int nOldWidth = cairo_image_surface_get_width(m_rFrame.m_pSurface.get()); +const int nOldHeight = cairo_image_surface_get_height(m_rFrame.m_pSurface.get()); +if (nOldWidth != nWidth || nOldHeight != nHeight) +{ +cairo_surface_t* pSurface += cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight); +cairo_surface_set_user_data(pSurface, SvpSalGraphics::getDamageKey(), +&m_rFrame.m_aDamageHandler, nullptr); +m_rFrame.m_pSvpGraphics->setSurface(pSurface, basegfx::B2IVector(nWidth, nHeight)); +UniqueCairoSurface old_surface(m_rFrame.m_pSurface.release()); +m_rFrame.m_pSurface.reset(pSurface); + +const int nMinWidth = qMin(nOldWidth, nWidth); +const int nMinHeight = qMin(nOldHeight, nHeight); +SalTwoRect rect(0, 0, nMinWidth, nMinHeight, 0, 0, nMinWidth, nMinHeight); +m_rFrame.m_pSvpGraphics->copySource(rect, old_surface.get()); +} } } else { -QImage* pImage = nullptr; - -if (m_rFrame.m_pQImage) -pImage = new QImage(m_rFrame.m_pQImage->copy(0, 0, nWidth, nHeight)); -else +if (m_rFrame.m_pQImage && m_rFrame.m_pQImage->size() != QSize(nWidth, nHeight)) { -pImage = new QImage(nWidth, nHeight, Qt_DefaultFormat32); -pImage->fill(Qt::transparent); +QImage* pImage = new QImage(m_rFrame.m_pQImage->copy(0, 0, nWidth, nHeight)); +m_rFrame.m_pQtGraphics->ChangeQImage(pImage); +m_rFrame.m_pQImage.reset(pImage); } - -m_rFrame.m_pQtGraphics->ChangeQImage(pImage); -m_rFrame.m_pQImage.reset(pImage); } m_rFrame.CallCallback(SalEvent::Resize, nullptr);
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtGraphics_GDI.cxx | 66 ++--- 1 file changed, 16 insertions(+), 50 deletions(-) New commits: commit 6959a18d1a8fea4d65498083dc3ba05f640d0f39 Author: Jan-Marek Glogowski AuthorDate: Fri May 27 19:08:41 2022 +0200 Commit: Jan-Marek Glogowski CommitDate: Sun May 29 00:16:21 2022 +0200 tdf#144601 Qt fix creating QImage with alpha mask Rechecking the QImage documentation, this actually can be easily done; no more bit twiddling, which I got wrong to begin with. LO's alpha mask is inverted to Qt's expectations, but we have invertPixels() and then apply it with setAlphaChannel(). And we can even set the fAlpha using setOpacity()! Change-Id: If2030d3f87d3a4698d1cd9af005d307c2ee63061 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135044 Reviewed-by: Michael Weghorn Reviewed-by: Jan-Marek Glogowski Tested-by: Jenkins diff --git a/vcl/qt5/QtGraphics_GDI.cxx b/vcl/qt5/QtGraphics_GDI.cxx index f87de50827df..6849a3bc7bde 100644 --- a/vcl/qt5/QtGraphics_GDI.cxx +++ b/vcl/qt5/QtGraphics_GDI.cxx @@ -601,55 +601,24 @@ bool QtGraphicsBackend::blendAlphaBitmap(const SalTwoRect&, const SalBitmap& /*r return false; } -static bool getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap, - QImage& rAlphaImage) +static QImage getAlphaImage(const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) { -if (rAlphaBitmap.GetBitCount() != 8 && rAlphaBitmap.GetBitCount() != 1) -{ -SAL_WARN("vcl.gdi", "unsupported alpha depth case: " << rAlphaBitmap.GetBitCount()); -return false; -} +assert(rSourceBitmap.GetSize() == rAlphaBitmap.GetSize()); +assert(rAlphaBitmap.GetBitCount() == 8 || rAlphaBitmap.GetBitCount() == 1); -const QImage* pBitmap = static_cast(&rSourceBitmap)->GetQImage(); -const QImage* pAlpha = static_cast(&rAlphaBitmap)->GetQImage(); -rAlphaImage = pBitmap->convertToFormat(Qt_DefaultFormat32); +QImage aAlphaMask = *static_cast(&rAlphaBitmap)->GetQImage(); +aAlphaMask.invertPixels(); -if (rAlphaBitmap.GetBitCount() == 8) -{ -for (int y = 0; y < rAlphaImage.height(); ++y) -{ -uchar* image_line = rAlphaImage.scanLine(y); -const uchar* alpha_line = pAlpha->scanLine(y); -for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4) -image_line[3] = 255 - alpha_line[x]; -} -} -else -{ -for (int y = 0; y < rAlphaImage.height(); ++y) -{ -uchar* image_line = rAlphaImage.scanLine(y); -const uchar* alpha_line = pAlpha->scanLine(y); -for (int x = 0; x < rAlphaImage.width(); ++x, image_line += 4) -{ -if (x && !(x % 8)) -++alpha_line; -if (0 != (*alpha_line & (1 << (7 - x % 8 -image_line[3] = 0; -} -} -} - -return true; +const QImage* pBitmap = static_cast(&rSourceBitmap)->GetQImage(); +QImage aImage = pBitmap->convertToFormat(Qt_DefaultFormat32); +aImage.setAlphaChannel(aAlphaMask); +return aImage; } bool QtGraphicsBackend::drawAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSourceBitmap, const SalBitmap& rAlphaBitmap) { -QImage aImage; -if (!getAlphaImage(rSourceBitmap, rAlphaBitmap, aImage)) -return false; -drawScaledImage(rPosAry, aImage); +drawScaledImage(rPosAry, getAlphaImage(rSourceBitmap, rAlphaBitmap)); return true; } @@ -659,20 +628,17 @@ bool QtGraphicsBackend::drawTransformedBitmap(const basegfx::B2DPoint& rNull, const SalBitmap& rSourceBitmap, const SalBitmap* pAlphaBitmap, double fAlpha) { -if (fAlpha != 1.0) -return false; QImage aImage; -if (pAlphaBitmap && !getAlphaImage(rSourceBitmap, *pAlphaBitmap, aImage)) -return false; +if (!pAlphaBitmap) +aImage = *static_cast(&rSourceBitmap)->GetQImage(); else -{ -const QImage* pBitmap = static_cast(&rSourceBitmap)->GetQImage(); -aImage = pBitmap->convertToFormat(Qt_DefaultFormat32); -} +aImage = getAlphaImage(rSourceBitmap, *pAlphaBitmap); -QtPainter aPainter(*this); const basegfx::B2DVector aXRel = rX - rNull; const basegfx::B2DVector aYRel = rY - rNull; + +QtPainter aPainter(*this); +aPainter.setOpacity(fAlpha); aPainter.setTransform(QTransform(aXRel.getX() / aImage.width(), aXRel.getY() / aImage.width(), aYRel.getX() / aImage.height(), aYRel.getY() / aImage.height(), rNull.getX(), rNull.getY()));
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |5 + 1 file changed, 1 insertion(+), 4 deletions(-) New commits: commit caf862fc843c89cceae2121f743a3822e09bbd46 Author: Jan-Marek Glogowski AuthorDate: Fri May 27 23:36:20 2022 +0200 Commit: Jan-Marek Glogowski CommitDate: Sat May 28 18:41:21 2022 +0200 tdf#149329 Qt change cursor via QWidget ... instead of its QWindow No idea, why my initial implementation used the QWindow. Neither do I know, why it's now somehow broken. The code is called, but the cursor doesn't change. But it seems to work via QWidget, so just do that. IMHO less QWindow is preferable generally; let Qt handle more of the low-level stuff. Change-Id: Id23fba719c9a4d7e760991c51e6021c6f89be345 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135051 Reviewed-by: Michael Weghorn Reviewed-by: Jan-Marek Glogowski Tested-by: Jenkins diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 0933bf33b029..4b94273e1cff 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -835,14 +835,11 @@ void QtFrame::ToTop(SalFrameToTop nFlags) void QtFrame::SetPointer(PointerStyle ePointerStyle) { -QWindow* pWindow = m_pQWidget->window()->windowHandle(); -if (!pWindow) -return; if (ePointerStyle == m_ePointerStyle) return; m_ePointerStyle = ePointerStyle; -pWindow->setCursor(GetQtData()->getCursor(ePointerStyle)); +m_pQWidget->setCursor(GetQtData()->getCursor(ePointerStyle)); } void QtFrame::CaptureMouse(bool bMouse)
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtTransferable.cxx |5 + 1 file changed, 5 insertions(+) New commits: commit 6fc3ec85a32cd70216b4bbf21e479b4fc32a38dc Author: Michael Weghorn AuthorDate: Mon May 16 17:24:28 2022 +0200 Commit: Michael Weghorn CommitDate: Wed May 18 06:48:01 2022 +0200 tdf#137639 qt: UTF-16-encode mime data for "text/plain;charset=utf-16" Return a `QVariant` from a `QByteArray` containing the UTF-16-encoded characters when mime data for mime type "text/plain;charset=utf-16" is requested in `QtMimeData::retrieveData`, rather than a `QVariant` created from a a `QString`, to ensure that UTF-16 encoded data is actually used in the end. While `QString` uses UTF-16 encoding itself, `QMimeDataPrivate::retrieveTypedData` from the Qt library would convert the retrieved `QString` data to UTF-8 [1], resulting in a mismatch because UTF-8 encoded data would actually be returned when UTF-16-encoded one has been requested. This gets called as follows: 0 QtMimeData::retrieveData 1 QMimeDataPrivate::retrieveTypedData 2 QMimeData::data 3 QtMimeData::deepCopy [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qmimedata.cpp?h=6.3.0#n212 Change-Id: I3db1476838336682584145fb43d397c8eed29ce2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134456 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index db52eed66d0b..d9e0beaa71d3 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -338,6 +338,11 @@ QVariant QtMimeData::retrieveData(const QString& mimeType, QMetaType) const OString aLocaleString(OUStringToOString(aString, osl_getThreadTextEncoding())); aByteArray = QByteArray(aLocaleString.getStr(), aLocaleString.getLength()); } +else if (bWantUTF16) +{ +aByteArray = QByteArray(reinterpret_cast(aString.getStr()), +aString.getLength() * 2); +} else return QVariant(toQString(aString)); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtTransferable.cxx |6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) New commits: commit 19f204a30de56f0c55a157cb040f2e4bdcbe62e5 Author: Michael Weghorn AuthorDate: Mon May 16 17:14:07 2022 +0200 Commit: Michael Weghorn CommitDate: Tue May 17 08:22:01 2022 +0200 qt: Drop unnecessary reinterpret_cast `OString::getStr` already returns `const char *`, so there's no need to cast to that. Change-Id: Ief787f9823ffea075882658cf0adec29a8030199 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134455 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtTransferable.cxx b/vcl/qt5/QtTransferable.cxx index 806f57426255..db52eed66d0b 100644 --- a/vcl/qt5/QtTransferable.cxx +++ b/vcl/qt5/QtTransferable.cxx @@ -331,14 +331,12 @@ QVariant QtMimeData::retrieveData(const QString& mimeType, QMetaType) const if (bWantUTF8) { OString aUTF8String(OUStringToOString(aString, RTL_TEXTENCODING_UTF8)); -aByteArray = QByteArray(reinterpret_cast(aUTF8String.getStr()), -aUTF8String.getLength()); +aByteArray = QByteArray(aUTF8String.getStr(), aUTF8String.getLength()); } else if (bWantNoCharset) { OString aLocaleString(OUStringToOString(aString, osl_getThreadTextEncoding())); -aByteArray = QByteArray(reinterpret_cast(aLocaleString.getStr()), -aLocaleString.getLength()); +aByteArray = QByteArray(aLocaleString.getStr(), aLocaleString.getLength()); } else return QVariant(toQString(aString));
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtMenu.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit f751417b77e6573a0c639778e76ec943449f4573 Author: Jan-Marek Glogowski AuthorDate: Mon Apr 11 17:56:16 2022 +0200 Commit: Jan-Marek Glogowski CommitDate: Tue Apr 12 12:24:29 2022 +0200 tdf#148491 Qt reconnect the QMenuBar close button When the QMenuBar of a QMainWindow is replaced, an existing corner widget is preserved / transferred, but its connections are still severed; a bit unexpected... The documentation for QMenuBar::setCornerWidget is not really clear what is happening, but the code has this nice comment: "// Reparent corner widgets before we delete the old menu". At least there is no need to explicitly delete the button. Still we must reconnect an existing button on each SetFrame. Regression from commit 9c4ef8ce3183e27ca174475cf4a8d15cc0368f60 ("tdf#145954 Qt unshare QMenubar usage"). Change-Id: I13c31734e665b78231a08cd76ca6305122e08879 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132836 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtMenu.cxx b/vcl/qt5/QtMenu.cxx index 50cb1d057431..fd38a038 100644 --- a/vcl/qt5/QtMenu.cxx +++ b/vcl/qt5/QtMenu.cxx @@ -429,6 +429,10 @@ void QtMenu::SetFrame(const SalFrame* pFrame) mpQMenuBar = new QMenuBar(); pMainWindow->setMenuBar(mpQMenuBar); + +QPushButton* pButton = static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner)); +if (pButton) +connect(pButton, &QPushButton::clicked, this, &QtMenu::slotCloseDocument); mpQMenu = nullptr; DoFullMenuUpdate(mpVCLMenu); @@ -647,6 +651,8 @@ void QtMenu::ShowCloseButton(bool bShow) return; QPushButton* pButton = static_cast(mpQMenuBar->cornerWidget(Qt::TopRightCorner)); +if (!pButton && !bShow) +return; if (!pButton) { QIcon aIcon;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtData.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 9ae398054833120df36bf51738cc4cfd7efb3fdc Author: Jan-Marek Glogowski AuthorDate: Mon Apr 11 17:07:36 2022 +0200 Commit: Jan-Marek Glogowski CommitDate: Mon Apr 11 20:30:51 2022 +0200 tdf#148481 Map RefHand cursor to Qt::PointingHand Change-Id: I79c7008655f22737f92a4a6430f1380e81c1c386 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132833 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtData.cxx b/vcl/qt5/QtData.cxx index 8b60fc46ed56..7d2d0418e80e 100644 --- a/vcl/qt5/QtData.cxx +++ b/vcl/qt5/QtData.cxx @@ -228,7 +228,7 @@ QCursor& QtData::getCursor(PointerStyle ePointerStyle) MAP_BUILTIN(PointerStyle::HSizeBar, Qt::SizeHorCursor); MAP_BUILTIN(PointerStyle::VSizeBar, Qt::SizeVerCursor); -MAP_BUILTIN(PointerStyle::RefHand, Qt::OpenHandCursor); +MAP_BUILTIN(PointerStyle::RefHand, Qt::PointingHandCursor); MAP_BUILTIN(PointerStyle::Hand, Qt::OpenHandCursor); #if 0 MAP_BUILTIN( PointerStyle::Pen, GDK_PENCIL );
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit cec215e0e3adaf26c89c4ffbaa53f87481772f0c Author: Jan-Marek Glogowski AuthorDate: Mon Apr 4 11:25:22 2022 +0200 Commit: Jan-Marek Glogowski CommitDate: Mon Apr 4 17:35:21 2022 +0200 tdf#147523 Qt use inner QWidget to set pointer pos Regression from commit e63fe68fb1d0915b64fdf63f7fa6eed866fa3a0d ("Qt use asChild for pointer positioning"), which should just have been a cleanup for commit ca28826a087245686d7fca3ffc8ca1f03307924d ("tdf#131467 Qt set default position on first resize"). And scale the requested position by the device scale factor. Change-Id: I50b3c628d22896e987d8cc2eaf5635cb12ba3464 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132518 Reviewed-by: Michael Weghorn Tested-by: Jenkins diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index a70b6616c0a7..6c2e4757f84a 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -883,7 +883,7 @@ void QtFrame::SetPointerPos(tools::Long nX, tools::Long nY) { // some cursor already exists (and it has m_ePointerStyle shape) // so here we just reposition it -QCursor::setPos(asChild()->mapToGlobal(QPoint(nX, nY))); +QCursor::setPos(m_pQWidget->mapToGlobal(QPoint(nX, nY) / devicePixelRatioF())); } void QtFrame::Flush()
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtWidget.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit fd8b0796092566576a80004cbffa95f3b05923f0 Author: Michael Weghorn AuthorDate: Tue Mar 29 14:46:29 2022 +0200 Commit: Julien Nabet CommitDate: Tue Mar 29 18:30:39 2022 +0200 qt: Fix typo in function name: lcl_MapUndrelineStyle Change-Id: I50b2ffeb1b6bb490c14a307152634cc51022a426 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132276 Tested-by: Jenkins Reviewed-by: Julien Nabet diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 77d9222a74f9..9685be9ffa57 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -637,7 +637,7 @@ QtWidget::QtWidget(QtFrame& rFrame, Qt::WindowFlags f) setFocusPolicy(Qt::ClickFocus); } -static ExtTextInputAttr lcl_MapUndrelineStyle(QTextCharFormat::UnderlineStyle us) +static ExtTextInputAttr lcl_MapUnderlineStyle(QTextCharFormat::UnderlineStyle us) { switch (us) { @@ -684,7 +684,7 @@ void QtWidget::inputMethodEvent(QInputMethodEvent* pEvent) if (aCharFormat.isValid()) { ExtTextInputAttr aETIP -= lcl_MapUndrelineStyle(aCharFormat.underlineStyle()); += lcl_MapUnderlineStyle(aCharFormat.underlineStyle()); if (aCharFormat.hasProperty(QTextFormat::BackgroundBrush)) aETIP |= ExtTextInputAttr::Highlight; if (aCharFormat.fontStrikeOut())
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 39 +- 1 file changed, 38 insertions(+), 1 deletion(-) New commits: commit 9ee8b709594d2d106dc6ba7b7cac5a7e4300609c Author: Michael Weghorn AuthorDate: Mon Mar 28 16:24:23 2022 +0200 Commit: Michael Weghorn CommitDate: Tue Mar 29 06:55:18 2022 +0200 qt a11y: Handle TABLE_MODEL_CHANGED event Note however, that as of now, this doesn't have any effect in practice, since `AtSpiAdaptor` for Linux in the Qt library currently just ignores `QAccessible::TableModelChanged` events instead of forwarding them as corresponding AT-SPI events. [1] [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=9a4c32cedda3a00e06eb3aed13a731d23f6c56d9#n1105 Change-Id: I6339d172da54bc30987bb9261ce37005ebce5501 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/13 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 29aba6ef3b0d..515584351c74 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -23,6 +23,8 @@ #include #include +#include +#include #include #include @@ -132,6 +134,42 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::TableColumnHeaderChanged)); return; +case AccessibleEventId::TABLE_MODEL_CHANGED: +{ +AccessibleTableModelChange aChange; +aEvent.NewValue >>= aChange; + +QAccessibleTableModelChangeEvent::ModelChangeType nType; +switch (aChange.Type) +{ +case AccessibleTableModelChangeType::COLUMNS_INSERTED: +nType = QAccessibleTableModelChangeEvent::ColumnsInserted; +break; +case AccessibleTableModelChangeType::COLUMNS_REMOVED: +nType = QAccessibleTableModelChangeEvent::ColumnsRemoved; +break; +case AccessibleTableModelChangeType::ROWS_INSERTED: +nType = QAccessibleTableModelChangeEvent::RowsInserted; +break; +case AccessibleTableModelChangeType::ROWS_REMOVED: +nType = QAccessibleTableModelChangeEvent::RowsRemoved; +break; +case AccessibleTableModelChangeType::UPDATE: +nType = QAccessibleTableModelChangeEvent::DataChanged; +break; +default: +assert(false && "Unhandled AccessibleTableModelChangeType"); +return; +} +QAccessibleTableModelChangeEvent* pTableEvent += new QAccessibleTableModelChangeEvent(pQAccessibleInterface, nType); +pTableEvent->setFirstRow(aChange.FirstRow); +pTableEvent->setLastRow(aChange.LastRow); +pTableEvent->setFirstColumn(aChange.FirstColumn); +pTableEvent->setLastColumn(aChange.LastColumn); +QAccessible::updateAccessibility(pTableEvent); +return; +} case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED: QAccessible::updateAccessibility(new QAccessibleEvent( pQAccessibleInterface, QAccessible::TableRowDescriptionChanged)); @@ -197,7 +235,6 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible case AccessibleEventId::LABELED_BY_RELATION_CHANGED: case AccessibleEventId::MEMBER_OF_RELATION_CHANGED: case AccessibleEventId::SUB_WINDOW_OF_RELATION_CHANGED: -case AccessibleEventId::TABLE_MODEL_CHANGED: case AccessibleEventId::LISTBOX_ENTRY_EXPANDED: case AccessibleEventId::LISTBOX_ENTRY_COLLAPSED: case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtWidget.cxx |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) New commits: commit afc144b1f949e799a966933f28e07f83f735a7e2 Author: Stephan Bergmann AuthorDate: Mon Mar 21 23:04:07 2022 +0100 Commit: Stephan Bergmann CommitDate: Tue Mar 22 11:57:36 2022 +0100 loplugin:loopvartoosmall ...with --enable-qt6, where QList::size() return type has changed from int to qsizetype (aka ptrdiff_t); but just replacing the use of int with a use of qsizetype would fail with --enable-qt5 in some build environments where the Qt5 qglobal.h doesn't happen to already be included, so simply replace this with a range-based for loop and be done with it Change-Id: I5a6c7b0468ed7cef6de7fb647fdb2631a8cb5b35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131916 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index ca74b9d118f0..77d9222a74f9 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -673,9 +673,8 @@ void QtWidget::inputMethodEvent(QInputMethodEvent* pEvent) ExtTextInputAttr::NONE); aInputEvent.mpTextAttr = aTextAttrs.data(); -for (int i = 0; i < rAttrList.size(); ++i) +for (const QInputMethodEvent::Attribute& rAttr : rAttrList) { -const QInputMethodEvent::Attribute& rAttr = rAttrList.at(i); switch (rAttr.type) { case QInputMethodEvent::TextFormat:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx |5 - 1 file changed, 4 insertions(+), 1 deletion(-) New commits: commit 6ec960fe0be916fa20829e0b29fcb12d64008414 Author: Michael Weghorn AuthorDate: Tue Feb 22 17:10:09 2022 +0100 Commit: Michael Weghorn CommitDate: Wed Feb 23 07:15:29 2022 +0100 qt a11y: Handle HYPERTEXT_CHANGED event Change-Id: Ib4e6f06a5cdac1ac47eb3d273ca103fb5081550e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130361 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 3febce8a587e..29aba6ef3b0d 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -82,6 +82,10 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible new QAccessibleEvent(pQAccessibleInterface, event)); return; } +case AccessibleEventId::HYPERTEXT_CHANGED: +QAccessible::updateAccessibility( +new QAccessibleEvent(pQAccessibleInterface, QAccessible::HypertextChanged)); +return; case AccessibleEventId::SELECTION_CHANGED: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::Selection)); @@ -193,7 +197,6 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible case AccessibleEventId::LABELED_BY_RELATION_CHANGED: case AccessibleEventId::MEMBER_OF_RELATION_CHANGED: case AccessibleEventId::SUB_WINDOW_OF_RELATION_CHANGED: -case AccessibleEventId::HYPERTEXT_CHANGED: case AccessibleEventId::TABLE_MODEL_CHANGED: case AccessibleEventId::LISTBOX_ENTRY_EXPANDED: case AccessibleEventId::LISTBOX_ENTRY_COLLAPSED:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) New commits: commit ab925e1d8d927f3b26cbe2d60e5aa35e1c6f1076 Author: Michael Weghorn AuthorDate: Mon Feb 21 15:14:17 2022 +0100 Commit: Michael Weghorn CommitDate: Wed Feb 23 06:28:03 2022 +0100 qt a11y: Handle VALUE_CHANGED event Change-Id: I34d813ced29a591b0a6652eeb1271a978980bba5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130359 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 08b97b69c347..3febce8a587e 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -172,9 +172,19 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::ForegroundChanged)); return; +case AccessibleEventId::VALUE_CHANGED: +{ +QAccessibleValueInterface* pValueInterface = pQAccessibleInterface->valueInterface(); +if (pValueInterface) +{ +const QVariant aValue = pValueInterface->currentValue(); +QAccessible::updateAccessibility( +new QAccessibleValueChangeEvent(pQAccessibleInterface, aValue)); +} +return; +} case AccessibleEventId::ROLE_CHANGED: case AccessibleEventId::INVALIDATE_ALL_CHILDREN: -case AccessibleEventId::VALUE_CHANGED: case AccessibleEventId::CONTENT_FLOWS_FROM_RELATION_CHANGED: case AccessibleEventId::CONTENT_FLOWS_TO_RELATION_CHANGED: case AccessibleEventId::CONTROLLED_BY_RELATION_CHANGED:
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) New commits: commit fe9206b474464dd092da1d5c1ee788fe1c9b0765 Author: Michael Weghorn AuthorDate: Tue Feb 22 16:36:33 2022 +0100 Commit: Michael Weghorn CommitDate: Wed Feb 23 06:27:22 2022 +0100 qt a11y: Better handle TEXT_CHANGED event Trigger the corresponding Qt accessibility events for deleted and inserted text rather than sending a QAccessible::TextColumnChanged event (which looks like a rather arbitrary choice...). Qt also has a 'QAccessibleTextUpdateEvent' class that could be used to send a combined event, but since we get the relevant data separately in the LO event, using the latter wouldn't make things easier. And at least for the AT-SPI case on Linux, Qt sends separate AT-SPI events via D-Bus anyway. [1] Unfortunately, qt5/qt6 VCL a11y is not yet functional enough to e.g. test that the correct AT-SPI events are actually received when using the the script mentioned in Change-Id: Ibcae27ecfccf41a909e06d01ce681e4b7b97eb25 (gtk3 a11y: Migrate from deprecated "text-changed" ATK signal). [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp#n964 Change-Id: Ia9282382b6d5fd6bffd536dcda2989a6da901e90 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130356 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 5a8e84144210..08b97b69c347 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -18,10 +18,12 @@ */ #include +#include #include #include +#include #include @@ -96,6 +98,24 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::AttributeChanged)); return; +case AccessibleEventId::TEXT_CHANGED: +{ +TextSegment aDeletedText; +TextSegment aInsertedText; +if (aEvent.OldValue >>= aDeletedText) +{ +QAccessible::updateAccessibility( +new QAccessibleTextRemoveEvent(pQAccessibleInterface, aDeletedText.SegmentStart, + toQString(aDeletedText.SegmentText))); +} +if (aEvent.NewValue >>= aInsertedText) +{ +QAccessible::updateAccessibility(new QAccessibleTextInsertEvent( +pQAccessibleInterface, aInsertedText.SegmentStart, +toQString(aInsertedText.SegmentText))); +} +return; +} case AccessibleEventId::TABLE_CAPTION_CHANGED: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::TableCaptionChanged)); @@ -140,7 +160,6 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::SectionChanged)); return; -case AccessibleEventId::TEXT_CHANGED: case AccessibleEventId::COLUMN_CHANGED: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::TextColumnChanged));
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtAccessibleEventListener.cxx |9 - 1 file changed, 8 insertions(+), 1 deletion(-) New commits: commit dc6eb44e625c541be1db5911d53b3b0cc30a2b1f Author: Michael Weghorn AuthorDate: Fri Feb 18 12:38:16 2022 +0100 Commit: Michael Weghorn CommitDate: Fri Feb 18 20:04:39 2022 +0100 qt a11y: Map CARET_CHANGED event to Qt equivalent The previous handling of mapping that to QAccessible::TableSummaryChanged looks rather arbitrary. Change-Id: I066cee4bd90a49a47dd29252c11f8f74edccb637 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130141 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 1ceb6f6de0e1..5a8e84144210 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -60,6 +60,14 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::ActiveDescendantChanged)); return; +case AccessibleEventId::CARET_CHANGED: +{ +sal_Int32 nNewCursorPos = 0; +aEvent.NewValue >>= nNewCursorPos; +QAccessible::updateAccessibility( +new QAccessibleTextCursorEvent(pQAccessibleInterface, nNewCursorPos)); +return; +} case AccessibleEventId::CHILD: { QAccessible::Event event = QAccessible::InvalidEvent; @@ -109,7 +117,6 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible new QAccessibleEvent(pQAccessibleInterface, QAccessible::TableRowHeaderChanged)); return; case AccessibleEventId::TABLE_SUMMARY_CHANGED: -case AccessibleEventId::CARET_CHANGED: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::TableSummaryChanged)); return;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtWidget.cxx |8 1 file changed, 8 insertions(+) New commits: commit 05b067f05c561b1993deeea84a5700805bc9c3a6 Author: Caolán McNamara AuthorDate: Sat Feb 5 20:38:53 2022 + Commit: Caolán McNamara CommitDate: Sun Feb 6 13:10:08 2022 +0100 qt5: crash entering ë with french IM which for me with french IM enabled on my keyboard is physically AltGr+[ (crashes here on trying to underline ¨ with a length of 2) then e. Change-Id: Id59bd84af2ab4d8403b11b1a13efb2bbdb608199 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129538 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index d999ebbb7bd8..ca74b9d118f0 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -691,7 +691,15 @@ void QtWidget::inputMethodEvent(QInputMethodEvent* pEvent) if (aCharFormat.fontStrikeOut()) aETIP |= ExtTextInputAttr::RedText; for (int j = rAttr.start; j < rAttr.start + rAttr.length; j++) +{ +SAL_WARN_IF(j >= static_cast(aTextAttrs.size()), "vcl.qt", +"QInputMethodEvent::Attribute out of range. Broken range: " +<< rAttr.start << "," << rAttr.start + rAttr.length +<< " Legal range: 0," << aTextAttrs.size()); +if (j >= static_cast(aTextAttrs.size())) +break; aTextAttrs[j] = aETIP; +} } break; }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFilePicker.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit a85908f507f39c88a6cf244f5f4120361ad5e2ae Author: Michael Weghorn AuthorDate: Tue Jan 25 12:28:25 2022 +0100 Commit: Michael Weghorn CommitDate: Tue Jan 25 15:01:41 2022 +0100 tdf#146941 qt: QtFilePicker::finished needs SolarMutexGuard Change-Id: I4165c72ddd6370c8fe7faf55f9db831359f6f8a5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128923 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx index 05682fa1e7bf..42caf06149f0 100644 --- a/vcl/qt5/QtFilePicker.cxx +++ b/vcl/qt5/QtFilePicker.cxx @@ -187,6 +187,7 @@ void QtFilePicker::prepareExecute() void QtFilePicker::finished(int nResult) { +SolarMutexGuard g; uno::Reference xDesktop(css::frame::Desktop::create(m_context), UNO_QUERY_THROW); xDesktop->removeTerminateListener(this);
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) New commits: commit 0c124cb6e112b340c397c7615b127e71fbfd5e8c Author: Jan-Marek Glogowski AuthorDate: Sun Jan 9 00:51:09 2022 +0100 Commit: Jan-Marek Glogowski CommitDate: Sun Jan 9 13:25:59 2022 +0100 Qt minimize modal reparenting a bit Change-Id: Ie7203e9d92e5971de6c2730ff847f351e5641c9f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128178 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 46f7a1a409ff..1f69ed66da0c 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -176,8 +176,8 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG)) { -QWindow* pParentWindow = pParent->GetQWidget()->window()->windowHandle(); -QWindow* pChildWindow = asChild()->window()->windowHandle(); +QWindow* pParentWindow = pParent->windowHandle(); +QWindow* pChildWindow = windowHandle(); if (pParentWindow && pChildWindow && (pParentWindow != pChildWindow)) pChildWindow->setTransientParent(pParentWindow); } @@ -349,6 +349,7 @@ QWindow* QtFrame::windowHandle() const { // set attribute 'Qt::WA_NativeWindow' first to make sure a window handle actually exists QWidget* pChild = asChild(); +assert(pChild->window() == pChild); pChild->setAttribute(Qt::WA_NativeWindow); return pChild->windowHandle(); } @@ -428,21 +429,25 @@ void QtFrame::modalReparent(bool bVisible) if (!bVisible) { -m_pQWidget->setParent(m_pParent ? m_pParent->asChild() : nullptr, - m_pQWidget->windowFlags()); +QWidget* pNewParent = m_pParent ? m_pParent->asChild() : nullptr; +if (pNewParent != m_pQWidget->parent()) +m_pQWidget->setParent(pNewParent, m_pQWidget->windowFlags()); return; } -if (!QGuiApplication::modalWindow()) +const QWindow* pModalWin = QGuiApplication::modalWindow(); +if (!pModalWin || m_pParent->windowHandle() == pModalWin) return; QtInstance* pInst = static_cast(GetSalData()->m_pInstance); for (auto* pFrame : pInst->getFrames()) { -QWidget* pQWidget = static_cast(pFrame)->asChild(); -if (pQWidget->windowHandle() == QGuiApplication::modalWindow()) +QtFrame* pQtFrame = static_cast(pFrame); +if (pQtFrame->windowHandle() == pModalWin) { -m_pQWidget->setParent(pQWidget, m_pQWidget->windowFlags()); +QWidget* pNewParent = pQtFrame->asChild(); +if (pNewParent != m_pQWidget->parent()) +m_pQWidget->setParent(pNewParent, m_pQWidget->windowFlags()); break; } }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit f7346dc88200fa2160d39b4e4b4ae31fcad59a8c Author: Jan-Marek Glogowski AuthorDate: Sun Jan 9 01:01:49 2022 +0100 Commit: Jan-Marek Glogowski CommitDate: Sun Jan 9 12:06:45 2022 +0100 Qt use platform-independent visibility functions show() isn't just some conveniently renamed setVisible(true), but presents a window in a platform-dependant way, which - at least for WASM - means maximized and without a title bar. This is not really expected and WASM can also use multiple windows. Change-Id: I3fbaec1dfc2cd32bf3a90a94dcee01ebc88e58c7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128179 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 19d9c826f625..46f7a1a409ff 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -460,7 +460,7 @@ void QtFrame::Show(bool bVisible, bool bNoActivate) if (!bVisible) // hide { pSalInst->RunInMainThread([this]() { -asChild()->hide(); +asChild()->setVisible(false); if (m_pQWidget->isModal()) modalReparent(false); }); @@ -474,7 +474,7 @@ void QtFrame::Show(bool bVisible, bool bNoActivate) QWidget* const pChild = asChild(); if (m_pQWidget->isModal()) modalReparent(true); -pChild->show(); +pChild->setVisible(true); pChild->raise(); if (!bNoActivate && !isPopup()) {
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx | 11 +-- vcl/qt5/QtWidget.cxx |1 + 2 files changed, 6 insertions(+), 6 deletions(-) New commits: commit e63fe68fb1d0915b64fdf63f7fa6eed866fa3a0d Author: Jan-Marek Glogowski AuthorDate: Mon Dec 20 13:02:33 2021 +0100 Commit: Jan-Marek Glogowski CommitDate: Tue Dec 21 00:49:44 2021 +0100 Qt use asChild for pointer positioning .. and refactor some variable names. Change-Id: I7d31a7a377f614bdd78f8d09852a2eda0cc47442 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127153 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index ea1dee4fe916..15795b3e84e6 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -512,11 +512,10 @@ void QtFrame::SetDefaultPos() if (m_pParent) { const qreal fRatio = devicePixelRatioF(); -QWidget* const pWindow = m_pParent->GetQWidget()->window(); -QWidget* const pWidget = asChild(); -QPoint aPos = pWindow->rect().center() - pWidget->rect().center(); -SetPosSize(round(aPos.x() * fRatio), round(aPos.y() * fRatio), 0, 0, - SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y); +QWidget* const pParentWin = m_pParent->asChild()->window(); +QWidget* const pChildWin = asChild()->window(); +QPoint aPos = (pParentWin->rect().center() - pChildWin->rect().center()) * fRatio; +SetPosSize(aPos.x(), aPos.y(), 0, 0, SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y); assert(!m_bDefaultPos); } else @@ -863,7 +862,7 @@ void QtFrame::SetPointerPos(tools::Long nX, tools::Long nY) { // some cursor already exists (and it has m_ePointerStyle shape) // so here we just reposition it -QCursor::setPos(m_pQWidget->mapToGlobal(QPoint(nX, nY))); +QCursor::setPos(asChild()->mapToGlobal(QPoint(nX, nY))); } void QtFrame::Flush() diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 3078a7133764..40d912badc7d 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -257,6 +257,7 @@ void QtWidget::dropEvent(QDropEvent* pEvent) { m_rFrame.handleDrop(pEvent); } void QtWidget::moveEvent(QMoveEvent* pEvent) { +// already handled by QtMainWindow::moveEvent if (m_rFrame.m_pTopLevel) return;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtPainter.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 8c715d513eefaf619bf366add8aaf7f6dca15615 Author: Armin Le Grand (Allotropia) AuthorDate: Fri Nov 19 10:17:59 2021 +0100 Commit: Jan-Marek Glogowski CommitDate: Fri Nov 19 14:07:52 2021 +0100 Qt set QPainter AntiAlias hint from SalGraphics Change-Id: I1a9e6014ead24b6edff1dbb41b70c809204d01cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125549 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtPainter.cxx b/vcl/qt5/QtPainter.cxx index fdf2a4ec08d7..fc0057e5618f 100644 --- a/vcl/qt5/QtPainter.cxx +++ b/vcl/qt5/QtPainter.cxx @@ -54,4 +54,5 @@ QtPainter::QtPainter(QtGraphicsBackend& rGraphics, bool bPrepareBrush, sal_uInt8 setBrush(aColor); } setCompositionMode(rGraphics.m_eCompositionMode); +setRenderHint(QPainter::Antialiasing, m_rGraphics.getAntiAlias()); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFont.cxx | 57 - 1 file changed, 56 insertions(+), 1 deletion(-) New commits: commit 7bcc18ac67181d10d3479b3100647aceddd86750 Author: Armin Le Grand (Allotropia) AuthorDate: Thu Nov 18 18:06:39 2021 +0100 Commit: Jan-Marek Glogowski CommitDate: Thu Nov 18 22:02:18 2021 +0100 Qt implement QtFont::GetGlyphOutline Fixes FontWork with QFont based rendering. Change-Id: I294fe89d2753b6e82a559ff847b44126f9ea3bfc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125500 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFont.cxx b/vcl/qt5/QtFont.cxx index a9d84e897c1b..07bf9f541f0b 100644 --- a/vcl/qt5/QtFont.cxx +++ b/vcl/qt5/QtFont.cxx @@ -24,6 +24,7 @@ #include #include +#include static inline void applyWeight(QtFont& rFont, FontWeight eWeight) { @@ -151,7 +152,61 @@ hb_font_t* QtFont::ImplInitHbFont() return InitHbFont(hb_face_create_for_tables(getFontTable, this, nullptr)); } -bool QtFont::GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const { return false; } +bool QtFont::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rB2DPolyPoly, bool) const +{ +rB2DPolyPoly.clear(); +basegfx::B2DPolygon aPart; +QRawFont aRawFont(QRawFont::fromFont(*this)); +QPainterPath aQPath = aRawFont.pathForGlyph(nId); + +for (int a(0); a < aQPath.elementCount(); a++) +{ +const QPainterPath::Element aQElement = aQPath.elementAt(a); + +switch (aQElement.type) +{ +case QPainterPath::MoveToElement: +{ +if (aPart.count()) +{ +aPart.setClosed(true); +rB2DPolyPoly.append(aPart); +aPart.clear(); +} + +aPart.append(basegfx::B2DPoint(aQElement.x, aQElement.y)); +break; +} +case QPainterPath::LineToElement: +{ +aPart.append(basegfx::B2DPoint(aQElement.x, aQElement.y)); +break; +} +case QPainterPath::CurveToElement: +{ +const QPainterPath::Element aQ2 = aQPath.elementAt(++a); +const QPainterPath::Element aQ3 = aQPath.elementAt(++a); +aPart.appendBezierSegment(basegfx::B2DPoint(aQElement.x, aQElement.y), + basegfx::B2DPoint(aQ2.x, aQ2.y), + basegfx::B2DPoint(aQ3.x, aQ3.y)); +break; +} +case QPainterPath::CurveToDataElement: +{ +break; +} +} +} + +if (aPart.count()) +{ +aPart.setClosed(true); +rB2DPolyPoly.append(aPart); +aPart.clear(); +} + +return true; +} bool QtFont::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool) const {
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit f029fb6262b9a001e6cbfd60565b01a7b99ea627 Author: Michael Weghorn AuthorDate: Wed Nov 10 16:19:26 2021 +0100 Commit: Michael Weghorn CommitDate: Thu Nov 11 08:27:28 2021 +0100 qt (>=5.14): Don't create native window for QWidget in QtFrame::screen For Qt >= 5.14, directly use 'QWidget::screen' (added in Qt 5.14) to retrieve the screen that the widget is on, rather than first retrieving a window handle, which forces a platform-native window to be created. Due to QTBUG-75766 [1], forcing the creation of native windows also leads to mouseMoveEvents not being reliably emitted by Qt, s. commit 0e3c3b842e14b9646d3697cf1266be21359e0f13 Author: Michael Weghorn Date: Sat May 11 21:31:33 2019 +0200 tdf#122293 qt5: Use "alien widgets" by default on Wayland for more details. The behaviour described in tdf#122293 started showing up again after commit b00a68a8e19370e106cd76258a3c1825f43613ee Date: Sun Oct 31 02:33:46 2021 +0200 tdf#145363 Qt reparent modal dialogs on show but that just seems to have been a side-effect of 'QWidget::screen' now being called in different ways than previously. [1] https://bugreports.qt.io/browse/QTBUG-75766 Change-Id: Ic11923cef5e704c09494f96b19157372a869ae40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124997 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 591e084edf38..db91e48a256c 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -363,8 +363,15 @@ QWindow* QtFrame::windowHandle() const QScreen* QtFrame::screen() const { +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +return asChild()->screen(); +#else +// QWidget::screen only available from Qt 5.14 on, call windowHandle(), +// with the indirect result that mouse move events on Wayland will not be +// emitted reliably, s. QTBUG-75766 QWindow* const pWindow = windowHandle(); return pWindow ? pWindow->screen() : nullptr; +#endif } bool QtFrame::isMinimized() const { return asChild()->isMinimized(); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 373b27e7038cf4010a04163861ebec48984b4353 Author: Jan-Marek Glogowski AuthorDate: Wed Nov 10 12:18:39 2021 +0100 Commit: Jan-Marek Glogowski CommitDate: Wed Nov 10 15:35:12 2021 +0100 tdf#145508 Qt NONE-frames should still be windows This drops the newly "&& (nStyle != SalFrameStyleFlags::NONE))" introduced in the regressing commit e4abf879f4a24258bcc560eb58ca78b147768d46 ("tdf#145363 Qt popups actually are windows"). A GtkBox based UI snippet, like vcl/uiconfig/ui/combobox.ui, IMHO shoulden't be represented as a Qt::Window, but a Qt::Widget. But there is no real way to identify it, so lets keep the old, working code. Change-Id: Ic41ff15ab651b422ee95c906cac67e37be8d8a65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124958 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 1ae4016d589d..591e084edf38 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -138,7 +138,7 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) m_pParent = pParent; Qt::WindowFlags aWinFlags(Qt::Widget); -if (!(nStyle & SalFrameStyleFlags::SYSTEMCHILD) && (nStyle != SalFrameStyleFlags::NONE)) +if (!(nStyle & SalFrameStyleFlags::SYSTEMCHILD)) { if (nStyle & SalFrameStyleFlags::INTRO) aWinFlags = Qt::SplashScreen;
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtInstance.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit 324e2a5c3e6355e6b38db0add100465224841364 Author: Michael Weghorn AuthorDate: Fri Nov 5 14:00:31 2021 +0100 Commit: Michael Weghorn CommitDate: Fri Nov 5 16:17:45 2021 +0100 tdf#144994 QtInstance::CreateMenu needs SolarMutex It can be called from extensions (as is the case e.g. for LanguageTool, s. tdf#144994 comment 19; assertion is hit after clicking around in the menu a bit) and 'RunInMainThread' requires that the SolarMutex is held. Change-Id: I282ef6a21e60b636abb27aeba332ae3a634ce680 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124750 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 06840ad7281f..29a7d0e4ddf7 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -358,6 +358,7 @@ QtInstance::CreateVirtualDevice(SalGraphics& rGraphics, tools::Long& nDX, tools: std::unique_ptr QtInstance::CreateMenu(bool bMenuBar, Menu* pVCLMenu) { +SolarMutexGuard aGuard; std::unique_ptr pRet; RunInMainThread([&pRet, bMenuBar, pVCLMenu]() { QtMenu* pSalMenu = new QtMenu(bMenuBar);
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit e4abf879f4a24258bcc560eb58ca78b147768d46 Author: Jan-Marek Glogowski AuthorDate: Sun Oct 31 13:41:20 2021 +0100 Commit: Jan-Marek Glogowski CommitDate: Sun Oct 31 21:03:39 2021 +0100 tdf#145363 Qt popups actually are windows An other patch in the whole Qt popup handling saga. At this point it mainly exists as a prerequisite for the real tdf#145363 fix. I just wanted to keep it separate. Maybe it also helps Qt Wayland. Change-Id: Ib76e9919398bdd5fa7d6239ddb126859f0c0edbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124525 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 1fc9930ae83f..73bdad874552 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -138,7 +138,7 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) m_pParent = pParent; Qt::WindowFlags aWinFlags(Qt::Widget); -if (!(nStyle & SalFrameStyleFlags::SYSTEMCHILD)) +if (!(nStyle & SalFrameStyleFlags::SYSTEMCHILD) && (nStyle != SalFrameStyleFlags::NONE)) { if (nStyle & SalFrameStyleFlags::INTRO) aWinFlags = Qt::SplashScreen; @@ -153,7 +153,7 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) // a focus-out event, reaching the combo box. This used to map to // Qt::ToolTip, which doesn't feel that correct... else if (isPopup()) -aWinFlags = Qt::Widget | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint; +aWinFlags = Qt::Window | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint; else if (nStyle & SalFrameStyleFlags::TOOLWINDOW) aWinFlags = Qt::Tool; // top level windows can't be transient in Qt, so make them dialogs, if they have a parent. At least
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtFrame.cxx | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) New commits: commit 0a53b7be5975b474a6fafd2c6dc8280431551d94 Author: Jan-Marek Glogowski AuthorDate: Sun Oct 31 14:08:57 2021 +0100 Commit: Jan-Marek Glogowski CommitDate: Sun Oct 31 17:59:44 2021 +0100 Qt de-obfuscate the aWinFlags assignment The aWinFlags assignement is an obfuscated case statement, so this explicitly defaults to Qt::Widget and drops the whole or'ing. Change-Id: If6ac1817d1e600a174c1308a3bad0af5f3f9c30b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124524 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/QtFrame.cxx b/vcl/qt5/QtFrame.cxx index 2d4a068a34b1..1fc9930ae83f 100644 --- a/vcl/qt5/QtFrame.cxx +++ b/vcl/qt5/QtFrame.cxx @@ -137,32 +137,32 @@ QtFrame::QtFrame(QtFrame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) m_nStyle = nStyle; m_pParent = pParent; -Qt::WindowFlags aWinFlags; +Qt::WindowFlags aWinFlags(Qt::Widget); if (!(nStyle & SalFrameStyleFlags::SYSTEMCHILD)) { if (nStyle & SalFrameStyleFlags::INTRO) -aWinFlags |= Qt::SplashScreen; +aWinFlags = Qt::SplashScreen; // floating toolbars are frameless tool windows // + they must be able to receive keyboard focus else if ((nStyle & SalFrameStyleFlags::FLOAT) && (nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION)) -aWinFlags |= Qt::Tool | Qt::FramelessWindowHint; +aWinFlags = Qt::Tool | Qt::FramelessWindowHint; else if (nStyle & SalFrameStyleFlags::TOOLTIP) -aWinFlags |= Qt::ToolTip; +aWinFlags = Qt::ToolTip; // Can't use Qt::Popup, because it grabs the input focus and generates // a focus-out event, reaching the combo box. This used to map to // Qt::ToolTip, which doesn't feel that correct... else if (isPopup()) aWinFlags = Qt::Widget | Qt::FramelessWindowHint | Qt::BypassWindowManagerHint; else if (nStyle & SalFrameStyleFlags::TOOLWINDOW) -aWinFlags |= Qt::Tool; +aWinFlags = Qt::Tool; // top level windows can't be transient in Qt, so make them dialogs, if they have a parent. At least // the plasma shell relies on this setting to skip dialogs in the window list. And Qt Xcb will just // set transient for the types Dialog, Sheet, Tool, SplashScreen, ToolTip, Drawer and Popup. else if (nStyle & SalFrameStyleFlags::DIALOG || m_pParent) -aWinFlags |= Qt::Dialog; +aWinFlags = Qt::Dialog; else -aWinFlags |= Qt::Window; +aWinFlags = Qt::Window; } if (aWinFlags == Qt::Window)
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/QtInstance.cxx |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit 99983c3c0b855a3449cf974224fae338b578dbd5 Author: Michael Weghorn AuthorDate: Wed Sep 29 11:32:10 2021 +0200 Commit: Michael Weghorn CommitDate: Wed Sep 29 15:01:14 2021 +0200 qt: Use actual major Qt version number in toolkit ID This makes the qt6 VCL plugin actually show up as such instead of "qt5" in "Help" -> "About LibreOffice". Change-Id: I33804dc779c7f2692be260353dda2edc86ea8544 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122809 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx index 730e722754c9..42b7a8ed8a48 100644 --- a/vcl/qt5/QtInstance.cxx +++ b/vcl/qt5/QtInstance.cxx @@ -224,7 +224,8 @@ QtInstance::QtInstance(std::unique_ptr& pQApp, bool bUseCairo) , m_bUpdateFonts(false) { ImplSVData* pSVData = ImplGetSVData(); -pSVData->maAppData.mxToolkitName = constructToolkitID(u"qt5"); +const OUString sToolkit = "qt" + OUString::number(QT_VERSION_MAJOR); +pSVData->maAppData.mxToolkitName = constructToolkitID(sToolkit); // this one needs to be blocking, so that the handling in main thread // is processed before the thread emitting the signal continues
[Libreoffice-commits] core.git: vcl/qt5 vcl/unx
vcl/qt5/Qt5Graphics_Controls.cxx |4 ++-- vcl/qt5/Qt5SvpVirtualDevice.hxx |2 +- vcl/unx/kf5/KF5FilePicker.cxx|2 +- vcl/unx/kf5/KF5SalFrame.hxx |4 ++-- vcl/unx/kf5/KF5SalInstance.hxx |2 +- 5 files changed, 7 insertions(+), 7 deletions(-) New commits: commit 8728f287cd490411edc419bf39511a87e98af565 Author: Michael Weghorn AuthorDate: Mon Sep 27 16:47:10 2021 +0200 Commit: Michael Weghorn CommitDate: Wed Sep 29 12:59:37 2021 +0200 qt5/kf5: Drop 'qt5/' prefix from includes 'vcl/inc/qt5' is in the include path for the qt5 and kf5 VCL plugins, so there's no need for this (and it's not used in the other places, either). Change-Id: I1de3afd4399869e318dba2e7786711e65ef83c62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122803 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx index 5082e9340b2d..b7ab8d38ccc1 100644 --- a/vcl/qt5/Qt5Graphics_Controls.cxx +++ b/vcl/qt5/Qt5Graphics_Controls.cxx @@ -24,8 +24,8 @@ #include #include -#include -#include +#include +#include #include /** diff --git a/vcl/qt5/Qt5SvpVirtualDevice.hxx b/vcl/qt5/Qt5SvpVirtualDevice.hxx index f961d4ccfed2..3b76a6f5200a 100644 --- a/vcl/qt5/Qt5SvpVirtualDevice.hxx +++ b/vcl/qt5/Qt5SvpVirtualDevice.hxx @@ -20,7 +20,7 @@ #pragma once #include -#include +#include class VCL_DLLPUBLIC Qt5SvpVirtualDevice : public SvpSalVirtualDevice { diff --git a/vcl/unx/kf5/KF5FilePicker.cxx b/vcl/unx/kf5/KF5FilePicker.cxx index 20e64007bd96..c02ac7bc516b 100644 --- a/vcl/unx/kf5/KF5FilePicker.cxx +++ b/vcl/unx/kf5/KF5FilePicker.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/vcl/unx/kf5/KF5SalFrame.hxx b/vcl/unx/kf5/KF5SalFrame.hxx index d0fdd91978e6..613630b6c9d2 100644 --- a/vcl/unx/kf5/KF5SalFrame.hxx +++ b/vcl/unx/kf5/KF5SalFrame.hxx @@ -21,8 +21,8 @@ #include -#include -#include +#include +#include class QWidget; diff --git a/vcl/unx/kf5/KF5SalInstance.hxx b/vcl/unx/kf5/KF5SalInstance.hxx index 635f51ec9bc7..3009baecd3b0 100644 --- a/vcl/unx/kf5/KF5SalInstance.hxx +++ b/vcl/unx/kf5/KF5SalInstance.hxx @@ -19,7 +19,7 @@ #pragma once -#include +#include class KF5SalInstance final : public Qt5Instance {
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5Graphics_Controls.cxx |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) New commits: commit 8125fd6c5c3e7143704a1be281f46f42036184cb Author: Michael Weghorn AuthorDate: Fri Sep 24 09:15:26 2021 +0200 Commit: Michael Weghorn CommitDate: Fri Sep 24 13:59:09 2021 +0200 qt5: Avoid calling QApplication::fontMetrics It's deprecated in Qt 6. Change-Id: Idd7e93627a0c13b89b1a271c859ce29d01e55ce2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122556 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx index 4847603bf8ab..5082e9340b2d 100644 --- a/vcl/qt5/Qt5Graphics_Controls.cxx +++ b/vcl/qt5/Qt5Graphics_Controls.cxx @@ -795,7 +795,8 @@ bool Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart // find out the minimum size that should be used // assume contents is a text line QSize aContentSize = downscale(contentRect.size(), Round::Ceil); - aContentSize.setHeight(QApplication::fontMetrics().height()); +QFontMetrics aFontMetrics(QApplication::font()); +aContentSize.setHeight(aFontMetrics.height()); QSize aMinSize = upscale( sizeFromContents(QStyle::CT_ComboBox, &cbo, aContentSize), Round::Ceil); if (aMinSize.height() > contentRect.height()) @@ -838,7 +839,8 @@ bool Qt5Graphics_Controls::getNativeControlRegion(ControlType type, ControlPart case ControlPart::Entire: { QSize aContentSize = downscale(contentRect.size(), Round::Ceil); - aContentSize.setHeight(QApplication::fontMetrics().height()); +QFontMetrics aFontMetrics(QApplication::font()); +aContentSize.setHeight(aFontMetrics.height()); QSize aMinSize = upscale( sizeFromContents(QStyle::CT_SpinBox, &sbo, aContentSize), Round::Ceil); if (aMinSize.height() > contentRect.height())
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5Graphics_Controls.cxx |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) New commits: commit d0c2e5dde094c4e18e63e665e20e5d781fd90753 Author: Michael Weghorn AuthorDate: Fri Sep 24 08:48:37 2021 +0200 Commit: Michael Weghorn CommitDate: Fri Sep 24 13:58:54 2021 +0200 qt5: Don't use deprecated QStyleOptionProgressBarV2 typedef 'QStyleOptionProgressBarV2' is just a typedef for 'QStyleOptionProgressBar' in Qt 5 and has been removed in Qt 6. Change-Id: I7ee63d0ebe6b035b6048e54a94c98ca54942a7d4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122555 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5Graphics_Controls.cxx b/vcl/qt5/Qt5Graphics_Controls.cxx index 9d6779621234..4847603bf8ab 100644 --- a/vcl/qt5/Qt5Graphics_Controls.cxx +++ b/vcl/qt5/Qt5Graphics_Controls.cxx @@ -665,9 +665,7 @@ bool Qt5Graphics_Controls::drawNativeControl(ControlType type, ControlPart part, } else if (type == ControlType::Progress && part == ControlPart::Entire) { -SAL_WNODEPRECATED_DECLARATIONS_PUSH -QStyleOptionProgressBarV2 option; -SAL_WNODEPRECATED_DECLARATIONS_POP +QStyleOptionProgressBar option; option.minimum = 0; option.maximum = widgetRect.width(); option.progress = value.getNumericVal();
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5System.cxx | 16 1 file changed, 4 insertions(+), 12 deletions(-) New commits: commit 8248d4cd6021614461ae79adcd447d4c35e9fa96 Author: Michael Weghorn AuthorDate: Fri Sep 24 08:18:12 2021 +0200 Commit: Michael Weghorn CommitDate: Fri Sep 24 13:58:34 2021 +0200 qt5: Replace use of deprecated QDesktopWidget in Qt5System Change-Id: Id6ba8dfcf2f966f0e2e224990dec0309cd4d27d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122551 Tested-by: Michael Weghorn Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5System.cxx b/vcl/qt5/Qt5System.cxx index d769f7118ea5..e787ea0cab2b 100644 --- a/vcl/qt5/Qt5System.cxx +++ b/vcl/qt5/Qt5System.cxx @@ -7,26 +7,18 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include -#include +#include +#include -#include #include #include #include -unsigned int Qt5System::GetDisplayScreenCount() -{ -SAL_WNODEPRECATED_DECLARATIONS_PUSH -return QApplication::desktop()->screenCount(); -SAL_WNODEPRECATED_DECLARATIONS_POP -} +unsigned int Qt5System::GetDisplayScreenCount() { return QGuiApplication::screens().size(); } tools::Rectangle Qt5System::GetDisplayScreenPosSizePixel(unsigned int nScreen) { -SAL_WNODEPRECATED_DECLARATIONS_PUSH -QRect qRect = QApplication::desktop()->screenGeometry(nScreen); -SAL_WNODEPRECATED_DECLARATIONS_POP +QRect qRect = QGuiApplication::screens().at(nScreen)->geometry(); return toRectangle(scaledQRect(qRect, qApp->devicePixelRatio())); }
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5AccessibleWidget.cxx | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) New commits: commit 91798635258c2b1487f8265eff08633db4ec5ab2 Author: Michael Weghorn AuthorDate: Tue Sep 21 16:58:58 2021 +0200 Commit: Michael Weghorn CommitDate: Tue Sep 21 21:38:13 2021 +0200 qt5 a11y: Implement Qt5AccessibleWidget::is{Column,Row}Selected Change-Id: I2abfbc69a422a56dc07afd76f0c7a8ead1891830 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122398 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index f7d833407a75..3a6e5a288194 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -1212,9 +1212,31 @@ QString Qt5AccessibleWidget::columnDescription(int column) const return toQString(xTable->getAccessibleColumnDescription(column)); } -bool Qt5AccessibleWidget::isColumnSelected(int /* column */) const { return true; } +bool Qt5AccessibleWidget::isColumnSelected(int nColumn) const +{ +Reference xAc = getAccessibleContextImpl(); +if (!xAc.is()) +return false; + +Reference xTable(xAc, UNO_QUERY); +if (!xTable.is()) +return false; + +return xTable->isAccessibleColumnSelected(nColumn); +} -bool Qt5AccessibleWidget::isRowSelected(int /* row */) const { return true; } +bool Qt5AccessibleWidget::isRowSelected(int nRow) const +{ +Reference xAc = getAccessibleContextImpl(); +if (!xAc.is()) +return false; + +Reference xTable(xAc, UNO_QUERY); +if (!xTable.is()) +return false; + +return xTable->isAccessibleRowSelected(nRow); +} void Qt5AccessibleWidget::modelChange(QAccessibleTableModelChangeEvent*) {}
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5Widget.cxx |6 ++ 1 file changed, 6 insertions(+) New commits: commit 61cb81d67ebf6b342a1cdb46bf6eb25a49eb5ff4 Author: Jan-Marek Glogowski AuthorDate: Fri Sep 10 12:02:20 2021 +0200 Commit: Jan-Marek Glogowski CommitDate: Fri Sep 10 18:56:46 2021 +0200 tdf#144412 Qt5 reset m_nModKeyCode on key input Switching the input direction on Ctrl + L/R-Shift is actually no bug but a feature. It is triggered on key release, so it can be distinguished from / doesn't interfere with shortcut handling. That's what should happen. So trying to implement that behaviour correctly and seeing the appearingly wrong modifier events for gtk3, I found gtk3 resets the frames persistent mnModKeyCode for key input events, which also seems to fix the problem for qt5. Some additional discussion is also in tdf#103158. Regression from commit 862fdb98ca271b60a831cd5420fd16d5f9c1c747 ("tdf#143298 Qt5 send SalEvent::KeyModChange events"). Change-Id: Iafcd1db7abcdf078001ca0602ae6e374f2a169ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121858 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 64ad4f7539c4..ca23138b5739 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -514,6 +514,8 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEve if (eState == ButtonKeyState::Released) { +// sending the old mnModKeyCode mask on release is needed to +// implement the writing direction switch with Ctrl + L/R-Shift aModEvt.mnModKeyCode = rFrame.m_nKeyModifiers; nModCode &= ~nModMask; rFrame.m_nKeyModifiers &= ~nExtModMask; @@ -532,6 +534,9 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEve return false; } +// prevent interference of writing direction switch (Ctrl + L/R-Shift) with "normal" shortcuts +rFrame.m_nKeyModifiers = ModKeyFlags::NONE; + SalKeyEvent aEvent; aEvent.mnCharCode = (pEvent->text().isEmpty() ? 0 : pEvent->text().at(0).unicode()); aEvent.mnRepeat = 0; @@ -605,6 +610,7 @@ void Qt5Widget::closePopup() void Qt5Widget::focusOutEvent(QFocusEvent*) { +m_rFrame.m_nKeyModifiers = ModKeyFlags::NONE; endExtTextInput(); m_rFrame.CallCallback(SalEvent::LoseFocus, nullptr); closePopup();
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5Widget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit a1a83b6b3b4459de353e0cdc8cdf402370c0a5c4 Author: Jan-Marek Glogowski AuthorDate: Thu Aug 26 14:23:29 2021 +0200 Commit: Jan-Marek Glogowski CommitDate: Thu Aug 26 17:58:50 2021 +0200 tdf#144037 Qt5 just close popup with mouse outside How hard could it be to close a popup window when losing focus or clicking outside of it (AKA tdf#143114 problem 3)? At least with Qt it feels like solving an NP problem... So don't always force-close the popup window if clicked anywhere on it. Seems to be consistent with gen and gtk3. Change-Id: Ia1c231c0b51a55bec2c587feffcf14bb4b4cee55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121093 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 864701340ad3..64ad4f7539c4 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -182,7 +182,7 @@ void Qt5Widget::mousePressEvent(QMouseEvent* pEvent) { handleMousePressEvent(m_rFrame, pEvent); if (m_rFrame.isPopup() -|| !geometry().translated(geometry().topLeft() * -1).contains(pEvent->pos())) +&& !geometry().translated(geometry().topLeft() * -1).contains(pEvent->pos())) closePopup(); }
[Libreoffice-commits] core.git: vcl/qt5 vcl/unx
vcl/qt5/Qt5Instance.cxx| 18 +++--- vcl/unx/kf5/KF5SalInstance.cxx | 15 --- 2 files changed, 27 insertions(+), 6 deletions(-) New commits: commit 923b30aa27ceb377d6a540c012000e89ce5db31e Author: Jan-Marek Glogowski AuthorDate: Thu Aug 26 13:49:13 2021 +0200 Commit: Jan-Marek Glogowski CommitDate: Thu Aug 26 17:58:03 2021 +0200 tdf#144008 Qt5/Kf5 create frames in the GUI thread There was a 50% chance my pick would have been correct... ok, just half-true, as in hindsight, I should have preferred the secure variant using RunInMain to start with. I thought I could use some templated class functions to get rid of all the copy and paste, but that looked even more ugly. P.S. if you wonder - like myself - about the code formatting in Qt5Instance::CreateFrame: that if from clang-format. Change-Id: I3a6b0c12c9d71ad8e777ed82526d1515a249832c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121091 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx index 432af5e6f718..f1e34d2761b1 100644 --- a/vcl/qt5/Qt5Instance.cxx +++ b/vcl/qt5/Qt5Instance.cxx @@ -285,13 +285,21 @@ void Qt5Instance::deleteObjectLater(QObject* pObject) { pObject->deleteLater(); SalFrame* Qt5Instance::CreateChildFrame(SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle) { -return new Qt5Frame(nullptr, nStyle, m_bUseCairo); +SalFrame* pRet(nullptr); +RunInMainThread([&, this]() { pRet = new Qt5Frame(nullptr, nStyle, useCairo()); }); +assert(pRet); +return pRet; } SalFrame* Qt5Instance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) { assert(!pParent || dynamic_cast(pParent)); -return new Qt5Frame(static_cast(pParent), nStyle, m_bUseCairo); + +SalFrame* pRet(nullptr); +RunInMainThread( +[&, this]() { pRet = new Qt5Frame(static_cast(pParent), nStyle, useCairo()); }); +assert(pRet); +return pRet; } void Qt5Instance::DestroyFrame(SalFrame* pFrame) @@ -306,7 +314,11 @@ void Qt5Instance::DestroyFrame(SalFrame* pFrame) SalObject* Qt5Instance::CreateObject(SalFrame* pParent, SystemWindowData*, bool bShow) { assert(!pParent || dynamic_cast(pParent)); -return new Qt5Object(static_cast(pParent), bShow); + +SalObject* pRet(nullptr); +RunInMainThread([&]() { pRet = new Qt5Object(static_cast(pParent), bShow); }); +assert(pRet); +return pRet; } void Qt5Instance::DestroyObject(SalObject* pObject) diff --git a/vcl/unx/kf5/KF5SalInstance.cxx b/vcl/unx/kf5/KF5SalInstance.cxx index 608b5dccc4dc..9279ec50b98b 100644 --- a/vcl/unx/kf5/KF5SalInstance.cxx +++ b/vcl/unx/kf5/KF5SalInstance.cxx @@ -42,13 +42,22 @@ KF5SalInstance::KF5SalInstance(std::unique_ptr& pQApp, bool bUseCa SalFrame* KF5SalInstance::CreateChildFrame(SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle) { -return new KF5SalFrame(nullptr, nStyle, useCairo()); +SalFrame* pRet(nullptr); +RunInMainThread([&, this]() { pRet = new KF5SalFrame(nullptr, nStyle, useCairo()); }); +assert(pRet); +return pRet; } -SalFrame* KF5SalInstance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags nState) +SalFrame* KF5SalInstance::CreateFrame(SalFrame* pParent, SalFrameStyleFlags nStyle) { assert(!pParent || dynamic_cast(pParent)); -return new KF5SalFrame(static_cast(pParent), nState, useCairo()); + +SalFrame* pRet(nullptr); +RunInMainThread([&, this]() { +pRet = new KF5SalFrame(static_cast(pParent), nStyle, useCairo()); +}); +assert(pRet); +return pRet; } bool KF5SalInstance::hasNativeFileSelection() const
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5AccessibleWidget.cxx | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) New commits: commit f62cbfed55099170ae6f9c006c36bca3420424e3 Author: Michael Weghorn AuthorDate: Wed Jul 28 11:46:20 2021 +0200 Commit: Michael Weghorn CommitDate: Wed Jul 28 15:45:43 2021 +0200 qt5 a11y: Implement Qt5AccessibleWidget::minimumStepSize This makes use of the newly introduced XAccessibleValue::getMinimumIncrement method, s. Change-Id: Ie148a4e1cedbdbb5964f8565c81611d3480465cb, "Add XAccessibleValue::getMinimumIncrement method". With this in place, Accerciser now shows the correct "Minimum increment" and the exact decimal value instead of a rounded integer value for FormattedFields, s. note in commit message for Change-Id: I8af326c2d24c1801147a56ea2e2a886ab42ac634 "a11y: Expose FormattedField as spinbox" for more details. Change-Id: Ia9d07552197357c81ae8ea3b62e2de07e82148bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119597 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index c7008f36d26a..65d5faafb918 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -1090,6 +1090,7 @@ QVariant Qt5AccessibleWidget::currentValue() const xValue->getCurrentValue() >>= aDouble; return QVariant(aDouble); } + QVariant Qt5AccessibleWidget::maximumValue() const { Reference xAc = getAccessibleContextImpl(); @@ -1103,7 +1104,21 @@ QVariant Qt5AccessibleWidget::maximumValue() const xValue->getMaximumValue() >>= aDouble; return QVariant(aDouble); } -QVariant Qt5AccessibleWidget::minimumStepSize() const { return QVariant(); } + +QVariant Qt5AccessibleWidget::minimumStepSize() const +{ +Reference xAc = getAccessibleContextImpl(); +if (!xAc.is()) +return QVariant(); + +Reference xValue(xAc, UNO_QUERY); +if (!xValue.is()) +return QVariant(); +double dMinStep = 0; +xValue->getMinimumIncrement() >>= dMinStep; +return QVariant(dMinStep); +} + QVariant Qt5AccessibleWidget::minimumValue() const { Reference xAc = getAccessibleContextImpl(); @@ -1117,6 +1132,7 @@ QVariant Qt5AccessibleWidget::minimumValue() const xValue->getMinimumValue() >>= aDouble; return QVariant(aDouble); } + void Qt5AccessibleWidget::setCurrentValue(const QVariant& value) { Reference xAc = getAccessibleContextImpl(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5Widget.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 22997c4777eeb424493d1259b72db9a15ff37069 Author: Jan-Marek Glogowski AuthorDate: Thu Jul 22 18:14:01 2021 +0200 Commit: Jan-Marek Glogowski CommitDate: Thu Jul 22 19:27:50 2021 +0200 tdf#143493 Qt5 key modifier events don't have text Regression from commit 862fdb98ca271b60a831cd5420fd16d5f9c1c747 ("tdf#143298 Qt5 send SalEvent::KeyModChange events"). Change-Id: I6981af06e3a73dee45ed10416f5d3b17b860a73b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119375 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 93da76ecad76..ebb11cef51ff 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -456,7 +456,7 @@ bool Qt5Widget::handleKeyEvent(Qt5Frame& rFrame, const QWidget& rWidget, QKeyEve return true; } -if (nCode == 0) +if (nCode == 0 && pEvent->text().isEmpty()) { sal_uInt16 nModCode = GetKeyModCode(pEvent->modifiers()); SalKeyModEvent aModEvt; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5AccessibleWidget.cxx | 29 ++--- 1 file changed, 14 insertions(+), 15 deletions(-) New commits: commit 0f15f1ec7c7b9ed7abf4a40b9b9c2f3876ce3e5f Author: Michael Weghorn AuthorDate: Thu Jul 22 11:26:41 2021 +0200 Commit: Michael Weghorn CommitDate: Thu Jul 22 18:50:28 2021 +0200 qt5 a11y: Always query the XAccessibleContext for a11y interfaces The accessibility interfaces are implemented by the object implementing 'XAccessibilityContext' which is often the same as the 'XAccessible' (in which case the corresponding 'XAccessible::getAccessibleContext()' call just returns a reference to self), but it doesn't have to be that way. From offapi/com/sun/star/modules.idl: > /** UNO Accessibility API > > This modules contains the basic interfaces of the UAA (UNO > Accessibility API). Services that describe how these interfaces are > implemented can be found in other modules. The services in this module > describe only what every accessible object has to support. > > Making a class accessible starts by supporting the > ::com::sun::star::accessibility::XAccessible interface. > This interface's only method returns the actual accessibility object, an > instance of ::com::sun::star::accessibility::XAccessibleContext. > These two interfaces may be implemented by the same class in which case > a call to ::com::sun::star::accessibility::XAccessible getAccessible() > returns the same object that is > called. Alternatively the implementation of the > ::com::sun::star::accessibility::XAccessibleContext > interface can be done by another class. This makes it possible to put > all accessibility implementations into their own library which has only > to be loaded when necessary. > > Note that all other interfaces have to be implemented by the same > class that implements the > ::com::sun::star::accessibility::XAccessibleContext > interface. Note also that there is no way back from an accessibility > object to the object from which it has been obtained by means of the > UAA. If you need such a back-link you have to provide one on your > own. > */ > module accessibility {}; This e.g. makes Accerciser show the correct values of the "URL" and "Text" controls in Writer's "Insert" -> "Hyperlink" dialog. Change-Id: I909b1fdf5e1e7ca50db5d5191ae69cb558a49dc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119364 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index c68368085332..c7008f36d26a 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -556,8 +556,7 @@ QAccessible::Role Qt5AccessibleWidget::role() const } } -SAL_WARN("vcl.qt5", - "Unmapped role: " << m_xAccessible->getAccessibleContext()->getAccessibleRole()); +SAL_WARN("vcl.qt5", "Unmapped role: " << getAccessibleContextImpl()->getAccessibleRole()); return QAccessible::NoRole; } @@ -776,7 +775,7 @@ QAccessibleInterface* Qt5AccessibleWidget::customFactory(const QString& classnam QStringList Qt5AccessibleWidget::actionNames() const { QStringList actionNames; -Reference xAccessibleAction(m_xAccessible, UNO_QUERY); +Reference xAccessibleAction(getAccessibleContextImpl(), UNO_QUERY); if (!xAccessibleAction.is()) return actionNames; @@ -791,7 +790,7 @@ QStringList Qt5AccessibleWidget::actionNames() const void Qt5AccessibleWidget::doAction(const QString& actionName) { -Reference xAccessibleAction(m_xAccessible, UNO_QUERY); +Reference xAccessibleAction(getAccessibleContextImpl(), UNO_QUERY); if (!xAccessibleAction.is()) return; @@ -804,7 +803,7 @@ void Qt5AccessibleWidget::doAction(const QString& actionName) QStringList Qt5AccessibleWidget::keyBindingsForAction(const QString& actionName) const { QStringList keyBindings; -Reference xAccessibleAction(m_xAccessible, UNO_QUERY); +Reference xAccessibleAction(getAccessibleContextImpl(), UNO_QUERY); if (!xAccessibleAction.is()) return keyBindings; @@ -871,7 +870,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf *startOffset = -1; *endOffset = -1; -Reference xText(m_xAccessible, UNO_QUERY); +Reference xText(getAccessibleContextImpl(), UNO_QUERY); if (!xText.is()) return QString(); @@ -920,7 +919,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf int Qt5AccessibleWidget::characterCount() const { -Reference xText(m_xAccessible, UNO_
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5AccessibleWidget.cxx | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) New commits: commit b216a87d7a0956cbb864e73ec4fc5557ae93f64b Author: Michael Weghorn AuthorDate: Thu Jul 22 11:00:18 2021 +0200 Commit: Michael Weghorn CommitDate: Thu Jul 22 18:49:43 2021 +0200 qt5 a11y: Improve Qt5AccessibleWidget::attributes * handle case where out params are nullptr * set fallback values for out params at the beginning This e.g. makes Accerciser show '-1' for both, startIndex and endIndex for the text interface of the "URL" and "Text" controls in Writer's "Insert" -> "Hyperlink" dialog along with no text. Making the actual text show up if there is any will be handled in an upcoming commit. Change-Id: Ie864f729ad06e28684bd426e4ba37b8a9d4d4634 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119363 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index 33ad3634f24e..c68368085332 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -865,6 +865,12 @@ OUString lcl_convertFontWeight(double fontWeight) QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOffset) const { +if (startOffset == nullptr || endOffset == nullptr) +return QString(); + +*startOffset = -1; +*endOffset = -1; + Reference xText(m_xAccessible, UNO_QUERY); if (!xText.is()) return QString(); @@ -879,11 +885,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf offset = nTextLength - 1; if (offset < 0 || offset > nTextLength) -{ -*startOffset = -1; -*endOffset = -1; return QString(); -} const Sequence attribs = xText->getCharacterAttributes(offset, Sequence()); @@ -915,6 +917,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf *endOffset = offset + 1; return toQString(aRet); } + int Qt5AccessibleWidget::characterCount() const { Reference xText(m_xAccessible, UNO_QUERY); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5AccessibleWidget.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit bdf14fd8ea18b94cdcdf2b194d6644f87d69d96b Author: Michael Weghorn AuthorDate: Wed Jul 21 14:12:31 2021 +0200 Commit: Michael Weghorn CommitDate: Wed Jul 21 17:43:16 2021 +0200 qt5 a11y: Implement Qt5AccessibleWidget::cursorPosition Use 'XAccessibleText::getCaretPosition', similar to how 'Qt5AccessibleWidget::setCursorPosition' calls 'XAccessibleText::setCaretPosition'. Change-Id: Ic9e4533d6a39de90fee7ec2e8e0bd3fc6a69bba0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119320 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index 0cf79919501c..33ad3634f24e 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -872,7 +872,7 @@ QString Qt5AccessibleWidget::attributes(int offset, int* startOffset, int* endOf // handle special values for offset the same way base class's QAccessibleTextWidget::attributes does // (as defined in IAccessible 2: -1 -> length, -2 -> cursor position) if (offset == -2) -offset = cursorPosition(); // currently always returns 0 +offset = cursorPosition(); const int nTextLength = characterCount(); if (offset == -1 || offset == nTextLength) @@ -927,11 +927,15 @@ QRect Qt5AccessibleWidget::characterRect(int /* offset */) const SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::characterRect"); return QRect(); } + int Qt5AccessibleWidget::cursorPosition() const { -SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::cursorPosition"); +Reference xText(m_xAccessible, UNO_QUERY); +if (xText.is()) +return xText->getCaretPosition(); return 0; } + int Qt5AccessibleWidget::offsetAtPoint(const QPoint& /* point */) const { SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::offsetAtPoint"); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: vcl/qt5
vcl/qt5/Qt5AccessibleWidget.cxx | 59 1 file changed, 54 insertions(+), 5 deletions(-) New commits: commit 96869931e35fa4fbc779755e89207062648ed58d Author: Michael Weghorn AuthorDate: Wed Jul 21 11:27:53 2021 +0200 Commit: Michael Weghorn CommitDate: Wed Jul 21 17:42:45 2021 +0200 qt5 a11y: Implement Qt5AccessibleWidget::textAtOffset The Orca screen reader uses 'IAccessibleText::textAtOffset' e.g. in order to retrieve the text of the current Writer paragraph on cursor movement. With this and various other WIP changes to qt5 a11y on top which are required to make Orca speak at all (well, at least sometimes...), Orca now also speaks the text of paragraphs that contain more than just a single character. The single-character case was working because Orca has a special handling for this; a comment in the source code says: "We do this because Gecko's implementation of getTextAtOffset is broken if there is just one character in the string.") This implementation is inspired by the corresponding winaccessibility one, see 'CAccTextBase::get_textAtOffset' in winaccessibility/source/UAccCOM/AccTextBase.cxx. Change-Id: I67775a03c6e4384f410e1e9d727d7a412ba4112e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119310 Tested-by: Jenkins Reviewed-by: Michael Weghorn diff --git a/vcl/qt5/Qt5AccessibleWidget.cxx b/vcl/qt5/Qt5AccessibleWidget.cxx index ee93bc6a21de..0cf79919501c 100644 --- a/vcl/qt5/Qt5AccessibleWidget.cxx +++ b/vcl/qt5/Qt5AccessibleWidget.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,33 @@ int Qt5AccessibleWidget::indexOfChild(const QAccessibleInterface* /* child */) c namespace { +sal_Int16 lcl_matchQtTextBoundaryType(QAccessible::TextBoundaryType boundaryType) +{ +switch (boundaryType) +{ +case QAccessible::CharBoundary: +return com::sun::star::accessibility::AccessibleTextType::CHARACTER; +case QAccessible::WordBoundary: +return com::sun::star::accessibility::AccessibleTextType::WORD; +case QAccessible::SentenceBoundary: +return com::sun::star::accessibility::AccessibleTextType::SENTENCE; +case QAccessible::ParagraphBoundary: +return com::sun::star::accessibility::AccessibleTextType::PARAGRAPH; +case QAccessible::LineBoundary: +return com::sun::star::accessibility::AccessibleTextType::LINE; +case QAccessible::NoBoundary: +// assert here, better handle it directly at call site +assert(false + && "No match for QAccessible::NoBoundary, handle it separately at call site."); +break; +default: +break; +} + +SAL_WARN("vcl.qt5", "Unmatched text boundary type: " << boundaryType); +return -1; +} + QAccessible::Relation lcl_matchUnoRelation(short relationType) { switch (relationType) @@ -968,13 +996,34 @@ QString Qt5AccessibleWidget::textAfterOffset(int /* offset */, SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::textAfterOffset"); return QString(); } -QString Qt5AccessibleWidget::textAtOffset(int /* offset */, - QAccessible::TextBoundaryType /* boundaryType */, - int* /* startOffset */, int* /* endOffset */) const + +QString Qt5AccessibleWidget::textAtOffset(int offset, QAccessible::TextBoundaryType boundaryType, + int* startOffset, int* endOffset) const { -SAL_INFO("vcl.qt5", "Unsupported QAccessibleTextInterface::textAtOffset"); -return QString(); +if (startOffset == nullptr || endOffset == nullptr) +return QString(); + +if (boundaryType == QAccessible::NoBoundary) +{ +const int nCharCount = characterCount(); +*startOffset = 0; +*endOffset = nCharCount; +return text(0, nCharCount); +} + +Reference xText(m_xAccessible, UNO_QUERY); +if (!xText.is()) +return QString(); + +sal_Int16 nUnoBoundaryType = lcl_matchQtTextBoundaryType(boundaryType); +assert(nUnoBoundaryType > 0); + +const TextSegment segment = xText->getTextAtIndex(offset, nUnoBoundaryType); +*startOffset = segment.SegmentStart; +*endOffset = segment.SegmentEnd; +return toQString(segment.SegmentText); } + QString Qt5AccessibleWidget::textBeforeOffset(int /* offset */, QAccessible::TextBoundaryType /* boundaryType */, int* /* startOffset */, int* /* endOffset */) const ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits