diff options
Diffstat (limited to 'vcl/qt5')
-rw-r--r-- | vcl/qt5/QtBuilder.cxx | 14 | ||||
-rw-r--r-- | vcl/qt5/QtInstanceCheckButton.cxx | 2 | ||||
-rw-r--r-- | vcl/qt5/QtInstanceDialog.cxx | 19 | ||||
-rw-r--r-- | vcl/qt5/QtInstanceNotebook.cxx | 3 |
4 files changed, 32 insertions, 6 deletions
diff --git a/vcl/qt5/QtBuilder.cxx b/vcl/qt5/QtBuilder.cxx index 044e3ea9d421..d73800d02d0d 100644 --- a/vcl/qt5/QtBuilder.cxx +++ b/vcl/qt5/QtBuilder.cxx @@ -348,7 +348,7 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std // an editable GtkComboBox has an internal GtkEntry child, // but QComboBox doesn't need a separate widget for it, so // delete it - pCurrentChild->deleteLater(); + deleteObject(pCurrentChild); } if (sType == "label") @@ -362,8 +362,7 @@ void QtBuilder::tweakInsertedChild(QObject* pParent, QObject* pCurrentChild, std // For QGroupBox, the title can be set directly. Therefore, take over the // title from the label and delete the separate label widget again pGroupBox->setTitle(pLabel->text()); - pLabel->setParent(nullptr); - pLabel->deleteLater(); + deleteObject(pLabel); } } } @@ -526,6 +525,13 @@ void QtBuilder::set_response(std::u16string_view sID, short nResponse) pPushButton->setProperty(QtInstanceMessageDialog::PROPERTY_VCL_RESPONSE_CODE, int(nResponse)); } +void QtBuilder::deleteObject(QObject* pObject) +{ + if (pObject->isWidgetType()) + static_cast<QWidget*>(pObject)->hide(); + pObject->deleteLater(); +} + void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) { if (QMessageBox* pMessageBox = qobject_cast<QMessageBox*>(pObject)) @@ -604,7 +610,7 @@ void QtBuilder::setProperties(QObject* pObject, stringmap& rProps) // parentless GtkImage in .ui file is only used for setting button // image, so the object is no longer needed after doing so if (!pImageLabel->parent()) - pImageLabel->deleteLater(); + deleteObject(pImageLabel); } else if (rKey == u"label") { diff --git a/vcl/qt5/QtInstanceCheckButton.cxx b/vcl/qt5/QtInstanceCheckButton.cxx index f4590d393444..835dcd356196 100644 --- a/vcl/qt5/QtInstanceCheckButton.cxx +++ b/vcl/qt5/QtInstanceCheckButton.cxx @@ -8,6 +8,7 @@ */ #include <QtInstanceCheckButton.hxx> +#include <QtInstanceCheckButton.moc> #include <vcl/qt/QtUtils.hxx> @@ -16,6 +17,7 @@ QtInstanceCheckButton::QtInstanceCheckButton(QCheckBox* pCheckBox) , m_pCheckBox(pCheckBox) { assert(m_pCheckBox); + connect(m_pCheckBox, &QCheckBox::toggled, this, [&] { signal_toggled(); }); } void QtInstanceCheckButton::set_active(bool bActive) diff --git a/vcl/qt5/QtInstanceDialog.cxx b/vcl/qt5/QtInstanceDialog.cxx index 7a4ca77ad70f..c1be1db313c0 100644 --- a/vcl/qt5/QtInstanceDialog.cxx +++ b/vcl/qt5/QtInstanceDialog.cxx @@ -19,6 +19,7 @@ const char* const QtInstanceDialog::PROPERTY_VCL_RESPONSE_CODE = "response-code" QtInstanceDialog::QtInstanceDialog(QDialog* pDialog) : QtInstanceWindow(pDialog) , m_pDialog(pDialog) + , m_pContentArea(nullptr) , m_aRunAsyncFunc(nullptr) { } @@ -148,8 +149,22 @@ void QtInstanceDialog::set_default_response(int) { assert(false && "Not implemen std::unique_ptr<weld::Container> QtInstanceDialog::weld_content_area() { - assert(false && "Not implemented yet"); - return nullptr; + if (!m_pContentArea) + { + if (QBoxLayout* pBoxLayout = qobject_cast<QBoxLayout*>(m_pDialog->layout())) + { + // insert an extra widget and layout at beginning of the dialog's layout + m_pContentArea = new QWidget; + m_pContentArea->setLayout(new QVBoxLayout); + pBoxLayout->insertWidget(0, m_pContentArea); + } + else + { + assert(false && "Dialog has layout that's not supported (yet)"); + } + } + + return std::make_unique<QtInstanceContainer>(m_pContentArea); } void QtInstanceDialog::dialogFinished(int nResult) diff --git a/vcl/qt5/QtInstanceNotebook.cxx b/vcl/qt5/QtInstanceNotebook.cxx index 6c28ce5c87e4..c8da18d5f5d6 100644 --- a/vcl/qt5/QtInstanceNotebook.cxx +++ b/vcl/qt5/QtInstanceNotebook.cxx @@ -155,6 +155,9 @@ weld::Container* QtInstanceNotebook::get_page(const OUString& rIdent) const pWidget = m_pTabWidget->widget(nIndex); }); + if (!pWidget) + return nullptr; + if (!m_aPageContainerInstances.contains(pWidget)) m_aPageContainerInstances.emplace(pWidget, std::make_unique<QtInstanceContainer>(pWidget)); |