From 1a218b5edb34aa95607ef4a1620055daa1c26555 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sun, 26 Jun 2016 15:45:31 +0300 Subject: [PATCH] Set cell with icon in table non-editable. --HG-- branch : develop --- src/app/valentina/dialogs/vwidgetdetails.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/valentina/dialogs/vwidgetdetails.cpp b/src/app/valentina/dialogs/vwidgetdetails.cpp index fd4ec5cb3..315d84997 100644 --- a/src/app/valentina/dialogs/vwidgetdetails.cpp +++ b/src/app/valentina/dialogs/vwidgetdetails.cpp @@ -105,6 +105,11 @@ void VWidgetDetails::FillTable(const QHash *details) item->setIcon(QIcon("://icon/16x16/forbid_detail.png")); } item->setData(Qt::UserRole, i.key()); + // set the item non-editable (view only), and non-selectable + Qt::ItemFlags flags = item->flags(); + flags &= ~(Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); + ui->tableWidget->setItem(currentRow, 0, item); QString name = det.getName(); @@ -115,9 +120,7 @@ void VWidgetDetails::FillTable(const QHash *details) item = new QTableWidgetItem(name); item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); - - // set the item non-editable (view only), and non-selectable - Qt::ItemFlags flags = item->flags(); + flags = item->flags(); flags &= ~(Qt::ItemIsEditable); // reset/clear the flag item->setFlags(flags);