[PyQt] Editor alignment in QTreeView

Hans-Peter Jansen hpj at urpla.net
Sun Mar 13 23:42:54 GMT 2011


On Sunday 13 March 2011, 11:37:43 Albert Cervera i Areny wrote:
> Hi,
> in our application we right-align dates and numbers in QTreeViews
> using the TextAlignmentRole. The problem is that Qt shows the editor
> (QLineEdit) for those items, over the column on the right of the
> current cell. I tried to ensure QLineEdit's alignment was
> 'RightAlign' so at least it would go over current cell but that
> didn't work.

Looks like a genuine off by one problem to me. I don't believe, that 
alignment is the issue here. Editors are positioned on the fields that 
display the data. Don't showing the grid in the screenshot doesn't help 
either.

> I attach a small image showing the problem. The edited text
> "23/02/2011" should be shown right after the rest of the dates.
                                     ^^^^^
I guess, you mean below.

> Anyone have an idea how to solve that?

Check your code or provide a minimum runnable script, that demonstrates 
the problem.

Pete



More information about the PyQt mailing list