I have tried :
if(index.child(0, 0).isValid()) {
viewOptions.rect = option.rect;
viewOptions.displayAlignment = Qt::AlignLeft;
viewOptions.decorationAlignment = Qt::AlignLeft;
viewOptions.textElideMode = Qt::ElideLeft;
}
}
void paint(QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index) const override {
if(index.child(0, 0).isValid()) {
QStyleOptionViewItem viewOptions;
viewOptions.rect = option.rect;
viewOptions.displayAlignment = Qt::AlignLeft;
viewOptions.decorationAlignment = Qt::AlignLeft;
viewOptions.viewItemPosition = QStyleOptionViewItem::Beginning;
viewOptions.decorationPosition = QStyleOptionViewItem::Left;
viewOptions.textElideMode = Qt::ElideLeft;
QApplication::style()->drawControl(QStyle::CE_PushButton, &viewOptions, painter);
}
QItemDelegate::paint(painter, option, index);
}
To copy to clipboard, switch view to plain text mode
but children item padding is still indented
Bookmarks