From c75c9aa7f8bf60f3c701e5ad683a03f7bc636bd4 Mon Sep 17 00:00:00 2001 From: Alfredo Ramos Date: Fri, 29 Jun 2018 09:23:14 -0500 Subject: [PATCH] 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. --- src/widgets/infowindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/widgets/infowindow.cpp b/src/widgets/infowindow.cpp index a19896f4..be97b0d7 100644 --- a/src/widgets/infowindow.cpp +++ b/src/widgets/infowindow.cpp @@ -75,11 +75,21 @@ void InfoWindow::initInfoTable() { QStringList names; names << tr("Key") << tr("Description"); table->setHorizontalHeaderLabels(names); + //add content for (int i= 0; i < m_keys.size(); ++i){ table->setItem(i, 0, new QTableWidgetItem(tr(m_keys.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 table->resizeColumnsToContents(); table->resizeRowsToContents();