How can I move the scrollbar of a QTreeView/QListView to the left edge of the widget? I want the scrollbar to be on the left side for a specific widget in my app.
How can I move the scrollbar of a QTreeView/QListView to the left edge of the widget? I want the scrollbar to be on the left side for a specific widget in my app.
Qt Code:
anyAbstractScrollArea->setLayoutDirection(Qt::RightToLeft);To copy to clipboard, switch view to plain text mode
J-P Nurmi
But that's quite weird to have a scroll bar on the left in a LTR layout, isn't it? You might be better off with a custom scroll bar, then. You can hide the scroll bar provided by the abstract scroll area by adjusting the scroll bar policy. Use layouts to place a scroll bar on the left side of the scroll area and connect signals from/to the hidden scroll bar to make the custom scroll bar functional. Notice that you have to sync both range and value.
J-P Nurmi
tituslup (14th September 2009)
It looks like this is the way to go. Thank you for your time.
I also needed to place a scroll bar on the left side of a tableView, and based on the layout advice from jpn, i did is the fallowing:
Qt Code:
reportTableView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // Add widgets to H layout. layout->addWidget(scrollBar); layout->addWidget(reportTableView );To copy to clipboard, switch view to plain text mode
This way you use the existing scrollBar, but place it on the left.
Hope this works right.
Bookmarks