From 29c6285d9d3d24c9672e523cb95cc9488636b16d Mon Sep 17 00:00:00 2001 From: Tobias Koenig Date: Wed, 28 Nov 2012 11:43:50 +0100 Subject: [PATCH] Fix handling of placeholder actions with toolbars/toolbuttons --- lib/objectadaptors.cpp | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/objectadaptors.cpp b/lib/objectadaptors.cpp index b7f10f3..04e5494 100644 --- a/lib/objectadaptors.cpp +++ b/lib/objectadaptors.cpp @@ -59,15 +59,13 @@ void ActionItem::setAction(const QVariant &action) // Check if the placeholder must be replaced with the actual action if (m_qAction == m_placeholderAction) { const QList widgets = m_placeholderAction->associatedWidgets(); - if (!widgets.isEmpty()) { - Q_ASSERT(widgets.count() == 1); // The placeholder action can only be plugged into one widget - + foreach (QWidget *widget, widgets) { // Replace the placeholder action with the new one - widgets.first()->insertAction(m_placeholderAction, newAction); - widgets.first()->removeAction(m_placeholderAction); - - m_qAction = newAction; + widget->insertAction(m_placeholderAction, newAction); + widget->removeAction(m_placeholderAction); } + + m_qAction = newAction; } emit actionChanged(); -- 1.7.2.5