diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/designer/src/lib/shared/actioneditor.cpp | 20 | ||||
-rw-r--r-- | src/designer/src/lib/shared/actioneditor_p.h | 4 | ||||
-rw-r--r-- | src/designer/src/lib/shared/actionrepository.cpp | 5 | ||||
-rw-r--r-- | src/designer/src/lib/shared/actionrepository_p.h | 4 | ||||
-rw-r--r-- | src/designer/src/lib/shared/newactiondialog.cpp | 27 | ||||
-rw-r--r-- | src/designer/src/lib/shared/newactiondialog_p.h | 7 |
6 files changed, 59 insertions, 8 deletions
diff --git a/src/designer/src/lib/shared/actioneditor.cpp b/src/designer/src/lib/shared/actioneditor.cpp index 86cbb4959..d41a28f94 100644 --- a/src/designer/src/lib/shared/actioneditor.cpp +++ b/src/designer/src/lib/shared/actioneditor.cpp @@ -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; diff --git a/src/designer/src/lib/shared/actioneditor_p.h b/src/designer/src/lib/shared/actioneditor_p.h index 321dbfb32..2f78887ba 100644 --- a/src/designer/src/lib/shared/actioneditor_p.h +++ b/src/designer/src/lib/shared/actioneditor_p.h @@ -100,7 +100,7 @@ public slots: private slots: void slotCurrentItemChanged(QAction *item); void slotSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); - void editAction(QAction *item); + void editAction(QAction *item, int column = -1); void editCurrentAction(); void navigateToSlotCurrentAction(); void slotActionChanged(); @@ -117,7 +117,7 @@ private slots: #endif signals: - void itemActivated(QAction *item); + void itemActivated(QAction *item, int column); // Context menu for item or global menu if item == 0. void contextMenuRequested(QMenu *menu, QAction *item); diff --git a/src/designer/src/lib/shared/actionrepository.cpp b/src/designer/src/lib/shared/actionrepository.cpp index 2d91a5f00..de1d1dc3a 100644 --- a/src/designer/src/lib/shared/actionrepository.cpp +++ b/src/designer/src/lib/shared/actionrepository.cpp @@ -392,7 +392,7 @@ void ActionTreeView::currentChanged(const QModelIndex ¤t, const QModelInde void ActionTreeView::slotActivated(const QModelIndex &index) { - emit actionActivated(m_model->actionAt(index)); + emit actionActivated(m_model->actionAt(index), index.column()); } void ActionTreeView::startDrag(Qt::DropActions supportedActions) @@ -499,7 +499,8 @@ ActionView::ActionView(QWidget *parent) : // make it possible for vs integration to reimplement edit action dialog // [which it shouldn't do actually] - connect(m_actionListView, &ActionListView::actionActivated, this, &ActionView::activated); + connect(m_actionListView, &ActionListView::actionActivated, + this, [this](QAction *a) { this->activated(a, -1); }); connect(m_actionTreeView, &ActionTreeView::actionActivated, this, &ActionView::activated); connect(m_actionListView, &ActionListView::currentActionChanged, diff --git a/src/designer/src/lib/shared/actionrepository_p.h b/src/designer/src/lib/shared/actionrepository_p.h index a68b3371f..333093a09 100644 --- a/src/designer/src/lib/shared/actionrepository_p.h +++ b/src/designer/src/lib/shared/actionrepository_p.h @@ -124,7 +124,7 @@ public slots: signals: void actionContextMenuRequested(QContextMenuEvent *event, QAction *); void currentActionChanged(QAction *action); - void actionActivated(QAction *action); + void actionActivated(QAction *action, int column); protected slots: void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override; @@ -215,7 +215,7 @@ public slots: signals: void contextMenuRequested(QContextMenuEvent *event, QAction *); void currentChanged(QAction *action); - void activated(QAction *action); + void activated(QAction *action, int column); void selectionChanged(const QItemSelection& selected, const QItemSelection& deselected); void resourceImageDropped(const QString &data, QAction *action); diff --git a/src/designer/src/lib/shared/newactiondialog.cpp b/src/designer/src/lib/shared/newactiondialog.cpp index 676d4a80a..d5380bfcb 100644 --- a/src/designer/src/lib/shared/newactiondialog.cpp +++ b/src/designer/src/lib/shared/newactiondialog.cpp @@ -78,7 +78,7 @@ NewActionDialog::NewActionDialog(ActionEditor *parent) : this, &NewActionDialog::slotResetKeySequence); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - m_ui->editActionText->setFocus(); + focusText(); updateButtons(); QDesignerFormWindowInterface *form = parent->formWindow(); @@ -96,6 +96,31 @@ NewActionDialog::~NewActionDialog() delete m_ui; } +void NewActionDialog::focusName() +{ + m_ui->editObjectName->setFocus(); +} + +void NewActionDialog::focusText() +{ + m_ui->editActionText->setFocus(); +} + +void NewActionDialog::focusTooltip() +{ + m_ui->tooltipEditor->setFocus(); +} + +void NewActionDialog::focusShortcut() +{ + m_ui->keySequenceEdit->setFocus(); +} + +void NewActionDialog::focusCheckable() +{ + m_ui->checkableCheckBox->setFocus(); +} + QString NewActionDialog::actionText() const { return m_ui->editActionText->text(); diff --git a/src/designer/src/lib/shared/newactiondialog_p.h b/src/designer/src/lib/shared/newactiondialog_p.h index 8eddcbe72..f6e3b1dd7 100644 --- a/src/designer/src/lib/shared/newactiondialog_p.h +++ b/src/designer/src/lib/shared/newactiondialog_p.h @@ -89,6 +89,13 @@ public: QString actionText() const; QString actionName() const; +public slots: + void focusName(); + void focusText(); + void focusTooltip(); + void focusShortcut(); + void focusCheckable(); + private slots: void on_editActionText_textEdited(const QString &text); void on_editObjectName_textEdited(const QString &text); |