office-gobmx/vcl/qt6
OmkarAcharekar 7282421451 tdf#130857 qt weld: Implement QtBuilder + use it for first msg dialog
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-25 21:09:26 +02:00
..
QtAccessibleEventListener.cxx
QtAccessibleRegistry.cxx
QtAccessibleWidget.cxx
QtBitmap.cxx
QtBuilder.cxx
QtClipboard.cxx
QtData.cxx
QtDragAndDrop.cxx
QtFilePicker.cxx
QtFont.cxx
QtFontFace.cxx
QtFrame.cxx
QtGraphics.cxx
QtGraphics_Controls.cxx
QtGraphics_GDI.cxx
QtGraphics_Text.cxx
QtGraphicsBase.cxx
QtInstance.cxx
QtInstance_Print.cxx
QtInstanceBuilder.cxx
QtInstanceButton.cxx
QtInstanceContainer.cxx
QtInstanceDialog.cxx
QtInstanceMessageDialog.cxx
QtInstanceWidget.cxx
QtInstanceWindow.cxx
QtMainWindow.cxx
QtMenu.cxx
QtObject.cxx
QtOpenGLContext.cxx
QtPainter.cxx
QtPrinter.cxx
QtSvpGraphics.cxx
QtSvpSurface.cxx
QtSvpVirtualDevice.hxx
QtSystem.cxx
QtTimer.cxx
QtTools.cxx
QtTransferable.cxx
QtVirtualDevice.cxx
QtWidget.cxx
QtX11Support.cxx
QtXAccessible.cxx