summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/qt5/QtInstanceMenuButton.hxx2
-rw-r--r--vcl/qt5/QtInstanceMenuButton.cxx23
2 files changed, 21 insertions, 4 deletions
diff --git a/vcl/inc/qt5/QtInstanceMenuButton.hxx b/vcl/inc/qt5/QtInstanceMenuButton.hxx
index 1388bf29f688..398488076d30 100644
--- a/vcl/inc/qt5/QtInstanceMenuButton.hxx
+++ b/vcl/inc/qt5/QtInstanceMenuButton.hxx
@@ -22,7 +22,7 @@ class QtInstanceMenuButton : public QtInstanceToggleButton, public virtual weld:
public:
QtInstanceMenuButton(QToolButton* pButton);
- virtual void insert_item(int pos, const OUString& rId, const OUString& rStr,
+ virtual void insert_item(int nPos, const OUString& rId, const OUString& rStr,
const OUString* pIconName, VirtualDevice* pImageSurface,
TriState eCheckRadioFalse) override;
diff --git a/vcl/qt5/QtInstanceMenuButton.cxx b/vcl/qt5/QtInstanceMenuButton.cxx
index 8223e65b80ca..45191ef937f9 100644
--- a/vcl/qt5/QtInstanceMenuButton.cxx
+++ b/vcl/qt5/QtInstanceMenuButton.cxx
@@ -23,10 +23,27 @@ QtInstanceMenuButton::QtInstanceMenuButton(QToolButton* pButton)
assert(m_pToolButton);
}
-void QtInstanceMenuButton::insert_item(int, const OUString&, const OUString&, const OUString*,
- VirtualDevice*, TriState)
+void QtInstanceMenuButton::insert_item(int nPos, const OUString& rId, const OUString& rStr,
+ const OUString* pIconName, VirtualDevice* pImageSurface,
+ TriState eCheckRadioFalse)
{
- assert(false && "Not implemented yet");
+ SolarMutexGuard g;
+
+ assert(eCheckRadioFalse == TRISTATE_INDET && "Param not handled yet");
+ (void)eCheckRadioFalse;
+
+ GetQtInstance().RunInMainThread([&] {
+ if (nPos == -1)
+ nPos = getMenu().actions().count();
+
+ QAction* pAction = getMenu().addAction(vclToQtStringWithAccelerator(rStr));
+ pAction->setObjectName(toQString(rId));
+
+ if (pIconName)
+ pAction->setIcon(loadQPixmapIcon(*pIconName));
+ else if (pImageSurface)
+ pAction->setIcon(toQPixmap(*pImageSurface));
+ });
}
void QtInstanceMenuButton::insert_separator(int, const OUString&)