Set keyboard shortcuts to read-only (#261)

Currently keyboard shortcuts cannot be changed, double clicking a cell in the Information window only changes the text, not the shortcut.

This could help to avoid user confusion, and should be reverted once the application adds an option to change keyboard shortcuts.
This commit is contained in:
Alfredo Ramos
2018-06-29 09:23:14 -05:00
committed by Dharkael
parent 979f7f6546
commit c75c9aa7f8

View File

@@ -75,11 +75,21 @@ void InfoWindow::initInfoTable() {
QStringList names; QStringList names;
names << tr("Key") << tr("Description"); names << tr("Key") << tr("Description");
table->setHorizontalHeaderLabels(names); table->setHorizontalHeaderLabels(names);
//add content //add content
for (int i= 0; i < m_keys.size(); ++i){ for (int i= 0; i < m_keys.size(); ++i){
table->setItem(i, 0, new QTableWidgetItem(tr(m_keys.at(i)))); table->setItem(i, 0, new QTableWidgetItem(tr(m_keys.at(i))));
table->setItem(i, 1, new QTableWidgetItem(tr(m_description.at(i)))); table->setItem(i, 1, new QTableWidgetItem(tr(m_description.at(i))));
} }
// Read-only table items
for (int x = 0; x < table->rowCount(); ++x) {
for (int y = 0; y < table->columnCount(); ++y) {
QTableWidgetItem *item = table->item(x, y);
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
}
}
// adjust size // adjust size
table->resizeColumnsToContents(); table->resizeColumnsToContents();
table->resizeRowsToContents(); table->resizeRowsToContents();