summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-10-24 00:03:33 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-10-24 09:10:07 +0200
commite1fa5664c99150a7ca59cf18e839b94871744b71 (patch)
tree2ea23b1b9de55d3ac9bf311aba7e8c20a247c086
parent2386540edfb015632ad5771ed048aa4bead315f8 (diff)
tdf#130857 qt weld: Implement QtInstanceButton::set_from_icon_name
Make use of the `loadQPixmapIcon` helper function introduced in previous commit Change-Id: I9f25aa5ca8f00da97d06ecdd164a8fae10e492dd Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Oct 23 23:21:23 2024 +0200 tdf#130857 qt: Move pixmap helper to new include/vcl/qt/QtUtils.hxx With this commit, the native Qt version of Calc's "Tool" -> "Goal Seek" dialog looks OK at first glance (buttons have the icons set) in a WIP branch that adds that dialog's .ui file ("modules/scalc/ui/goalseekdlg.ui") to the list of supported files in QtInstanceBuilder::IsUIFileSupported. (But clicking a button doesn't yet behave the same way as in the non-welded/VCL version, so more work is needed before that can actually be enabled.) Change-Id: Icc83e874a76b7ccd600bd6741a9e02958759f4d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175525 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
-rw-r--r--vcl/qt5/QtInstanceButton.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/vcl/qt5/QtInstanceButton.cxx b/vcl/qt5/QtInstanceButton.cxx
index 1d68f9bcdb0e..d2da6d310239 100644
--- a/vcl/qt5/QtInstanceButton.cxx
+++ b/vcl/qt5/QtInstanceButton.cxx
@@ -9,6 +9,8 @@
#include <QtInstanceButton.hxx>
+#include <vcl/qt/QtUtils.hxx>
+
QtInstanceButton::QtInstanceButton(QPushButton* pButton)
: QtInstanceWidget(pButton)
, m_pButton(pButton)
@@ -42,9 +44,13 @@ void QtInstanceButton::set_image(const css::uno::Reference<css::graphic::XGraphi
assert(false && "Not implemented yet");
}
-void QtInstanceButton::set_from_icon_name(const OUString& /*rIconName*/)
+void QtInstanceButton::set_from_icon_name(const OUString& rIconName)
{
- assert(false && "Not implemented yet");
+ SolarMutexGuard g;
+ GetQtInstance().RunInMainThread([&] {
+ QPixmap aIcon = loadQPixmapIcon(rIconName);
+ m_pButton->setIcon(aIcon);
+ });
}
OUString QtInstanceButton::get_label() const