summaryrefslogtreecommitdiff
path: root/vcl/qt5
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-12-22 01:03:14 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2024-12-22 11:41:20 +0100
commita7428730f7088e3eb22e22a094754d2c9cae2276 (patch)
tree7b6b1c28113b78f1de4353ea3990bbfde00d502c /vcl/qt5
parentbb111c22a6093ec1f5edc5890d7ec6d238362c02 (diff)
tdf#130857 qt weld: Introduce QtInstancePopover
When encountering a "GtkPopover" object in a .ui file, create a QWidget with window flags Qt::Popup and set a layout, as weld::Popover is a weld::Container subclass. Add new QtInstancePopover that QtInstanceBuilder::weld_popover creates. For now, methods in that class simply trigger an assert; actual logic still needs to be implemented. Change-Id: I9a0dfefd9fb79d24fe40dd5efe13ef0c3ab9b7fb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179098 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/qt5')
-rw-r--r--vcl/qt5/QtBuilder.cxx6
-rw-r--r--vcl/qt5/QtInstanceBuilder.cxx9
-rw-r--r--vcl/qt5/QtInstancePopover.cxx27
3 files changed, 39 insertions, 3 deletions
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx
index 9e8985d04d60..253049625844 100644
--- a/vcl/qt5/QtBuilder.cxx
+++ b/vcl/qt5/QtBuilder.cxx
@@ -298,6 +298,12 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, std:
{
pObject = new QSplitter(pParentWidget);
}
+ else if (sName == u"GtkPopover")
+ {
+ QWidget* pWidget = new QWidget(pParentWidget, Qt::Popup);
+ pWidget->setLayout(new QVBoxLayout);
+ pObject = pWidget;
+ }
else if (sName == u"GtkRadioButton")
{
pObject = new QRadioButton(pParentWidget);
diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx
index fffe30e94d04..3294a7ec141f 100644
--- a/vcl/qt5/QtInstanceBuilder.cxx
+++ b/vcl/qt5/QtInstanceBuilder.cxx
@@ -28,6 +28,7 @@
#include <QtInstanceMenuButton.hxx>
#include <QtInstanceMessageDialog.hxx>
#include <QtInstanceNotebook.hxx>
+#include <QtInstancePopover.hxx>
#include <QtInstanceProgressBar.hxx>
#include <QtInstanceRadioButton.hxx>
#include <QtInstanceScale.hxx>
@@ -395,10 +396,12 @@ std::unique_ptr<weld::Menu> QtInstanceBuilder::weld_menu(const OUString& rId)
return xRet;
}
-std::unique_ptr<weld::Popover> QtInstanceBuilder::weld_popover(const OUString&)
+std::unique_ptr<weld::Popover> QtInstanceBuilder::weld_popover(const OUString& rId)
{
- assert(false && "Not implemented yet");
- return nullptr;
+ QWidget* pWidget = m_xBuilder->get<QWidget>(rId);
+ std::unique_ptr<weld::Popover> xRet(pWidget ? std::make_unique<QtInstancePopover>(pWidget)
+ : nullptr);
+ return xRet;
}
std::unique_ptr<weld::Toolbar> QtInstanceBuilder::weld_toolbar(const OUString&)
diff --git a/vcl/qt5/QtInstancePopover.cxx b/vcl/qt5/QtInstancePopover.cxx
new file mode 100644
index 000000000000..e35665e8289c
--- /dev/null
+++ b/vcl/qt5/QtInstancePopover.cxx
@@ -0,0 +1,27 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <QtInstancePopover.hxx>
+#include <QtInstancePopover.moc>
+
+QtInstancePopover::QtInstancePopover(QWidget* pWidget)
+ : QtInstanceContainer(pWidget)
+{
+}
+
+void QtInstancePopover::popup_at_rect(weld::Widget*, const tools::Rectangle&, weld::Placement)
+{
+ assert(false && "Not implemented yet");
+}
+
+void QtInstancePopover::popdown() { assert(false && "Not implemented yet"); }
+
+void QtInstancePopover::resize_to_request() { assert(false && "Not implemented yet"); }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */