Hello anyone,
Iám using qt-4.4.1 with Windows XP.
I have subclassed QSqLTableModel into CustomSqlModel for the BackgroundRole for setting different colors in columns and Textalignment.
In the main implentation i use QTableview as model.
Everything works perfect.
I have also subclassed QItemDelegate for setting background color for a column with a certain value. ( see example code below).
Now my question is i want to blink the cells with a QTimer in the subclassed QItemDelegate.
Is this possible and can you give me some example code.
QTimer use Signal and a Slot but the paint constructor is public and not a slot.
#include "delegate.h"
#include <QPainter>
#include <QTimer>
{
int val = index.model()->data(index, Qt::DisplayRole).toInt() < 1 ;
if(index.column() == 8 && val )
{
painter->fillRect(option.rect, Qt::yellow);
}
else
}
#include "delegate.h"
#include <QPainter>
#include <QTimer>
void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
int val = index.model()->data(index, Qt::DisplayRole).toInt() < 1 ;
if(index.column() == 8 && val )
{
painter->fillRect(option.rect, Qt::yellow);
}
else
QItemDelegate::paint(painter,option,index);
}
To copy to clipboard, switch view to plain text mode
Thanks in advance.
Bookmarks