On 16 September 2012 12:04, luafox <
in...@luafox.com> wrote:
> I have got another question regarding the QTableView. I would like to color
> individual rows in a different background color. I found that role = 8 is
> used to set the background color. The color should be gives as QBrush and
> converted to QVariant. Unfortunately I get the following error message:
>
> lua: QVariant::new(QBrush*): incorrect or extra arguments, expecting: or
> QTime*, or QBitArray*, or QVariant*, or integer, or QDataStream*, or QRect*,
> or QStringList*, or QChar*, or QPointF*, or QLine*, or boolean, or QSize*,
> or QList<QVariant>*, or QDateTime*, or QUrl*, or QRegExp*, or QRectF*, or
> QPoint*, or number, or QLatin1String*, or QDate*, or QSizeF*, or QLocale*,
> or QLineF*, or QVariant.Type, or Qt.GlobalColor, or QString*, or string,.
>
> This error suggest that QVariant can not handle QBrush, but [1] shows that
> QVariant should understand QBrush. So I wonder what I am missing here. Does
> anyone know and can help me? Or is there a more simple way to set the
> background color of rows (in the code above I left away the part that
> defines which rows to color, so I would expecte the code to set the
> background color of the whole table)?
QBrush is from the QtGui module. You CAN use it in lqt, but it is not
as straight-forward. You should be able to use it like this: