[PyQt] Editor alignment in QTreeView

Albert Cervera i Areny albert at nan-tic.com
Sun Mar 13 23:52:31 GMT 2011

A Dilluns, 14 de març de 2011 00:42:54, Hans-Peter Jansen va escriure:
> 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.

Thank you very much for your answer. I attach two new screenshots showing the 
grid header. As it can be seen, left aligned columns can be edited correctly.

> > 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.

Yes, sorry.

> > Anyone have an idea how to solve that?
> Check your code or provide a minimum runnable script, that demonstrates
> the problem.

Will try to provide a small example. Will take some time, though.

> Pete
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Albert Cervera i Areny
OpenERP Partners
Tel: +34 93 553 18 03
skype: nan-oficina

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110314/a9e0fe84/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: correct-alignment.png
Type: image/png
Size: 22527 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110314/a9e0fe84/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: incorrect-alignment1.png
Type: image/png
Size: 23401 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110314/a9e0fe84/attachment-0003.png>

More information about the PyQt mailing list