equal
deleted
inserted
replaced
19 #include <glxmodelparm.h> |
19 #include <glxmodelparm.h> |
20 #include <QDebug> |
20 #include <QDebug> |
21 |
21 |
22 GlxModelWrapper::GlxModelWrapper(): mModel ( NULL), |
22 GlxModelWrapper::GlxModelWrapper(): mModel ( NULL), |
23 mOriginalRole(Qt::DecorationRole), |
23 mOriginalRole(Qt::DecorationRole), |
24 mConvertRole(Qt::DecorationRole) |
24 mConvertRole(Qt::DecorationRole), |
|
25 mPaintPage(false) |
25 { |
26 { |
26 |
27 |
27 } |
28 } |
28 |
29 |
29 void GlxModelWrapper::setModel(QAbstractItemModel *model) |
30 void GlxModelWrapper::setModel(QAbstractItemModel *model) |
30 { |
31 { |
31 if(model && mModel != model) |
32 if(model && mModel != model) |
32 { |
33 { |
33 disConnectFromModel(); |
34 disConnectFromModel(); |
34 mModel = model; |
35 mModel = model; |
|
36 QVariant variant = mModel->data(mModel->index(0,0),GlxPaintPageFlag); |
|
37 if (variant.isValid() && variant.canConvert<bool> () ) |
|
38 { |
|
39 mPaintPage = variant.value<bool>(); |
|
40 } |
35 connectToModel(); |
41 connectToModel(); |
36 resetTheModel(); |
42 resetTheModel(); |
37 } |
43 } |
38 } |
44 } |
39 |
45 |
173 |
179 |
174 void GlxModelWrapper::dataChangedinModel(QModelIndex startIndex, QModelIndex endIndex) |
180 void GlxModelWrapper::dataChangedinModel(QModelIndex startIndex, QModelIndex endIndex) |
175 { |
181 { |
176 int aStartRow = startIndex.row(); |
182 int aStartRow = startIndex.row(); |
177 |
183 |
|
184 if(mPaintPage) |
|
185 { |
178 if((aStartRow == 14) || (aStartRow+1 == rowCount())) |
186 if((aStartRow == 14) || (aStartRow+1 == rowCount())) |
179 { |
187 { |
180 emit dataChanged(index(0,0),index(endIndex.row(),0)); |
188 emit dataChanged(index(0,0),index(endIndex.row(),0)); |
|
189 mPaintPage = false; |
181 } |
190 } |
182 else if(aStartRow >= 15) |
191 else if(aStartRow >= 15) |
183 { |
192 { |
184 emit dataChanged(index(aStartRow,0),index(endIndex.row(),0)); |
193 emit dataChanged(index(aStartRow,0),index(endIndex.row(),0)); |
185 } |
194 } |
|
195 } |
186 else |
196 else |
187 { |
197 { |
188 // Do Nothing |
198 emit dataChanged(index(aStartRow,0),index(endIndex.row(),0)); |
189 } |
199 } |
190 } |
200 } |
191 |
201 |
192 void GlxModelWrapper::rowsAboutToBeInserted(const QModelIndex &parent,int start,int end) |
202 void GlxModelWrapper::rowsAboutToBeInserted(const QModelIndex &parent,int start,int end) |
193 { |
203 { |