PDA

View Full Version : QTableView selected a full row



pmjz
28th October 2011, 01:22
Hi, guys

I create a delegate for checkbox, and display this checkBox in Qtableview. everything is ok, but, when I selected one row in table, there is no selected color in that specific columns that checkbox are displayed. would you guys please give me some ideas on this issue, thanks a lot.

class CheckBoxDelegate : public QItemDelegate
{
Q_OBJECT
public:
explicit CheckBoxDelegate(QObject *parent=0);

virtual void drawCheck(QPainter *painter, const QStyleOptionViewItem &option,
const QRect &, Qt::CheckState state) const;
virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
const QModelIndex &index);
virtual void drawFocus(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const;
};

7041