Scrollbar alignment for QTableView
-
How I can put vertical scrollbar on left side of QTableView
-
To my knowledge, there are not built-in means for this.
Usually it's not a good idea to change the behavior of UI components that the user is used to, unless you have very, very good reasons to do so.
-
Take a look at QItemDelegate.
-
[quote author="t3chNo" date="1326289687"]Take a look at QItemDelegate.[/quote]
Sorry, but this is complete nonsense. The item delegate class deal with single items, but not with the view as a whole.
-
[quote author="Volker" date="1326290126"]
[quote author="t3chNo" date="1326289687"]Take a look at QItemDelegate.[/quote]Sorry, but this is complete nonsense. The item delegate class deal with single items, but not with the view as a whole.[/quote]
Sorry, my bad. I misunderstand the question.
[quote author="TonyR" date="1326284470"]How I can put vertical scrollbar on left side of QTableView[/quote]Maybe putting QTableView in a QScrollArea solves your problem.
-
[quote author="t3chNo" date="1326290419"]
Maybe putting QTableView in a QScrollArea solves your problem.[/quote]All item view classes are subclasses of QAbstractScrollArea. Putting a scroll area into a scroll area doesn't look like a decent solution for me.
-
[quote author="Volker" date="1326290594"]
[quote author="t3chNo" date="1326290419"]
Maybe putting QTableView in a QScrollArea solves your problem.[/quote]All item view classes are subclasses of QAbstractScrollArea. Putting a scroll area into a scroll area doesn't look like a decent solution for me.[/quote]
You can change QScrollArea's layout direction to RightToLeft. This way, scroll bar is shown on left side of the widget. Then put QTableView in QScrollArea and change the QTableView's layout direction to LeftToRight.
-
This is not the same as having the scrollbar directly to the left: If you scroll the outer scroll area, you move the complete view thus moving the view's headers out of the viewport.
-
I think addScrollBarWidget(QWidget *, Qt::Alignment) should work for this requirement.