70 |
70 |
71 void addAttribute(const string_t &value) { |
71 void addAttribute(const string_t &value) { |
72 int column = attributeCounter % columnCount(); |
72 int column = attributeCounter % columnCount(); |
73 int row = attributeCounter / columnCount(); |
73 int row = attributeCounter / columnCount(); |
74 if (row >= records.size()) records.append(new QVector<QVariant>(columnCount())); |
74 if (row >= records.size()) records.append(new QVector<QVariant>(columnCount())); |
75 setData(index(row, column), QString::fromWCharArray(value.c_str())); |
75 |
|
76 QString valueString = QString::fromWCharArray(value.c_str()); |
|
77 QVariant valueVariant; |
|
78 boolean_t conversionOk = false; |
|
79 if (attributes[column].getTypeId() == TypeId::INTEGER) { |
|
80 valueVariant = valueString.toUInt(&conversionOk); |
|
81 } |
|
82 // TODO: boolean → checkboxes |
|
83 // else if (attributes[column].getTypeId() == TypeId::BOOLEAN) { |
|
84 // valueVariant = L"true" == value; |
|
85 // conversionOk = true; |
|
86 // } |
|
87 |
|
88 if (!conversionOk) valueVariant = valueString; |
|
89 |
|
90 setData(index(row, column), valueVariant); |
76 if (column == 0) emit layoutChanged(); // FIXME: emit other signal ~ begin..., end..., rowsInserted(??? index(0,0), row, row); |
91 if (column == 0) emit layoutChanged(); // FIXME: emit other signal ~ begin..., end..., rowsInserted(??? index(0,0), row, row); |
77 attributeCounter++; |
92 attributeCounter++; |
78 } |
93 } |
79 |
94 |
80 Qt::ItemFlags flags(const QModelIndex &index) const { |
95 Qt::ItemFlags flags(const QModelIndex &index) const { |