#include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget w; w.resize(200, 500); w.setLayout(new QVBoxLayout); QTreeWidget tw1; QTreeWidget tw2; tw1.setColumnCount(1); tw2.setColumnCount(1); QList items1; QList items2; for (int i = 0; i < 10; ++i) { items1.append(new QTreeWidgetItem(&tw1, QStringList(QString("tree widget item: %1").arg(i, i*2, 10, QChar('0'))))); items2.append(new QTreeWidgetItem(&tw2, QStringList(QString("tree widget item: %1").arg(i, i*2, 10, QChar('0'))))); } tw1.insertTopLevelItems(0, items1); tw1.setLayoutDirection(Qt::RightToLeft); tw1.setTextElideMode(Qt::ElideNone); tw2.insertTopLevelItems(0, items2); tw2.setLayoutDirection(Qt::RightToLeft); tw2.setTextElideMode(Qt::ElideLeft); w.layout()->addWidget(&tw1); w.layout()->addWidget(&tw2); w.show(); return a.exec(); }