#include #include #include int main(int argc, char** argv) { QApplication app(argc, argv); app.setStyle(QStyleFactory::create("fusion")); // 1: specify a section border and an arrow position app.setStyleSheet("QHeaderView::section { border: 1px solid blue; } QHeaderView::up-arrow { right: 1px; }"); // 2: specify only a section border // app.setStyleSheet("QHeaderView::section { border: 1px solid blue; }"); // 3: specify only an arrow position // app.setStyleSheet("QHeaderView::up-arrow { right: 1px; }"); // 4: specify no stylesheet so only the base fusion style is used QStandardItemModel model(3, 3); for (auto i = 0u; i < 3; ++i) { for (auto j = 0u; j < 3; ++j) { model.setData(model.index(i, j), QString("cell(%1, %2)").arg(i).arg(j)); } } for (auto j = 0u; j < 3; ++j) { model.setHeaderData(j, Qt::Orientation::Horizontal, QString("Column Header %1|").arg(j)); } QTreeView view{}; view.setModel(&model); view.setSortingEnabled(true); view.header()->setSortIndicator(1, Qt::SortOrder::AscendingOrder); view.header()->setSectionResizeMode(QHeaderView::ResizeMode::Interactive); view.show(); return app.exec(); }