Results 1 to 4 of 4

Thread: Increasing the width of a row in a TreeView

  1. #1
    Join Date
    Jan 2006
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Increasing the height of a row in a TreeView

    I am using Qt 4.1's QTreeView. I don't want the text to ellide and hence want to increase the row height based on the text.

    In order to do this i am implementing the sizeHint() of QAbstractItemDelgate(), but in this function option.rect.width() return 0. Why is this so?
    Last edited by Shambhavi; 7th January 2006 at 07:14. Reason: Title is wrong!!

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: Increasing the width of a row in a TreeView

    I think it is something like the minimum size. You'll have to add the size of your content I think.
    It's nice to be important but it's more important to be nice.

  3. #3
    Join Date
    Jan 2006
    Posts
    40
    Thanks
    3
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Increasing the width of a row in a TreeView


  4. #4
    Join Date
    Jan 2006
    Location
    Lincoln, NE USA
    Posts
    177
    Thanks
    3
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Increasing the width of a row in a TreeView

    Qt Code:
    1. viewModel->setQuery(queryStr);
    2. if (viewModel->lastError().type() == QSqlError::NoError){
    3. wnui.wholeNameView->setModel(viewModel);
    4. if (viewModel->rowCount() > 0){
    5. for (int i = 0; i < viewModel->rowCount(); ++i)
    6. this->wnui.wholeNameView->verticalHeader()->resizeSection(i,20);
    7. for (int i = 0; i < 7; ++i)
    8. wnui.wholeNameView->resizeColumnToContents(i);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Increasing the Width of grid lines in qtable
    By raghvendramisra in forum Qt Programming
    Replies: 5
    Last Post: 29th August 2008, 17:19
  2. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 23:34

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.