Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add tabWidth for QListView? #608

Open
iani opened this Issue Oct 19, 2012 · 1 comment

Comments

Projects
None yet
3 participants
Contributor

iani commented Oct 19, 2012

It makes sense to have adjustable tabWidth in QListView, as it already exists for QTextView. QListView is also good for showing lists of code snippets. The default tab width of QListView is way too big, so indented code tends to take up the entire width of a wide window, and creates a horizontal scroll bar.

Iannis Zannos

Owner

jleben commented Oct 19, 2012

The topic of tab width does not apply only to QListView, but to all views that display some text. Someone may find a QButton useful for displaying code snippets and than demand that tabWidth be implemented there. Instead of implementing this property on this or that widget, I would prefer a generic solution.

Given the restrictions of underlying Qt API, the only way I see this implemented is by setting the QWidget::styleSheet property [1], and since QWidget is a superclass of all widgets, this is also a generic solution at the same time.

Moreover, because you can set any Qt property in SC language using QObject:-setProperty method [2], this solution is already available today: one can set a CSS stylesheet this way:

myListView.setProperty(\styleSheet, "some stylsheet defining tab width")

However, I doubt that the solution is complete, because it does not seem that there is a globally-supported CSS way to define tab width [3].

[1] http://qt-project.org/doc/qt-4.8/qwidget.html#styleSheet-prop
[2] http://doc.sccode.org/Classes/QObject.html#-setProperty
[3] http://stackoverflow.com/questions/6754733/tab-width-css-property

@scztt scztt added the known issue label Apr 18, 2015

@scztt scztt added this to the future milestone Apr 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment