diff options
-rw-r--r-- | vcl/inc/qt5/QtInstanceBuilder.hxx | 2 | ||||
-rw-r--r-- | vcl/qt5/QtBuilder.cxx | 19 | ||||
-rw-r--r-- | vcl/qt5/QtInstanceBuilder.cxx | 8 |
3 files changed, 25 insertions, 4 deletions
diff --git a/vcl/inc/qt5/QtInstanceBuilder.hxx b/vcl/inc/qt5/QtInstanceBuilder.hxx index 3c9fec8b1189..d98c85c1dee4 100644 --- a/vcl/inc/qt5/QtInstanceBuilder.hxx +++ b/vcl/inc/qt5/QtInstanceBuilder.hxx @@ -30,7 +30,7 @@ public: static bool IsUIFileSupported(const OUString& rUIFile); virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OUString& id) override; - virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString&) override; + virtual std::unique_ptr<weld::Dialog> weld_dialog(const OUString& rId) override; virtual std::unique_ptr<weld::Assistant> weld_assistant(const OUString&) override; virtual std::unique_ptr<weld::Window> create_screenshot_window() override; virtual std::unique_ptr<weld::Widget> weld_widget(const OUString&) override; diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 36eaa3f6e96e..095b3b9c0b20 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -16,6 +16,7 @@ #include <QtWidgets/QDialog> #include <QtWidgets/QDialogButtonBox> +#include <QtWidgets/QLabel> #include <QtWidgets/QLayout> #include <QtWidgets/QPushButton> @@ -133,6 +134,14 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, cons pObject = new QPushButton(pParentWidget); } } + else if (sName == u"GtkDialog") + { + pObject = new QDialog(pParentWidget); + } + else if (sName == u"GtkLabel") + { + pObject = new QLabel(pParentWidget); + } else { SAL_WARN("vcl.qt", "Widget type not supported yet: " @@ -212,6 +221,16 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) } } } + else if (QLabel* pLabel = qobject_cast<QLabel*>(pObject)) + { + for (auto const & [ rKey, rValue ] : rProps) + { + if (rKey == u"label") + pLabel->setText(toQString(rValue)); + else if (rKey == u"wrap") + pLabel->setWordWrap(toBool(rValue)); + } + } else if (QPushButton* pButton = qobject_cast<QPushButton*>(pObject)) { for (auto const & [ rKey, rValue ] : rProps) diff --git a/vcl/qt5/QtInstanceBuilder.cxx b/vcl/qt5/QtInstanceBuilder.cxx index 611d5899063b..ee40033cfa86 100644 --- a/vcl/qt5/QtInstanceBuilder.cxx +++ b/vcl/qt5/QtInstanceBuilder.cxx @@ -47,10 +47,12 @@ std::unique_ptr<weld::MessageDialog> QtInstanceBuilder::weld_message_dialog(cons return xRet; } -std::unique_ptr<weld::Dialog> QtInstanceBuilder::weld_dialog(const OUString&) +std::unique_ptr<weld::Dialog> QtInstanceBuilder::weld_dialog(const OUString& rId) { - assert(false && "Not implemented yet"); - return nullptr; + QDialog* pDialog = m_xBuilder->get<QDialog>(rId); + std::unique_ptr<weld::Dialog> xRet(pDialog ? std::make_unique<QtInstanceDialog>(pDialog) + : nullptr); + return xRet; } std::unique_ptr<weld::Assistant> QtInstanceBuilder::weld_assistant(const OUString&) |