27 #include <QKeySequence>
29 #include <MemoryX/gui-plugins/SceneEditor/ui_ShortcutDialog.h>
35 shortcutController =
control->getShortcutController();
38 proxyModel =
new QSortFilterProxyModel();
39 proxyModel->setSourceModel(tableModel);
41 ui->shortcutsTableView->setModel(proxyModel);
42 ui->shortcutsTableView->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
43 ui->shortcutsTableView->horizontalHeader()->resizeSection(1, 150);
46 connect(ui->buttonBox, SIGNAL(rejected()),
this, SLOT(close()));
47 connect(ui->shortcutsTableView,
48 SIGNAL(clicked(QModelIndex)),
50 SLOT(shortcutClicked(QModelIndex)));
51 connect(ui->shortcutLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(shortcutChanged()));
60 gui::dialog::ShortcutDialog::showEvent(QShowEvent* event)
62 tableModel->setShortcutHashTable(shortcutController->getAllRegisteredShortcuts());
63 proxyModel =
new QSortFilterProxyModel();
64 proxyModel->setSourceModel(tableModel);
65 ui->shortcutsTableView->setModel(proxyModel);
66 ui->shortcutsTableView->sortByColumn(0, Qt::AscendingOrder);
70 gui::dialog::ShortcutDialog::shortcutClicked(QModelIndex
index)
72 ui->keySequenceGroupBox->setEnabled(
true);
74 tableModel->actionName(proxyModel->mapToSource(
index), Qt::DisplayRole).toString();
75 ui->shortcutLineEdit->setText(
76 shortcutController->getAllRegisteredShortcuts().value(activeAction));
77 ui->shortcutLineEdit->setFocus();
81 gui::dialog::ShortcutDialog::shortcutChanged()
83 shortcutController->updateShortcut(activeAction, ui->shortcutLineEdit->text());
84 tableModel->setShortcutHashTable(shortcutController->getAllRegisteredShortcuts());
85 proxyModel =
new QSortFilterProxyModel();
86 proxyModel->setSourceModel(tableModel);
87 ui->shortcutsTableView->setModel(proxyModel);
88 ui->shortcutsTableView->sortByColumn(0, Qt::AscendingOrder);
94 this->ui->retranslateUi(
this);