How to get QTreeWidgetItem position?



  • How shall I get a QTreeWidgetItem LeftTop position (in pixel) after I get this item with the itemAt?


  • Qt Champions 2018

    The item has no visual representation it's just pure data. It's the view/delegate that takes care of representing visually the item.

    Why do you need that position?



  • @VRonin I need the position to define border coordinates of item. And then I will make a height resize of the item (when a mouse cursor drag a border).

    It is strange. I can set height of an item with

    QSize height; 
    height.setHeight(123); 
    item->setSizeHint(0, height);
    

    But I can not get coordinates of an item.


  • Qt Champions 2018

    All you are trying to do should be done by subclassing QStyledItemDelegate



  • @flammmable

    treeWidget()->itemWidget(poTreeItem,0)->rect().topLeft();
    

    https://stackoverflow.com/q/55352805/10069064


  • Qt Champions 2018

    itemWidget is not the way to go. the delegate is the scalable solution


 

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