]> git.sur5r.net Git - bacula/bacula/commitdiff
bat: Simplify the code to make TableWidget in read-only
authorEric Bollengier <eric@eb.homelinux.org>
Sun, 23 Aug 2009 08:36:17 +0000 (10:36 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Sun, 23 Aug 2009 08:36:37 +0000 (10:36 +0200)
bacula/src/qt-console/joblist/joblist.cpp
bacula/src/qt-console/mediainfo/mediainfo.cpp
bacula/technotes

index 95dcc8e6741534e8440b56e64006837c46955851..8b35834997cf215e30ff6db4ee737f2fa211dc19 100644 (file)
@@ -231,16 +231,7 @@ void JobList::populateTable()
    }
 
    /* make read only */
-   int rcnt = mp_tableWidget->rowCount();
-   int ccnt = mp_tableWidget->columnCount();
-   for(int r=0; r < rcnt; r++) {
-      for(int c=0; c < ccnt; c++) {
-         QTableWidgetItem* item = mp_tableWidget->item(r, c);
-         if (item) {
-            item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable)));
-         }
-      }
-   }
+   m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
 }
 
 void JobList::prepareFilterWidgets()
index bbb4e7df1ddc7a87cd35c0ff5e2cbd0653b52cfd..2de3f2128d45eab621da612697118335b8d1c123 100644 (file)
@@ -254,15 +254,5 @@ void MediaInfo::populateForm()
    tableJob->verticalHeader()->hide();
 
    /* make read only */
-   int rcnt = tableJob->rowCount();
-   int ccnt = tableJob->columnCount();
-   for(int r=0; r < rcnt; r++) {
-      for(int c=0; c < ccnt; c++) {
-         QTableWidgetItem* item = tableJob->item(r, c);
-         if (item) {
-            item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable)));
-         }
-      }
-   }
-
+   tableJob->setEditTriggers(QAbstractItemView::NoEditTriggers);
 }
index 3242f0e63a3ace9c43f9612b54ae3ca428727409..29e7622e6d0c5404cde5cf119a8139269aead720 100644 (file)
@@ -3,6 +3,7 @@
 General:
 
 23Aug09
+ebl  Simplify the code to make TableWidget in read-only
 kes  Free Volume in several places. Fixes virtual-changer problem
      and possibly bug #1346.
 kes  Add SD Volume debug code