[SOLVED] Row height in QTreeView



  • Hello.

    I've created an a TreeModel with a TreeView. But as it can be seen on the picture at the bottom the Row height is higher than it needs to be.

    How can I resize the row height to the height of the content like it is done with ui->treeView->header()->setResizeMode(QHeaderView::ResizeToContents); for the column width?

    !http://s3.imgimg.de/uploads/01557c97e3png.png(here)!



  • The image is not visible : Kindly update.

    One way of setting the row height is to write a delegate and override sizeHint() function where you can specify the width and height for the row.



  • [quote author="Sam" date="1352889258"]The image is not visible : Kindly update.
    [/quote]

    Strange. I can see the image. Maybe this link works:http://s3.imgimg.de/uploads/01557c97e3png.png

    [quote author="Sam" date="1352889258"]
    One way of setting the row height is to write a delegate and override sizeHint() function where you can specify the width and height for the row.[/quote]

    Is this the only way? I haven't used own delegates yet :-)



  • THe interesting question is: why is the row height this high! Typically, it is as high as one line.
    Is thee some multiline elements in the tree?



  • Good hint.

    There were linebreaks at the end of the strings I've read from a file :-/

    After removing them everything looks fine.

    Thank you very much.



  • bq. Strange. I can see the image. Maybe this link works:http://s3.imgimg.de/uploads/01557c97e3png.png

    I figured out the the url link in blocked by the provider in my country. So the image as well as the link both does not open for me. Anyhow i used tor browser to view the image :D

    @Gerolf +1 for that :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.