summaryrefslogtreecommitdiff
path: root/vcl/qt5
AgeCommit message (Collapse)Author
2024-10-05tdf#130857 qt a11y weld: Convert accelerator for labelsMichael Weghorn
Convert the accelerator from GTK to Qt convention for labels as well, to not display a literal "_", but use the next letter as the accelerator. For Qt, a literal "&" would still be displayed if no buddy is actually set, i.e. there is no related widget that can receive keyboard focus when the accelerator key is pressed together with Alt. Setting buddies was implemented in previous commit Change-Id: Iba1e766c0f2c5162beb5b938c134afab0dac68b7 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 22:56:05 2024 +0200 tdf#130857 qt a11y weld: Set "buddy" (mnemonic widget) . Together with the above commit, this commit makes the "Alt Text" label in the "Alt Text" dialog (cui/ui/objecttitledescdialog.ui) show up as expected with qt6 in a WIP branch that declares that .ui file as supported in QtInstanceBuilder::IsUIFileSupported, while it was previously shown as "_Alt Text". Change-Id: Ief58dfc6864da9043766eec4eec36da44ae7017b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174511 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-05tdf#130857 qt a11y weld: Set "buddy" (mnemonic widget)Michael Weghorn
Based on previous commits Change-Id: I878eec7be5e82fac3e1b944d7fed7bf6711744ce Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 22:04:08 2024 +0200 tdf#130857 VclBuilder: Move mnemonic-widget bookkeeping to base class and Change-Id: I32c922f91e5e1d06c003e6d26a4342cbb98942e1 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 22:18:17 2024 +0200 tdf#130857 VclBuilder: Extract setMnemonicWidget helper + call from base , implement handling for mnemonic widgets for labels for native Qt widgets in QtBuilder: * call BuilderBase::extractMnemonicWidget when processing a "GtkLabel" object, in the same way that VclBuilder does that. * implement actually setting the mnemonic widget by calling QLabel::setBuddy [1] in QtBuilder::setMnemonicWidget to set the "buddy" (mnemonic widget) This makes Orca in a WIP branch to support a native qt6 "Alt Text" dialog announce the label text as well when the corresponding QLineEdit/QPlainTextEdit receives focus, as setting the buddy also ensures that the accessible labelledy-by/label-for relations get reported on the AT-SPI layer, see also commit 09789838bbbe57d207a66532b38cbba67ec59d70 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 21:39:44 2024 +0200 tdf#119931: cui a11y: Specify mnenomic-widget in "Alt Text" dialog which describes the scenario a bit more for the gtk3 variant. [1] https://doc.qt.io/qt-6/qlabel.html#setBuddy Change-Id: Iba1e766c0f2c5162beb5b938c134afab0dac68b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174510 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-05tdf#130857 VclBuilder: Extract setMnemonicWidget helper + call from baseMichael Weghorn
Instead of iterating over the map of mnemonic widgets in the VclBuilder ctor, split the logic: Add a new purely virtual WidgetBuilder::setMnemonicWidget method to the base class that passes the IDs of a single pair of label + the corresponding mnemonic widget as params, and let WidgetBuilder::processUIFile call the method once for every pair in the map. Implement that for VclBuilder (by moving the remaining logic for that previously in the ctor) to the new override VclBuilder::setMnemonicWidget and add a dummy implementation for QtBuilder that only triggers a warning for now. Change-Id: I32c922f91e5e1d06c003e6d26a4342cbb98942e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174509 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-05tdf#130857 qt weld: Add a QtInstanceTextViewMichael Weghorn
Add a native Qt implementation for weld::TextView QtInstanceTextView, that uses a QPlainTextEdit, and let QtInstanceBuilder use it when it encounters a "GtkTextView" object in a .ui file. Implement methods which are probably the most relevant ones. For now, trigger an assert in case any of the not yet implemented methods gets called. None of the .ui files currently marked as supported by QtInstanceBuilder uses this new class yet, but it will be needed to support more in the future, e.g. for cui/uiconfig/ui/objecttitledescdialog.ui. With this commit in place, adding that file to the set of supported ones in QtInstanceBuilder::IsUIFileSupported makes the dialog somehow show up as a native Qt dialog with the qt6 VCL plugin when e.g. selecting a QR code in an existing document, then opening the context menu and choosing "Alt Text", but there are various issues that still need to be fixed before it can actually be claimed as working/supported. Change-Id: Id7217d4a8a86f953d8b289c8a09cb8d1e2040bf1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174495 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-05tdf#130857 qt weld: Add basic handling for "GtkScrolledWindow"Michael Weghorn
Create a QScrollArea when encountering a "GtkScrolledWindow" object in a .ui file. This commit does not yet implement an actual Qt-native weld::ScrolledWindow, i.e. QtInstanceBuilder::weld_scrolled_window currently still triggeres an assert. This will help to support cui/uiconfig/ui/objecttitledescdialog.ui, which has a GtkScrolledWindow, but SvxObjectTitleDescDialog doesn't explicitly interact with it, so this basic implementation is sufficient for a start. Change-Id: I80d2565e57809be0cc3ae452359d0d1b827e46f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174494 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-05tdf#130857 qt weld: Add QtInstanceEntryMichael Weghorn
Add a native Qt implementation for weld::Entry, QtInstanceEntry, that uses a QLineEdit, and let QtInstanceBuilder use it when it encounters a "GtkEntry" object in a .ui file. Implement the most straightforward and probably most relevant methods, and trigger an assert in case one of the not yet implemented methods gets called for now. These can be implemented when adding support for .ui files whose dialogs make use of these features. None of the .ui files currently marked as supported by QtInstanceBuilder uses this new class yet, but it will be needed to support more in the future. Change-Id: I56e26fe22b1cc0cb7d61cfd1503991273957e23f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174489 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-05tdf#130857 qt weld: Show help when help button clickedMichael Weghorn
Add special handling for the "Help" button in QtInstanceDialog::handleButtonClick: Don't close the dialog with the corresponding response code, but instead request help, by calling Help::Start with the widget's help ID and QtInstanceWidget as parameters. Together with the previous commit Change-Id: I274886d8045b31ccbc92f586e2ead20ff7407d15 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 14:41:29 2024 +0200 tdf#130857 qt weld: Handle help ID that implemented setting/getting the help ID for a QtInstanceWidget, this makes the "Axes" (online) help page show up when pressing the "Help" button in the "Insert Axes..." dialog when using the qt6 VCL plugin, which is using a native QDialog by default since Change-Id: I15901f83192ba33ddc5c5eb779be680f26cb6b55 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 10:53:28 2024 +0200 tdf#130857 qt weld: Declare support for chart "Insert Axes" dialog (See that commit's commit message for how to trigger the dialog.) See also Dialog::ResponseHdl for the VCL variant, which also has a corresponding special handling for the button with response code RET_HELP. Change-Id: I81e682822defec7a1e58d5a1b3b3eadc3f0040c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174482 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-05tdf#130857 qt weld: Handle help IDMichael Weghorn
Implement handling for the help ID by using a new property PROPERTY_HELP_ID that is set on the QtInstanceWidget's QWidget. Implement QtInstanceWidget::set_help_id and QtInstanceWidget::get_help_id accordingly. For setting the ID, introduce and use a static helper method QtInstanceWidget::setHelpId and use that in QtBuilder::makeObject to set the help ID based on help root and widget ID, in line with what is done at the end of VclBuilder::makeObject for the vcl::Window-based builder. Change-Id: I274886d8045b31ccbc92f586e2ead20ff7407d15 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174481 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-05qt: Add SolarMutexGuard in QtInstance::CreateFrame etc.Michael Weghorn
These methods call QtInstance::RunInMainThread, so must hold the solar mutex, see the call to DBG_TESTSOLARMUTEX(); at the very beginning of that method. (I've seen QtInstance::CreateFrame getting called without the mutex held in a WIP branch to add support for the "Help" button for native (welded) Qt dialogs.) Change-Id: I46adb708a84c031d63d94768c7600cbf3940ad21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174480 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-05tdf#130857 qt weld: Move button clicked logic to QtInstanceDialogMichael Weghorn
Move the logic to close the dialog with the corresponding respone code when a button gets clicked from an anonymous lambda function in QtBuilder::tweakInsertedChild to a new static helper method in QtInstanceButton: QtInstanceDialog::handleButtonClick This is in preparation of adding special handling for the "Help" button in an upcoming commit, which - unlike other buttons - should not just close the dialog with a corresponding response code. Change-Id: Idfd08d90df930a25437f99a609a38804bf80bff7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174479 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-05tdf#130857 qt a11y weld: Apply ATK/a11y propertiesMichael Weghorn
Set accessible name and description on the QWidget as specified in the .ui file. This e.g. makes Orca announce the a11y description of the checkboxes in the "Insert" -> "Axes" dialog newly supported by QtInstanceBuilder since Change-Id: I15901f83192ba33ddc5c5eb779be680f26cb6b55 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 10:53:28 2024 +0200 tdf#130857 qt weld: Declare support for chart "Insert Axes" dialog Change-Id: I403139577e6a932bb92da851dabd3cb994453083 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174468 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-05tdf#130857 qt weld: Convert GTK to Qt accelerator/mnemonicMichael Weghorn
When setting the checkbox text, don't pass the string as is, but convert to Qt's convention for the accelerator, using "&" instead of "_", using the existing helper function. This addresses the following issue mentioned in previous commit Change-Id: I15901f83192ba33ddc5c5eb779be680f26cb6b55 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 10:53:28 2024 +0200 tdf#130857 qt weld: Declare support for chart "Insert Axes" dialog > Mnemonic underlines for the checkboxes are currently > not the way they're meant to be, but that's a different > issue that will be addressed in a separate commit. Change-Id: I7b86adf396297de8de9b28fcb7e46c3428893c48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174467 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-05tdf#130857 qt weld: Declare support for chart "Insert Axes" dialogMichael Weghorn
Add the .ui file for the "Insert Axes" chart dialog to the list of .ui files supported by QtInstanceBuilder. Now that Change-Id: Ie917a501466bad8821fc3e7f5049db7c1a56995f Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Oct 4 10:38:32 2024 +0200 tdf#130857 qt weld: Create QGroupBox for "GtkFrame" added support for "GtkFrame", all widget types used by that dialog are handled by QtBuilder. This dialog can be seen as follows: * start Calc * "Insert" -> "Chart", confirm with "Finish" button * "Insert" -> "Axes" (while the chart is still selected) X and Y axes are shown/hidden as expected according to whether the corresponding checkboxes are ticked or unticked before closing the dialog using "OK". Mnemonic underlines for the checkboxes are currently not the way they're meant to be, but that's a different issue that will be addressed in a separate commit. Change-Id: I15901f83192ba33ddc5c5eb779be680f26cb6b55 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174466 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-05tdf#130857 qt weld: Create QGroupBox for "GtkFrame"Michael Weghorn
Handle "GtkFrame" objects from .ui files and create a QGroupBox [1] for them. While there's also a QFrame class in Qt, QGroupBox seems more suitable, as it allows setting a title, while QFrame doesn't. Add special handling for the label child of the "GtkFrame". Quoting from the GtkFrame doc [2]: > The GtkFrame implementation of the GtkBuildable interface supports > placing a child in the label position by specifying “label” as the > “type” attribute of a <child> element. A normal content child can be > specified without specifying a <child> type attribute. Example for a frame label in chart2/uiconfig/ui/insertaxisdlg.ui: <child type="label"> <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can-focus">False</property> <property name="hexpand">True</property> <property name="label" translatable="yes" context="insertaxisdlg|label1">Axes</property> <attributes> <attribute name="weight" value="bold"/> </attributes> </object> </child> In order to set the label's text as the text for the QGroupBox, identify that label child in QtBuilder::tweakInsertedChild, take over its text as the QGroupBox title, and mark the label for deletion, as it's no longer needed, since the QGroupBox handles its title itself from then on. [1] https://doc.qt.io/qt-6/qgroupbox.html [2] https://docs.gtk.org/gtk4/class.Frame.html Change-Id: Ie917a501466bad8821fc3e7f5049db7c1a56995f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174465 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-02tdf#130857 qt weld: Add QtInstanceCheckButtonMichael Weghorn
Add a QtInstanceCheckButton as the native Qt implementation for a weld::CheckButton. This uses a QCheckBox. Handle the "GtkCheckButton" object type from .ui files in QtBuilder. This will e.g. be needed for the "Insert" -> "Axes..." dialog seen in Calc after a chart has been inserted and double-clicked -- once further remaining aspects needed to be able to support that dialog has been implemented and it will be enabled in QtInstanceBuilder::IsUIFileSupported. The handling for the "inconsistent" state is mostly based on the the VCL implementation, see SalInstanceCheckButton::set_inconsistent etc. QtInstanceCheckButton::QtInstanceCheckButton::set_label_wrap remains unimplemented for now and triggers an assert, can be implemented when adding support for a dialog that actually makes use of it. Change-Id: I1e43ba25a23312534ee7cc0e650cd6e7aae20000 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174398 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-02tdf#130857 qt weld: Add new layout to parent layoutMichael Weghorn
Similar to the way it's already done for widgets a few lines above, also add a newly created layout to the parent layout (if the parent is a layout). This makes the case where a QLayout is inside a QLayout (e.g. a "GtkBox" inside a "GtkBox" in the .ui file) work, where previously, the inner layout wouldn't be added to the hierarchy, and thus not be displayed in the dialog. Quoting from the QLayout::addItem doc [1]: > This function is not usually called in application code. To add a widget > to a layout, use the addWidget() function; to add a child layout, use > the addLayout() function provided by the relevant QLayout subclass. Therefore, cast to QBoxLayout, the only QLayout type used so far and call QBoxLayout::addLayout to add the child layout. (This might have to be extended when using e.g. QGridLayout in the future as well.) This will e.g. be needed for the "Tools" -> "Word count" dialog in Writer or the "Insert" -> "Axes..." dialog seen in Calc when a chart is selected -- once further remaining aspects needed to be able to support those have been implemented and they'll be enabled in QtInstanceBuilder::IsUIFileSupported. Change-Id: I518b9a33be1db419737a80aee44d93b2a7be1094 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174397 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-02tdf#130857 qt weld: Move runAsync logic to QtInstanceDialogMichael Weghorn
Refactor the handling for running a QtInstanceMessageDialog asynchronously, and reuse the logic for the QtInstanceDialog base class: Move implementations for both QtInstanceMessageDialog::runAsync methods and the involved class members from QtInstanceMessageDialog to QtInstanceDialog. Split the previous logic from QtInstanceMessageDialog::dialogFinished into two methods: * move most of the logic as is to a new virtual slot in the base class, QtInstanceDialog::dialogFinished * override the base class implementation to get the response code from the actually clicked button via the PROPERTY_VCL_RESPONSE_CODE property set on that button, and call the base class method with that one. For QtInstanceDialog, there's no QDialog::clickedButton method that could be used to retrieve the clicked button, but it's also not needed there, because there a slot connected to the QAbstractButton::clicked signal that triggers closing the dialog, and passes the proper response code of the corresponding button already, see commit 08b55df5c9e42c1ccb78a156261811875629342a Author: Michael Weghorn <m.weghorn@posteo.de> Date: Sat Sep 28 00:32:15 2024 +0200 tdf#130857 qt weld: Close dialog on button click With this commit in place, QtInstanceDialog can now also be run asynchronously, instead of the QtInstanceDialog::runAsync methods just returning true without doing anything. This will be needed e.g. when adding support for the "Tools" -> "Word Count" dialog in Writer. Change-Id: I4edb9443cb11d1dc831a18f708cdbdd67c239aa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174374 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-10-02tdf#130857 qt weld: Let QtInstancDialog subclass QObjectMichael Weghorn
... and add the Q_OBJECT macro, in preparation of moving some logic from the QtInstanceMessageDialog subclass to QtInstanceDialog for reuse. Change-Id: Iaf76ae3efb352dd04d15716174818e8a902a16cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174373 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-02tdf#130857 qt weld: Add initial QtInstanceLabel implementationMichael Weghorn
Add a new QtInstanceLabel class as the native Qt weld::Label implementation and implement the straightforward and most important methods, and let the less common ones trigger an assert for now. Implement QtInstanceBuilder::weld_label to return an instance of QtInstanceLabel. This will e.g. be needed when adding support for the "Tools" -> "Word Count" dialog in Writer in the future, once more missing aspects have been implemented. Change-Id: I911bd68ad641b15883a0c6aa0707fd590fc05f96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174366 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-10-01tdf#160837 qt a11y: Don't report window role for non-top-levelMichael Weghorn
Quoting from offapi/com/sun/star/accessibility/AccessibleRole.idl, AccessibleRole::Frame is for: > A top level window with a title bar, border, menu bar, etc. > It is often used as the primary window for an application. However, the FRAME role also gets used for frames that are not actually top-levels at least with the Qt-based VCL plugins, where there is an object of role FRAME as a child of the actual top-level for e.g. the Writer main window. (The actual top-level is a QtMainWindow.) That frame contains the window content starting right below the (native) menu bar. Mapping the AccessibleRole::FRAME a11y role to the Qt equivalent QAccessible::Window would result in window-relative positions reported via AT-SPI to be relative to that frame, instead of the actual top-level, s. the implementation in qtbase's AtSpiAdaptor::translateFromScreenCoordinates [1] which calculates the relative position to the first top-level in its a11y hierarchy. This resulted in Accerciser's highlighting of the currently selected object to be too far up, as the "window-relative position" was missing the menu bar height in the y coordinate when window-relative positions are used, which is the case on Wayland, s.a. the commit message of commit a499874d9c0685d79b629b4bb246394b6b15691a Author: Michael Weghorn <m.weghorn@posteo.de> Date: Thu Sep 26 18:22:12 2024 +0200 tdf#160837 qt: Rely on toolkit for frame positions, drop menubar hack for more background. To fix this, prevent reporting an invalid top-level window role for frames that are not actually top-levels: When mapping AccessibleRole::FRAME to a corresponding Qt a11y role, take into account whether the frame still has another (real) top-level window as a parent. This makes the highlighted area in Accerciser become correct when using LO with the qt6 VCL plugin and Accerciser with ACCERCISER_WINDOW_MANAGER=kwin in a KDE Plasma Wayland session. The same would generally make sense for AccessibleRole::DIALOG. However, there that would currently result in the additional semantics of this being a dialog (not another kind of top-level window) getting lost when doing so. As dialogs usually don't have a separate menu bar, at least the incorrect reporting of window-relative positions is less relevant. Leave dialog unchanged for now, maybe reconsider later as needed. Ultimately, using native Qt widgets for dialogs (see tdf#130857) should presumably fix the underlying problem of the extra frame on VCL side being used altogether. [1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp?id=da4a6cf78ff42a4f69c2775997ff174ef647f3f3#n2401 Change-Id: I5ae066bd996f042b370b067a30213d3a1045480e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174350 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-30tdf#130857 qt a11y weld: Set GtkBuilder ID as widget's accessible IDMichael Weghorn
Set the GtkBuilder ID specified in .ui files as the accessible ID for the QWidget created for the object, in line with what happens for other implementations as well. This is basically the equivalent of commit c64b823b74cbd3063d6e87643bd68ea5343b2f54 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Tue Jul 16 13:57:41 2024 +0200 tdf#155447 qt a11y: Report accessible ID for the case where native Qt widgets are used instead of vcl::Window. Other than QWidget, QLayout is not part of the a11y hierarchy of an application, so there's nothing to do for these. This e.g. makes Accerciser show an accessible ID of "LicenseDialog" for the "Help" -> "License Information" dialog. The accessible ID set this way currently isn't reported on the AT-SPI level for QMessageBox (e.g. the "Save Document?" dialog) however. Suggested upstream change to make that work as well: [1] [1] https://codereview.qt-project.org/c/qt/qtbase/+/594390 Change-Id: I50e8ca6f8bea628df5a80d101c4a0a7bfded9c19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174158 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-30tdf#130857 qt weld: Set dialog title and modalityMichael Weghorn
If the "title" or "modal" properties are set, set the dialog title/modality for the QDialog accordingly. This makes the "Help" -> "License Information" dialog show the "Licensing and Legal information" title for the native Qt dialog as well, which gets used by default for the Qt-based VCL plugins since commit 178430733b0687a0f9334dda9a66e9b58ec8e7b0 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Sat Sep 28 00:43:21 2024 +0200 tdf#130857 qt weld: Declare support for "License Information" dialog Change-Id: I5c89eef04967d6d456474600f860dca19a6009e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174154 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28tdf#130857 qt weld: Declare support for "License Information" dialogMichael Weghorn
Now that previous commits have implemented what's needed to display the dialog and for button clicks to result in the expected action, add the .ui file for the "Help" -> "License Information" dialog to the list of supported .ui files for QtInstanceBuilder, so native Qt widgets will be used for that one with the Qt-based VCL plugins unless starting LO with the SAL_VCL_QT_NO_WELDED_WIDGETS environment variable set. Change-Id: I8a2dff1c751739567a3c9c0728e3357859069a9b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174080 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28tdf#130857 qt weld: Close dialog on button clickMichael Weghorn
For QDialogs (created for "GtkDialog" objects in .ui files) that have a button box, let clicking any of the buttons that have a response code set close the dialog with that response code by connecting to the QAbstractButton::clicked signal. This addresses the remaining aspect for the "Help" -> "License Information" dialog mentioned in earlier commit Change-Id: Ic9393755ec474f77ff22a1115e3cccba9d7b26cb Author: Michael Weghorn <m.weghorn@posteo.de> Date: Sat Sep 28 00:07:28 2024 +0200 tdf#130857 qt weld: Add initial support for dialog and label > However, currently (...) clicking the buttons doesn't yet have any > effect. Actually using Qt(InstanceBuilder) for that dialog will be enabled in an upcoming commit. Change-Id: Ie3c26963318fd5832688e3ed73f6952e09da4bb7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174079 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28tdf#130857 qt weld: Move button response prop to QtInstanceDialogMichael Weghorn
It will be used for QDialog as well, not just QMessageBox Change-Id: I887b3fe45beea40cc92f2b0b77f316ad73d7f922 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174078 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28tdf#130857 qt weld: Ensure dialog button box is last in layoutMichael Weghorn
For QDialog, make sure that if a button box is included in the dialog's layout, that this is the last item in the layout, by removing from the layout and adding it at the end again. I don't see any explicit child index explicitly being set in the .ui file for the "Help" -> "License Information" dialog ("sfx/ui/licensedialog.ui"). Potentially GTK implicitly visually makes the dialog's button box the last item in the dialog. Corresponding child is this one: <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> Potentially the `<child internal-child="action_area">` identifies this as the dialog's button box that should be last, at least dialog newly created in glade also has that set. For QMessageBox, which is a QDialog subclass, this special handling is not needed, as its default button box is used, which is already at the right place. This addresses the first aspect mentioned in previous commit: Change-Id: Ic9393755ec474f77ff22a1115e3cccba9d7b26cb Author: Michael Weghorn <m.weghorn@posteo.de> Date: Sat Sep 28 00:07:28 2024 +0200 tdf#130857 qt weld: Add initial support for dialog and label > However, currently buttons and the label with the text > are in the wrong order (i.e. buttons are above the text) Still missing: > and clicking the buttons doesn't yet have any effect. Change-Id: Id991551548c1e54fdf2e169886a6c67fc307931f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174077 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28tdf#130857 qt weld: Add initial support for dialog and labelMichael Weghorn
Add initial support for the "GtkDialog" and "GtkLabel" objects in .ui files by creating corresponding Qt widgets (QDialog for "GtkDialog" and QLabel for "GtkLabel"). This makes the elements of the "Help" -> "License Information" show up once the .ui file of that that dialog ("sfx/ui/licensedialog.ui") is added to the set of supported .ui files. However, currently buttons and the label with the text are in the wrong order (i.e. buttons are above the text) and clicking the buttons doesn't yet have any effect. Those aspects will be addressed in separate commits before actually claiming support for the dialog in QtInstanceBuilder::IsUIFileSupported. Change-Id: Ic9393755ec474f77ff22a1115e3cccba9d7b26cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174076 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28tdf#130857 qt weld: Use QDialog* as param for findButtonBoxMichael Weghorn
Don't restrict to QMessageBox, but allow using the method with any QDialog, and don't assert that the dialog has a layout set in this case. The method will be reused in an upcoming commit. Change-Id: I1992f2eb4f34b25e487bbd349631b6ecd4365c95 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174075 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28tdf#130857 qt weld: Avoid unnecessary OUString copyMichael Weghorn
Change-Id: I36802f84070e579b714b696144536a2f130e2f7a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174074 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28tdf#130857 qt weld: Use "p" prefix for pointer param nameMichael Weghorn
Change-Id: I732b67ef6f864fcbb1724b6d6bc3290417660dcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174073 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28tdf#130857 qt weld: Set widget layout and add to parent layoutMichael Weghorn
When creating a QLayout, pass the parent widget to the ctor as well, which makes the layout be set for the widget. Quoting from the QVBoxLayout ctor doc [1] > Constructs a new top-level vertical box with parent parent. > > The layout is set directly as the top-level layout for parent. > There can be only one top-level layout for a widget. It is returned > by QWidget::layout(). Also add widgets to their parent layout if the parent is a QLayout, and not a QWidget. This makes the items of the "Help" -> "License" dialog actually be part of the dialog in a WIP branch that has "QtInstanceBuilder::IsUIFileSupported" in the set of supported files in QtInstanceBuilder::IsUIFileSupported. [1] https://doc.qt.io/qt-6/qvboxlayout.html#QVBoxLayout-1 Change-Id: Ib823896a28520b6f7e1e89244239d3204d1d10e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174072 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28tdf#130857 qt weld: Ignore placeholdersMichael Weghorn
In QtBuilder, ignore placeholders as encountered e.g. in "sc/uiconfig/scalc/ui/checkwarningdialog.ui" (that's not yet in the list of supported .ui files for QtInstanceBuilder yet). VclBuilder mostly ignores them as well, see VclBuilder::makeObject. Change-Id: I68481e31365561719af5e72ee20adb428b642941 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174071 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28tdf#130857 qt weld: SAL_WARN and assert on unsupported widget typeMichael Weghorn
Change-Id: I45b0eac84a5820d0ef8a3bb36de35827f0ae1e33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174069 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28qt: No longer use SalFrame::maGeometry in QtFrame at allMichael Weghorn
With previous commit Change-Id: Icaf712c956297dbc7a774bbd995d42eb8a63a1bb Author: Michael Weghorn <m.weghorn@posteo.de> Date: Fri Sep 27 11:06:55 2024 +0200 qt: Query screen on demand in QtFrame in place, all relevant members are explicitly set for the returned SalFrameGeometry in QtFrame::GetUnmirroredGeometry, so there's no more reason to start with a copy of `maGeometry` instead of a default-constructed SalFrameGeometry. Margins for decorations are never set for the Qt-based VCL plugins (using methods like SalFrameGeometry::setLeftDecoration), so the default of 0 is fine for all of these. Change-Id: Ibed98c665e61a4ba06bf9087a159048417598798 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174035 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28qt: Query screen on demand in QtFrameMichael Weghorn
Similar to how Change-Id: Ifa0eff271c7d3fa2b6db9bdc1669e62333bd3094 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Thu Sep 26 18:22:12 2024 +0200 tdf#160837 qt: Rely on toolkit for frame positions, drop menubar hack implements it for the frame/widget position and size, also retrieve the current screen number by querying the QWidget for it's current screen instead of doing own bookkeeping of the current screen in SalFrame::maGeometry by getting/setting it using `SalFrameGeometry::{getS,s}creen. Only set it in the returend SalGeometry when the current SalGeometry explicitly gets requested by calling QtFrame::GetUnmirroredGeometry. Change-Id: Icaf712c956297dbc7a774bbd995d42eb8a63a1bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174034 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28qt: Just ignore request to set frame to invalid screen numberMichael Weghorn
Instead of setting the screen to the primary screen, just ignore the request when QtFrame::SetScreenNumber gets called with an invalid screen number. The previous handling was introduced in commit f806a2832aee62efc0e0404f7c24d53aaaf814d0 Date: Mon Oct 22 16:35:21 2018 +0200 tdf#120451: Use primary screen if requested screen doesn't exist to fix a crash, but just ignoring the request avoids crashing, too. (`git show --ignore-space-change` helps to see the "actual" change more easily.) Change-Id: I272ec64f89ef835161fa68c7fdc8cd0e407b7495 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174033 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28qt: Make screenNumber() a QtFrame methodMichael Weghorn
Don't explicitly pass a QScreen, but use the current one. Both callers set the screen just before calling the method. Change-Id: I57b3ffc4341cabc0370dda3c26d85f2f63ec9292 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174032 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28qt: Use QList::at instead of operator[]Michael Weghorn
Change-Id: I366ec4439d2647f433a9dc480c6efa6160a451a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174030 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28qt: Use QList::indexOf instead of reimplementing logicMichael Weghorn
Change-Id: If78bc419ccffd874e47419bc06ed2841ffbeab96 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174029 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28qt: Let GetQtInstance return ref instead of pointerMichael Weghorn
The return value was dereferenced in all callers anyway. Change-Id: Ib91eddd23222d086f9a4edac980a05cd96c75ad7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174026 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-28tdf#160837 qt: Rely on toolkit for frame positions, drop menubar hackMichael Weghorn
Make `SalFrame::GetUnmirroredGeometry` overridable (and let it return a copy of the SalFrameGeometry instead of a const reference) and document that subclasses can either make sure to keep the `SalFrame::maGeometry` member (which is returned by the default implementation of `SalFrame::GetUnmirroredGeometry`) up to date or override the latter in order to always return the current geometry. Override the method in `QtFrame` and fully rely on Qt to report and set the position of the frame, via the corresponding QWidget: Set the position, width and height in the returned `SalFrameGeometry` to the ones of the widget (factoring in the scale factor). Stop updating `maGeometry` size/position whenever the widget position or size changes, as that is no longer used anymore now that `GetUnmirroredGeometry` is overriden. This also allows to drop earlier hacks where position calculation in some places had to be adjusted by the height of the native menu bar, as that one doesn't have a corresponding vcl::Window, but results in everything else being shifted down a bit. Using Qt directly to set other members of the returned `SalFrameGeometry` (like the screen number) would probably be possible, but is not included in this change. (It can still be done separately later.) This makes Accerciser highlight the correct area when using the qt6 VCL plugin and using Writer with the standard interface (where the y position reported via AT-SPI2 would previously always be too small, missing the menu bar height) and thus e.g. also allows to make use of it's "select object under mouse" feature (s. tdf#160837). The position via AT-SPI is however currently only correct on X11/XWayland where global/screen coordinates are reported via AT-SPI2. Wayland, where window-relative coordinates are used, still suffers from another issue that will be addressed in a separate commit. The highlighting in Accerciser is also still wrong when a screen scaling factor other than 100% is set, but that's broken for other applications (e.g. gtk3-demo) just the same, so might be an issue in Accerciser instead. I successfully tested that these behave as expected when using the qt6 VCL plugin with this change in place: * Combobox popup positions, with either 100% screen scaling or a scaling factor of 150% or 200% on both, X11 and Wayland. * When enabling RTL mode via env var `SAL_RTL_ENABLED=1`, RTL layout is used and things look OK at a quick glance. * The following bugs (somewhat related to positioning and/or the now dropped menu bar hacks) are still fixed, i.e. don't reappear: * tdf#149805 "kf5: Gap when expanding comboboxes in toolbar" * tdf#151677 "tip on "formula bar" for "formula making" is displaying over the formula itself." * tdf#152217 "Black box in Basic IDE where the status bar should be (kf5 only)" * tdf#153458 "Connecting to database: wrong cursor position for dropping data to Calc sheet" * tdf#153800 "Calc sheet tab drag-and-drop target area has shifted vertically (kf5-only)" * tdf#154043 "Change object layer via drag and drop has target shifted down (KF5-only)" * tdf#154447 "Clicking a dropdown tool button shouldn't place the context menu on top of the button (kf5)" Unrelated to this commit, popup positioning and rendering in in a multi-screen setup on Wayland with different scaling factors set for the single screens is still broken (see tdf#141578). Change-Id: Ifa0eff271c7d3fa2b6db9bdc1669e62333bd3094 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173996 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-28tdf#160837 qt: QtFrame: Use getters instead of SalFrame::maGeometryMichael Weghorn
Replace some direct uses of SalFrame::maGeometry in QtFrame with corresponding getters: * SalFrame::GetUnmirroredGeometry() to get the SalFrameGeometry * the more specific SalFrame::GetWidth() and SalFrame::GetHeight() where only the width/ height is of interest No change in behavior intended yet. Change-Id: I1b4e13c5efef7b78f082f6444e1e8d0ee591db41 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173994 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-26tdf#160837 qt: Move logic for QPaintEvent handling to QtFrameMichael Weghorn
Add a new QtFrame::handlePaintEvent and move the logic from QtWidget::paintEvent to the new method and call the new method in QtWidget instead. This decouples QtFrame and (its friend class) QtWidget a bit more. Change-Id: I974a55d8f967dd85c3dd98e2ac8e28fa53c38c77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173953 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-26tdf#160837 qt: Move logic for resize event handling to QtFrameMichael Weghorn
Add a new QtFrame::handleResizeEvent and move the logic from QtWidget::resizeEvent to the new method and call the new method from QtWidget::resizeEvent. This decouples QtFrame and (its friend class) QtWidget a bit more, and also prevents direct access to the (currently public) SalFrame::maGeometry member from QtWidget. Change-Id: I8969687c64b87677836b436b7815298a8e8d5cf3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173952 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-26tdf#160837 qt: Move logic for move event handling to QtFrameMichael Weghorn
Add a new QtFrame::handleMoveEvent and move the logic previously duplicated in both, QtMainWindow::moveEvent and QtWidget::moveEvent there, then call the new method from these two. this also prevents direct access to the (currently public) SalFrame::maGeometry member from QtWidget and lets the subclass do it instead. Change-Id: I468802f204d3ac5869d833526286ca8ab349697b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173951 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-25tdf#130857 qt weld: Use native "Save Document?" dialogMichael Weghorn
Now that Change-Id: If6e03bfa48b9052016539a25aadf40b599095918 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Sep 25 12:10:12 2024 +0200 tdf#130857 qt weld: Implement QtBuilder::set_response implemented handling for button response codes, let QtInstanceBuilder create the "Save Document?" dialog that shows when closing LibreOffice while an unsaved modified document is open. This means that a native QMessageBox is now used for that dialog as well, unless env variable SAL_VCL_QT_NO_WELDED_WIDGETS is set. Change-Id: Ifb6c6f181d95d88138ed49f382b9eaad4d3ad944 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173932 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-25tdf#130857 qt weld: Implement QtBuilder::set_responseMichael Weghorn
Implement QtBuilder::set_response to set the given response code for a button: Set the `PROPERTY_VCL_RESPONSE_CODE` property on the QPushButton. `QtInstanceMessageDialog` makes use of that property to return the corresponding response code of the pressed button. (Make `PROPERTY_VCL_RESPONSE_CODE` a static member of `QtInstanceMessageDialog` to make it available outside of the class as well.) This works for buttons in message dialogs. An implementation for other dialogs still needs to be added when adding suppor for these to `QtBuilder` and extending `QtInstanceDialog`/`QtInstanceButton` accordingly. Change-Id: If6e03bfa48b9052016539a25aadf40b599095918 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173931 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-25tdf#130857 qt weld: Implement QtBuilder + use it for first msg dialogOmkarAcharekar
This implements an initial QtBuilder, which is used by QtInstanceBuilder to create weld::Widget instances using native Qt widgets. This tries to be close to the VCL implementation (VclBuilder). The selected approach is based on Caolán's suggestion in [1] to rework VclBuilder to have overridable methods for widgets creation. This way, we can have common code for the UI parser but the function for widget creation is different. Qt equivalents for Gtk's widget classes in the .ui files: * GtkMessageDialog -> QMessageBox * GtkBox -> QLayout (can be QVBoxLayout/QHBoxLayout based on property in .ui file) * GtkButtonBox -> QDialogButtonBox * GtkButton -> QPushButton As QMessageBox already comes with a layout and a QDialogButtonBox, don't create new ones, but return the existing ones in QtBuilder::makeObject. This commit implements initial support for the above-mentioned widget types and adds the first message dialog to the list of supported .ui files in QtInstanceBuilder::IsUIFileSupported, so a native QMessageBox is used for it now, unless environment variable SAL_VCL_QT_NO_WELDED_WIDGETS is set when starting LibreOffice. The dialog ("modules/swriter/ui/inforeadonlydialog.ui") gets shown when taking the following steps: * start Writer * type "hello world" * select text * "Insert" -> "Section" * tick the "Protect" checkbox in the "Write Protection" section * close dialog via "Insert" button * try to type in the protected section The dialog can be dismissed using the default "OK" button. (Handling for response codes for buttons is not implemented yet, which will be needed when welding dialogs that have multiple buttons resulting in different behavior depending on what button gets clicked.) This change was originally submitted as a WIP change as part of Omkar Acharekar's Outreachy project "Implement Qt/KDE Frameworks theming using native Qt widgets" (see [2]), then further refined by Michael Weghorn. [1] https://lists.freedesktop.org/archives/libreoffice/2023-December/091288.html [2] https://lists.freedesktop.org/archives/libreoffice/2023-December/091281.html Co-authored-by: Michael Weghorn <m.weghorn@posteo.de> Change-Id: I6dd010a2138c245dc1e6d83dd08123898e9d9048 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161831 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2024-09-21tdf#130857 qt weld: Drop accidently added empty filesMichael Weghorn
I accidently left them as empty files and committed them when extracting a separate commit commit 9b3a2996e710fee11145dcbbe38a6f1e6f646ec8 Author: OmkarAcharekar <omkaracharekar12@gmail.com> Date: Wed Sep 18 09:35:09 2024 +0200 tdf#130857 qt weld: Add QtInstanceBuilder skeleton based on a part of the pending WIP Gerrit change [1]. [1] https://gerrit.libreoffice.org/c/core/+/161831 Change-Id: Ic7e13e4a24ec064a658283ccd43d0e9f656a21fd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173708 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-09-19qt: Use more qobject_cast instead of dynamic_castMichael Weghorn
Change-Id: I236d016dd51f219b63a7d7fb6b0cb83a06b960c6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173661 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>