void ToolBarEventFilter::slotRemoveSelectedAction() { QAction *action = qobject_cast<QAction*>(sender()); if (!action) return; QAction *a = qvariant_cast<QAction*>(action->data()); Q_ASSERT(a != 0); QDesignerFormWindowInterface *fw = formWindow(); Q_ASSERT(fw); const ActionList actions = m_toolBar->actions(); const int pos = actions.indexOf(a); QAction *action_before = 0; if (pos != -1 && actions.count() > pos + 1) action_before = actions.at(pos + 1); RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw); cmd->init(m_toolBar, a, action_before); fw->commandHistory()->push(cmd); }