[Kst] branches/work/kst/portto4/kst/src/libkstapp

George Staikos staikos at kde.org
Tue May 29 17:31:31 CEST 2007


SVN commit 669518 by staikos:

make editable vectors bold


 M  +21 -3     vectormodel.cpp  
 M  +1 -1      vectortablemodel.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/vectormodel.cpp #669517:669518
@@ -13,6 +13,8 @@
 
 #include <assert.h>
 
+#include <QFont>
+
 namespace Kst {
 
 VectorModel::VectorModel(KstVectorPtr v)
@@ -39,10 +41,26 @@
 
 QVariant VectorModel::data(const QModelIndex& index, int role) const {
   Q_UNUSED(role)
-  if (!index.isValid() || role != Qt::DisplayRole) {
-    return QVariant();
+  QVariant rc;
+  if (index.isValid()) {
+    switch (role) {
+      case Qt::DisplayRole:
+        rc = QVariant(_v->value(index.row()));
+        break;
+      case Qt::FontRole:
+        {
+          if (_v->editable()) {
+            QFont f;
+            f.setBold(true);
+            rc = f;
+          }
+        }
+        break;
+      default:
+        break;
+    }
   }
-  return QVariant(_v->value(index.row()));
+  return rc;
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/vectortablemodel.cpp #669517:669518
@@ -41,7 +41,7 @@
 
 
 QVariant VectorTableModel::data(const QModelIndex& index, int role) const {
-  if (!index.isValid() || role != Qt::DisplayRole) {
+  if (!index.isValid()) {
     return QVariant();
   }
   VectorModel *m = _vectors[index.column()];


More information about the Kst mailing list