forked from qt-creator/qt-creator
QmlDesigner Connection Delete Shortcut replacement
Task: QDS-1320 Change-Id: I1a94d30710d58dfbd8e90a45133700af20fc2980 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
#include <QShortcut>
|
||||||
|
|
||||||
#include <bindingeditor/actioneditor.h>
|
#include <bindingeditor/actioneditor.h>
|
||||||
|
|
||||||
@@ -57,6 +58,7 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) :
|
|||||||
ui(new Ui::ConnectionViewWidget)
|
ui(new Ui::ConnectionViewWidget)
|
||||||
{
|
{
|
||||||
m_actionEditor = new QmlDesigner::ActionEditor(this);
|
m_actionEditor = new QmlDesigner::ActionEditor(this);
|
||||||
|
m_deleteShortcut = new QShortcut(this);
|
||||||
QObject::connect(m_actionEditor, &QmlDesigner::ActionEditor::accepted,
|
QObject::connect(m_actionEditor, &QmlDesigner::ActionEditor::accepted,
|
||||||
[&]() {
|
[&]() {
|
||||||
if (m_actionEditor->hasModelIndex()) {
|
if (m_actionEditor->hasModelIndex()) {
|
||||||
@@ -123,6 +125,7 @@ ConnectionViewWidget::~ConnectionViewWidget()
|
|||||||
{
|
{
|
||||||
delete m_actionEditor;
|
delete m_actionEditor;
|
||||||
delete ui;
|
delete ui;
|
||||||
|
delete m_deleteShortcut;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionViewWidget::setBindingModel(BindingModel *model)
|
void ConnectionViewWidget::setBindingModel(BindingModel *model)
|
||||||
@@ -212,6 +215,10 @@ QList<QToolButton *> ConnectionViewWidget::createToolBarWidgets()
|
|||||||
connect(buttons.constLast(), &QAbstractButton::clicked, this, &ConnectionViewWidget::removeButtonClicked);
|
connect(buttons.constLast(), &QAbstractButton::clicked, this, &ConnectionViewWidget::removeButtonClicked);
|
||||||
connect(this, &ConnectionViewWidget::setEnabledRemoveButton, buttons.constLast(), &QWidget::setEnabled);
|
connect(this, &ConnectionViewWidget::setEnabledRemoveButton, buttons.constLast(), &QWidget::setEnabled);
|
||||||
|
|
||||||
|
m_deleteShortcut->setKey(Qt::Key_Delete);
|
||||||
|
m_deleteShortcut->setContext(Qt::WidgetWithChildrenShortcut);
|
||||||
|
connect(m_deleteShortcut, &QShortcut::activated, this, &ConnectionViewWidget::removeButtonClicked);
|
||||||
|
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -101,6 +101,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
Ui::ConnectionViewWidget *ui;
|
Ui::ConnectionViewWidget *ui;
|
||||||
QmlDesigner::ActionEditor *m_actionEditor;
|
QmlDesigner::ActionEditor *m_actionEditor;
|
||||||
|
QShortcut *m_deleteShortcut;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user