summaryrefslogtreecommitdiff
path: root/vcl/qt5/QtInstanceBuilder.cxx
AgeCommit message (Collapse)Author
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 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: 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-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 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-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: 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-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 + 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-19Fix typoAndrea Gelmini
Change-Id: I291dcc19e429493289cd2be8367a0d1e0c6d2296 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173646 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-09-18tdf#130857 qt weld: Add QtInstanceBuilder skeletonOmkarAcharekar
Add new `QtInstanceBuilder` that derives from `weld::Builder` and is meant to use `weld::Widget` implementations using native Qt widgets. Override `SalInstance::CreateBuilder` in `QtInstance` to return an instance of the new `QtInstanceBuilder` for UI files that that one can handle/supports. As of now, `QtInstanceBuilder` doesn't yet implement what's needed, so `QtInstanceBuilder::IsUIFileSupported` currently still always returns `false`, meaning that `SalInstanceBuilder` is still always used in practice. The idea is to implement funcationality needed for a specific UI file/dialog in `QtInstanceBuilder`, then add it to the set of supported UI files in `QtInstanceBuilder::IsUIFileSupported`. This allows looking at one .ui file at a time and only having to implement what is relevant for that particular one, without having to implement the full weld API at once. The use of `QtInstanceBuilder` can completely be disabled by starting LO with environment variable `SAL_VCL_QT_NO_WELDED_WIDGETS` set. This commit is mostly extraced from Omkar Acharekar's WIP Gerrit change [1] (patch set 22) with some further adjustments by Michael Weghorn. Patch set 23 of that WIP Gerrit change demonstrates adding support for a dialog (the "Save Document?" one), but still needs more work. [1] https://gerrit.libreoffice.org/c/core/+/161831 Co-authored-by: Michael Weghorn <m.weghorn@posteo.de> Change-Id: If2d1ea30d43c2c1d84d64e577035489c8e158a7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173592 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>