juannm
19th August 2008, 17:58
Hi! I have a MySQL table with a field defined as follows:
type CHAR(1) NOT NULL DEFAULT 'Z'
so it indicates whether each record is an input ('I'), an output ('O') or an unassigned value (that default 'Z' value). Maybe it could have more values in the future, so another letters would be used.
Then, I have a C++ class IOConfig that has one Q_PROPERTY for each column in the table, so one instance of this class replicates one record of the table.
So it has the following qproperty:
Q_PROPERTY(QChar type READ type WRITE setType)
The problem is when reading the record values through a QSqlRecord, it reads the "type" column as a QVariant::String so it doesn't coincide with the qproperty type, which is QVariant::Char.
How could I solve this problem? I have been searching about this but found nothing relevant :(
type CHAR(1) NOT NULL DEFAULT 'Z'
so it indicates whether each record is an input ('I'), an output ('O') or an unassigned value (that default 'Z' value). Maybe it could have more values in the future, so another letters would be used.
Then, I have a C++ class IOConfig that has one Q_PROPERTY for each column in the table, so one instance of this class replicates one record of the table.
So it has the following qproperty:
Q_PROPERTY(QChar type READ type WRITE setType)
The problem is when reading the record values through a QSqlRecord, it reads the "type" column as a QVariant::String so it doesn't coincide with the qproperty type, which is QVariant::Char.
How could I solve this problem? I have been searching about this but found nothing relevant :(