[PyKDE] UPDATE to Qvariant problem (it looks like)
hpj at urpla.net
Sat Jun 22 00:26:01 BST 2002
I made a mistake in the QSqlFieldInfo call. The error message is now:
QSqlField::setValue: monsalary cannot cast from QKeySequence to double
Problem persists. Corrected version attached.
On Fri, 21 Jun 2002 20:24:55 +0200
"Hans-Peter Jansen" <hpj at urpla.net> wrote:
> Hi Phil et al.,
> I hacked a bit on sqltable4.py to circumvent current PyQt Q_PROPERTY
> problems. My solution is simply mapping the QComboBox index to the name.
> Working fine so far. I thought, a further improvement would be using
> a calculated field "Monthly Salary", so I tried to imitate the qt
> sql/overview/subclass4 example by subclassing QSqlCursor. In the
> overloaded calculateField method, it's necessary to return a QVariant:
> def calculateField(self, name):
> if str(name) == "monsalary":
> v = self.value("salary").toDouble() / 12
> return QVariant(v)
> return QVariant(QString.null)
> Unfortunately, this produces strange error messages:
> QSqlField::setValue: monsalary cannot cast from QKeySequence to (null)
> Even the "return QVariant(QString.null)" statement gives:
> QSqlField::setValue: monsalary cannot cast from QString to (null)
> Any ideas, what happens here?
> This reminds me, that the docu states a lot QVariants variants as
> not yet implemented. Is this correct anymore?
> I've attached a reworked testdb.sql script to reflect the
> necessary changes for the StatusPicker problem.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4690 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20020622/c93a6519/sqltable4.obj
More information about the PyQt