I have a model, a few columns of which are supposed to be QPushButtons. 
I've got it working with checkboxes just fine, and I can get the QPushButtons 
to display while editing. 
But I want to display the checkable QPushButton reflecting it's checked state 
to be displayed all the time, not just when editing.

I looked at the stars delegate example, but that's got some rudimentary 
painting. 
I found the ProgressBar example in QAbstractItemDelegate, but that didn't worl

void ButtonDelegate::paint(QPainter *painter, const QStyleOptionViewItem 
&option, const QModelIndex &index) const {
        if (index.column() == 0) {
                QStyleOptionButton button;
                button.text = _text;
                QApplication::style()->drawControl(QStyle::CE_PushButton, 
&button, painter);
        } else
                QStyledItemDelegate::paint(painter, option, index);
}

QSize ButtonDelegate::sizeHint(const QStyleOptionViewItem &option, const 
QModelIndex &index) const {
        return QSize(50,10);
}

But all I got out of it was a black pixel in the first cell. 
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to