diff options
Diffstat (limited to 'src/designer/src/lib/shared/actioneditor.cpp')
-rw-r--r-- | src/designer/src/lib/shared/actioneditor.cpp | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index 86cbb4959..2aeea2a74 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -325,7 +325,7 @@ void ActionEditor::setFormWindow(QDesignerFormWindowInterface *formWindow) void ActionEditor::slotSelectionChanged(const QItemSelection& selected, const QItemSelection& /*deselected*/) { - const bool hasSelection = !selected.indexes().empty(); + const bool hasSelection = !selected.indexes().isEmpty(); #if QT_CONFIG(clipboard) m_actionCopy->setEnabled(hasSelection); m_actionCut->setEnabled(hasSelection); @@ -349,7 +349,7 @@ void ActionEditor::slotCurrentItemChanged(QAction *action) QDesignerObjectInspector *oi = qobject_cast<QDesignerObjectInspector *>(core()->objectInspector()); - if (action->associatedWidgets().empty()) { + if (action->associatedWidgets().isEmpty()) { // Special case: action not in object tree. Deselect all and set in property editor fw->clearSelection(false); if (oi) @@ -528,7 +528,7 @@ static inline QString textPropertyValue(const QDesignerPropertySheetExtension *s return ps.value(); } -void ActionEditor::editAction(QAction *action) +void ActionEditor::editAction(QAction *action, int column) { if (!action) return; @@ -546,6 +546,24 @@ void ActionEditor::editAction(QAction *action) oldActionData.checkable = action->isCheckable(); dlg.setActionData(oldActionData); + switch (column) { + case qdesigner_internal::ActionModel::NameColumn: + dlg.focusName(); + break; + case qdesigner_internal::ActionModel::TextColumn: + dlg.focusText(); + break; + case qdesigner_internal::ActionModel::ShortCutColumn: + dlg.focusShortcut(); + break; + case qdesigner_internal::ActionModel::CheckedColumn: + dlg.focusCheckable(); + break; + case qdesigner_internal::ActionModel::ToolTipColumn: + dlg.focusTooltip(); + break; + } + if (!dlg.exec()) return; @@ -602,8 +620,9 @@ void ActionEditor::deleteActions(QDesignerFormWindowInterface *fw, const ActionL { // We need a macro even in the case of single action because the commands might cause the // scheduling of other commands (signal slots connections) - const QString description = actions.size() == 1 ? - tr("Remove action '%1'").arg(actions.front()->objectName()) : tr("Remove actions"); + const QString description = actions.size() == 1 + ? tr("Remove action '%1'").arg(actions.constFirst()->objectName()) + : tr("Remove actions"); fw->beginCommand(description); for (QAction *action : actions) { RemoveActionCommand *cmd = new RemoveActionCommand(fw); @@ -644,7 +663,7 @@ void ActionEditor::slotDelete() return; const ActionView::ActionList selection = m_actionView->selectedActions(); - if (selection.empty()) + if (selection.isEmpty()) return; deleteActions(fw, selection); @@ -784,7 +803,7 @@ void ActionEditor::slotCopy() return; const ActionView::ActionList selection = m_actionView->selectedActions(); - if (selection.empty()) + if (selection.isEmpty()) return; copyActions(fw, selection); @@ -797,7 +816,7 @@ void ActionEditor::slotCut() return; const ActionView::ActionList selection = m_actionView->selectedActions(); - if (selection.empty()) + if (selection.isEmpty()) return; copyActions(fw, selection); @@ -826,7 +845,7 @@ void ActionEditor::slotContextMenuRequested(QContextMenuEvent *e, QAction *item) // Associated Widgets if (QAction *action = m_actionView->currentAction()) { const QWidgetList associatedWidgets = ActionModel::associatedWidgets(action); - if (!associatedWidgets.empty()) { + if (!associatedWidgets.isEmpty()) { QMenu *associatedWidgetsSubMenu = menu.addMenu(tr("Used In")); for (QWidget *w : associatedWidgets) { associatedWidgetsSubMenu->addAction(w->objectName(), |