25 #include <MemoryX/gui-plugins/SceneEditor/ui_ShortcutDialog.h>
28 #include <QKeySequence>
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, SIGNAL(clicked(QModelIndex)),
this, SLOT(shortcutClicked(QModelIndex)));
48 connect(ui->shortcutLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(shortcutChanged()));
56 void gui::dialog::ShortcutDialog::showEvent(QShowEvent* event)
58 tableModel->setShortcutHashTable(shortcutController->getAllRegisteredShortcuts());
59 proxyModel =
new QSortFilterProxyModel();
60 proxyModel->setSourceModel(tableModel);
61 ui->shortcutsTableView->setModel(proxyModel);
62 ui->shortcutsTableView->sortByColumn(0, Qt::AscendingOrder);
65 void gui::dialog::ShortcutDialog::shortcutClicked(QModelIndex
index)
67 ui->keySequenceGroupBox->setEnabled(
true);
68 activeAction = tableModel->actionName(proxyModel->mapToSource(
index), Qt::DisplayRole).toString();
69 ui->shortcutLineEdit->setText(shortcutController->getAllRegisteredShortcuts().value(activeAction));
70 ui->shortcutLineEdit->setFocus();
73 void gui::dialog::ShortcutDialog::shortcutChanged()
75 shortcutController->updateShortcut(activeAction, ui->shortcutLineEdit->text());
76 tableModel->setShortcutHashTable(shortcutController->getAllRegisteredShortcuts());
77 proxyModel =
new QSortFilterProxyModel();
78 proxyModel->setSourceModel(tableModel);
79 ui->shortcutsTableView->setModel(proxyModel);
80 ui->shortcutsTableView->sortByColumn(0, Qt::AscendingOrder);
85 this->ui->retranslateUi(
this);