Вы должны установить режим elide с делегатом:
#include <QtWidgets>
class ElideLeftDelegate: public QStyledItemDelegate
{
public:
using QStyledItemDelegate::QStyledItemDelegate;
protected:
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const{
QStyledItemDelegate::initStyleOption(option, index);
option->textElideMode = Qt::ElideLeft;
}
};
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QTreeWidget w;
w.setItemDelegateForColumn(0, new ElideLeftDelegate{&w});
w.setColumnCount(2);
new QTreeWidgetItem(&w, {"abcdefghijklmnopqrdstuvwxyz", "AVCDEFGHIJKLMNOPQRSTUVWXYZ"});
new QTreeWidgetItem(&w, {"AVCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrdstuvwxyz"});
w.show();
return a.exec();
}