Results 1 to 15 of 15

Thread: How to get scrollbars in QTreeWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Leiden, the Netherlands
    Posts
    43
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: How to get scrollbars in QTreeWidget

    Here it is
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 127 Times in 121 Posts

    Default Re: How to get scrollbars in QTreeWidget

    maybe we do need it!!! I got exactly the same problem with DevQt project manager (all those who tested may have noticed) and I didn't find any way to fix it! Looks like a Qt issue (maybe only on M$ Win but still a Qt issue)...
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: How to get scrollbars in QTreeWidget

    Quote Originally Posted by Arthur
    Here it is
    This is not a minimal compilable example. One can hardly to anything with a complex, yet not using layouts window.

  4. #4
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    44
    Thanked 2 Times in 2 Posts

    Default Re: How to get scrollbars in QTreeWidget

    I comment how I solve this problem: I declare one additional column at the end of the tree widget and I let it empty (it's a bit ugly but in this way always appears the scroll bar when is needed and also if you hide the header it's not noticed )
    Last edited by SkripT; 14th April 2006 at 18:25.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: How to get scrollbars in QTreeWidget

    It should be achievable if you resize the column. Either by calling resizeColumnToContents (or something like that) or QHeaderView::resizeSection(). One of them will probably fix the issue. Qt behaviour is fine -- it is not the view contents which doesn't fit on the viewport (which would mean a scrollbar has to be added), it is the column which is too narrow to fit contents.

  6. #6
    Join Date
    Jan 2006
    Location
    Leiden, the Netherlands
    Posts
    43
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: How to get scrollbars in QTreeWidget

    Quote Originally Posted by wysota
    This is not a minimal compilable example. One can hardly to anything with a complex, yet not using layouts window.
    Well, this is exactly nothing more than a simple project containing the widget layout where the problem occurs. If I just put a treeview on a form, it will probably work...

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: How to get scrollbars in QTreeWidget

    Quote Originally Posted by Arthur
    Well, this is exactly nothing more than a simple project containing the widget layout where the problem occurs. If I just put a treeview on a form, it will probably work...
    There is no layout there. Try resizing the window. The form (and other widgets too) is completely unnecessary, it would be better if there was only the treewidget there:

    Qt Code:
    1. #include <QApplication>
    2. #include <QTreeWidget>
    3. #include <QStringList>
    4.  
    5. int main(int argc, char **argv){
    6. QApplication app(argc, argv);
    7. // ... some lines here, like:
    8. tw.insertTopLevelItem(0,
    9. new QTreeWidgetItem( QStringList() << "col1" << "col2" )
    10. );
    11. tw.show();
    12. return app.exec();
    13. }
    To copy to clipboard, switch view to plain text mode 

    That's a minimal compilable example

Similar Threads

  1. how to sync a QTreeWidget and a QListWidget?
    By zl2k in forum Qt Programming
    Replies: 2
    Last Post: 5th September 2008, 21:55
  2. QTreeWidget Drag and Drop
    By tommydent in forum Qt Programming
    Replies: 10
    Last Post: 25th August 2008, 16:25
  3. QTreeWidget nextSibling()
    By user_mail07 in forum Newbie
    Replies: 1
    Last Post: 21st August 2008, 20:44
  4. QTreeWidget click
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 24th October 2007, 17:47
  5. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 23:32

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
  •  
Qt is a trademark of The Qt Company.