Like in topic:
What should I write into DataDelegate:: paint when I want simply put text into a cell?
Where DataDelegate is:
}
DataDelegate::DataDelegate( QObject *parent ) : QAbstractItemDelegate( parent ) {
}
To copy to clipboard, switch view to plain text mode
I've tried:
{
if( option.
state & QStyle::State_Selected ) painter->fillRect( option.rect, option.palette.highlight() );
painter->drawText(option.rect.x()+4, option.rect.y()+20, index.model()->data( index, Qt::DisplayRole ).toString());
}
void DataDelegate::paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
{
if( option.state & QStyle::State_Selected )
painter->fillRect( option.rect, option.palette.highlight() );
painter->drawText(option.rect.x()+4, option.rect.y()+20, index.model()->data( index, Qt::DisplayRole ).toString());
}
To copy to clipboard, switch view to plain text mode
But when I tried to resize a kolumn by pressing between the columns, the column resize to much:
Bookmarks