[PyQt] QTreeView scrolling on selection

Yuya Nishihara yuya at tcha.org
Mon Nov 22 16:48:25 GMT 2010

Steve Borho wrote:
> Hello,
> We use a QTreeView to present a list of files in our commit tool.  The
> view has 4 columns, the largest of which is the file name.  We don't
> really like Qt's behavior of scrolling horizontally when an item is
> selected, most of the time the user wants column 0 visible since it
> has the file selection check boxes.
> We have a hack in place which disables this horizontal scrolling:
> http://bitbucket.org/tortoisehg/thg/changeset/d3c50e52949b
> But I was curious if anyone knew of a cleaner way to accomplish this.  Cheers.

Hi, I made this change yesterday, and it was described at Qt FAQ:

But today I found much simpler, but *undocumented* behavior:


Though the document says "This property only works if the viewport accepts
drops.", it just works. :)


Does anyone know this is
- an expected behavior and documentation bug
- or unexpected behavior ?


More information about the PyQt mailing list