Browse Source

SaltTable enhancements

Neal Wilson 5 years ago
parent
commit
227e629931
Signed by: Neal Wilson <neal@typica.us> GPG Key ID: 2A0BDDE701E66EB9
1 changed files with 15 additions and 3 deletions
  1. 15
    3
      src/typica.w

+ 15
- 3
src/typica.w View File

6153
 {
6153
 {
6154
     widget->setDisplayColumn(currentElement.attribute("display").toInt());
6154
     widget->setDisplayColumn(currentElement.attribute("display").toInt());
6155
 }
6155
 }
6156
+if(currentElement.hasAttribute("editable"))
6157
+{
6158
+    if(currentElement.attribute("editable") == "true")
6159
+    {
6160
+        widget->setEditable(true);
6161
+    }
6162
+}
6156
 widget->addSqlOptions(currentElement.text());
6163
 widget->addSqlOptions(currentElement.text());
6157
 delegate->setWidget(widget);
6164
 delegate->setWidget(widget);
6158
 view->setItemDelegateForColumn(currentColumn, delegate);
6165
 view->setItemDelegateForColumn(currentColumn, delegate);
13372
     public:@/
13379
     public:@/
13373
         SaltModel(int columns);
13380
         SaltModel(int columns);
13374
         ~SaltModel();
13381
         ~SaltModel();
13375
-        int rowCount(const QModelIndex &parent = QModelIndex()) const;
13382
+        Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const;
13376
         int columnCount(const QModelIndex &parent = QModelIndex()) const;
13383
         int columnCount(const QModelIndex &parent = QModelIndex()) const;
13377
         bool setHeaderData(int section, Qt::Orientation@, orientation,
13384
         bool setHeaderData(int section, Qt::Orientation@, orientation,
13378
                            const QVariant &value, int role = Qt::DisplayRole);
13385
                            const QVariant &value, int role = Qt::DisplayRole);
13932
                                            const QStyleOptionViewItem &,
13939
                                            const QStyleOptionViewItem &,
13933
                                            const QModelIndex &) const
13940
                                            const QModelIndex &) const
13934
 {
13941
 {
13935
-    return delegate->clone(parent);
13942
+    SqlComboBox *retval = delegate->clone(parent);
13943
+    if(delegate->isEditable())
13944
+    {
13945
+        retval->setEditable(true);
13946
+    }
13947
+    return retval;
13936
 }
13948
 }
13937
 
13949
 
13938
 @ To set the appropriate editor data, we check the value in the model and
13950
 @ To set the appropriate editor data, we check the value in the model and
13957
                                        const QModelIndex &index) const
13969
                                        const QModelIndex &index) const
13958
 {
13970
 {
13959
     SqlComboBox *self = qobject_cast<SqlComboBox *>(editor);
13971
     SqlComboBox *self = qobject_cast<SqlComboBox *>(editor);
13972
+    model->setData(index, self->currentText(), Qt::DisplayRole);
13960
     model->setData(index, self->itemData(self->currentIndex(), Qt::UserRole),
13973
     model->setData(index, self->itemData(self->currentIndex(), Qt::UserRole),
13961
                    Qt::UserRole);
13974
                    Qt::UserRole);
13962
-    model->setData(index, self->currentText(), Qt::DisplayRole);
13963
 }
13975
 }
13964
 
13976
 
13965
 @ This is needed to play nicely with the model view architecture.
13977
 @ This is needed to play nicely with the model view architecture.

Loading…
Cancel
Save