Results 1 to 3 of 3

Thread: different row heights in QTreeView

  1. #1
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default different row heights in QTreeView

    Hi,
    I subclassed QTreeView and QAbstractItemModel. The editing of different datatype is implemted via QItemEditorFactory.
    It works, but now I want, that the rows in the QTreeView resizes to the appropriate editor or the appropriate content. When editing row 1, just row1 should be resized...

    Does somebody know a solution?

  2. #2
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: different row heights in QTreeView

    The correct implemenation of QStyledItemDelegate::sizeHint(const QStyleOptionViewItem &option,const QModelIndex &index) const method solves the problem.

    One point is still not clear: Sometimes the model doesn't refresh the resizing immediately. Ho I can trigger the refresh-slot?

    thanks

  3. #3
    Join Date
    Apr 2011
    Posts
    195
    Thanks
    49
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: different row heights in QTreeView

    void QAbstractItemDelegate::sizeHintChanged ( const QModelIndex & index )

Similar Threads

  1. Replies: 2
    Last Post: 28th December 2011, 17:42
  2. QTableView keeping row heights
    By baray98 in forum Qt Programming
    Replies: 0
    Last Post: 6th May 2011, 05:23
  3. Replies: 6
    Last Post: 16th February 2010, 18:21
  4. Forcing equal row heights in QTableWidget
    By wssddc in forum Newbie
    Replies: 2
    Last Post: 2nd November 2009, 01:16
  5. QTableView row heights
    By Brandybuck in forum Qt Programming
    Replies: 8
    Last Post: 7th November 2006, 03:08

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.