vcl/Library_vclplug_qt5.mk       |    1 
 vcl/Library_vclplug_qt6.mk       |    1 
 vcl/inc/qt5/QtInstanceButton.hxx |   32 ++++++++++++++++++++++
 vcl/inc/qt6/QtInstanceButton.hxx |   12 ++++++++
 vcl/qt5/QtInstanceButton.cxx     |   56 +++++++++++++++++++++++++++++++++++++++
 vcl/qt6/QtInstanceButton.cxx     |   12 ++++++++
 6 files changed, 114 insertions(+)
New commits:
commit f0ad3a95c1e841281048a784bd96e8d34e090c5b
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 6 14:58:12 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 7 07:08:35 2024 +0200

    tdf#162351 tdf#130857 qt weld: Add basic QtInstanceButton
    
    Add a very basic native Qt implementation for `weld::Button`.
    It currently doesn't really implement many methods and
    just triggers an assert when they get called.
    
    Change-Id: I7a15266e978ca3bb030c847822a82d8d58c4c189
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171549
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 14782ca89dc3..bcd384bac1d6 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -93,6 +93,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
     vcl/qt5/QtGraphics_Text \
     vcl/qt5/QtInstance \
     vcl/qt5/QtInstance_Print \
+    vcl/qt5/QtInstanceButton \
     vcl/qt5/QtInstanceContainer \
     vcl/qt5/QtInstanceDialog \
     vcl/qt5/QtInstanceMessageDialog \
diff --git a/vcl/Library_vclplug_qt6.mk b/vcl/Library_vclplug_qt6.mk
index bf5c05eac189..8bc7001ad5ac 100644
--- a/vcl/Library_vclplug_qt6.mk
+++ b/vcl/Library_vclplug_qt6.mk
@@ -92,6 +92,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
     vcl/qt6/QtGraphics_Text \
     vcl/qt6/QtInstance \
     vcl/qt6/QtInstance_Print \
+    vcl/qt6/QtInstanceButton \
     vcl/qt6/QtInstanceContainer \
     vcl/qt6/QtInstanceDialog \
     vcl/qt6/QtInstanceMessageDialog \
diff --git a/vcl/inc/qt5/QtInstanceButton.hxx b/vcl/inc/qt5/QtInstanceButton.hxx
new file mode 100644
index 000000000000..cd55ddd470be
--- /dev/null
+++ b/vcl/inc/qt5/QtInstanceButton.hxx
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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/.
+ */
+
+#pragma once
+
+#include "QtInstanceWidget.hxx"
+
+#include <QtWidgets/QPushButton>
+
+class QtInstanceButton : public QtInstanceWidget, public virtual weld::Button
+{
+    QPushButton* m_pButton;
+
+public:
+    QtInstanceButton(QPushButton* pButton);
+
+    virtual void set_label(const OUString& rText) override;
+    virtual void set_image(VirtualDevice* pDevice) override;
+    virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& 
rImage) override;
+    virtual void set_from_icon_name(const OUString& rIconName) override;
+    virtual OUString get_label() const override;
+    virtual void set_font(const vcl::Font& rFont) override;
+    virtual void set_custom_button(VirtualDevice* pDevice) override;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt6/QtInstanceButton.hxx b/vcl/inc/qt6/QtInstanceButton.hxx
new file mode 100644
index 000000000000..d20c299f1157
--- /dev/null
+++ b/vcl/inc/qt6/QtInstanceButton.hxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 "../qt5/QtInstanceButton.hxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtInstanceButton.cxx b/vcl/qt5/QtInstanceButton.cxx
new file mode 100644
index 000000000000..841e4906c34f
--- /dev/null
+++ b/vcl/qt5/QtInstanceButton.cxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 <QtInstanceButton.hxx>
+
+QtInstanceButton::QtInstanceButton(QPushButton* pButton)
+    : QtInstanceWidget(pButton)
+    , m_pButton(pButton)
+{
+    assert(m_pButton);
+}
+
+void QtInstanceButton::set_label(const OUString& rText)
+{
+    assert(m_pButton);
+    m_pButton->setText(toQString(rText));
+}
+
+void QtInstanceButton::set_image(VirtualDevice* /*pDevice*/)
+{
+    assert(false && "Not implemented yet");
+}
+
+void QtInstanceButton::set_image(const 
css::uno::Reference<css::graphic::XGraphic>& /*rImage*/)
+{
+    assert(false && "Not implemented yet");
+}
+
+void QtInstanceButton::set_from_icon_name(const OUString& /*rIconName*/)
+{
+    assert(false && "Not implemented yet");
+}
+
+OUString QtInstanceButton::get_label() const
+{
+    assert(m_pButton);
+    return toOUString(m_pButton->text());
+}
+
+void QtInstanceButton::set_font(const vcl::Font& /*rFont*/)
+{
+    assert(false && "Not implemented yet");
+}
+
+void QtInstanceButton::set_custom_button(VirtualDevice* /*pDevice*/)
+{
+    assert(false && "Not implemented yet");
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt6/QtInstanceButton.cxx b/vcl/qt6/QtInstanceButton.cxx
new file mode 100644
index 000000000000..a51e0ff58196
--- /dev/null
+++ b/vcl/qt6/QtInstanceButton.cxx
@@ -0,0 +1,12 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * 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 "../qt5/QtInstanceButton.cxx"
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to