Mercurial > hg > svcore
comparison data/model/ModelDataTableModel.cpp @ 421:397fe91dc8e0
* Fix for data modification in data edit view... now why isn't the
command appearing on the undo menu?
author | Chris Cannam |
---|---|
date | Wed, 11 Jun 2008 17:00:04 +0000 |
parents | 50a956688baa |
children | 4caa28a0a8a2 |
comparison
equal
deleted
inserted
replaced
420:50a956688baa | 421:397fe91dc8e0 |
---|---|
20 | 20 |
21 #include <algorithm> | 21 #include <algorithm> |
22 #include <iostream> | 22 #include <iostream> |
23 | 23 |
24 ModelDataTableModel::ModelDataTableModel(TabularModel *m) : | 24 ModelDataTableModel::ModelDataTableModel(TabularModel *m) : |
25 m_model(m) | 25 m_model(m), |
26 m_sortColumn(0), | |
27 m_sortOrdering(Qt::AscendingOrder) | |
26 { | 28 { |
27 Model *baseModel = dynamic_cast<Model *>(m); | 29 Model *baseModel = dynamic_cast<Model *>(m); |
28 | 30 |
29 connect(baseModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); | 31 connect(baseModel, SIGNAL(modelChanged()), this, SLOT(modelChanged())); |
30 connect(baseModel, SIGNAL(modelChanged(size_t, size_t)), | 32 connect(baseModel, SIGNAL(modelChanged(size_t, size_t)), |
44 | 46 |
45 bool | 47 bool |
46 ModelDataTableModel::setData(const QModelIndex &index, const QVariant &value, int role) | 48 ModelDataTableModel::setData(const QModelIndex &index, const QVariant &value, int role) |
47 { | 49 { |
48 if (!index.isValid()) return false; | 50 if (!index.isValid()) return false; |
49 Command *command = m_model->setData(getUnsorted(index.row()), | 51 std::cerr << "ModelDataTableModel::setData(" << index.row() << ", " << index.column() << ", " << value.toString().toStdString() << ", " << role << ")" << std::endl; |
50 index.column(), value, role); | 52 Command *command = m_model->getSetDataCommand(getUnsorted(index.row()), |
53 index.column(), | |
54 value, role); | |
51 if (command) { | 55 if (command) { |
56 std::cerr << "emitting executeCommand" << std::endl; | |
52 emit executeCommand(command); | 57 emit executeCommand(command); |
53 return true; | 58 return true; |
54 } else { | 59 } else { |
55 return false; | 60 return false; |
56 } | 61 } |
175 } | 180 } |
176 | 181 |
177 void | 182 void |
178 ModelDataTableModel::resort() | 183 ModelDataTableModel::resort() |
179 { | 184 { |
180 //... | 185 |
181 } | 186 } |
182 | 187 |