Results 1 to 4 of 4

Thread: How to set layout for QTreeView in QComboBox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    97
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    6
    Thanked 11 Times in 11 Posts

    Default Re: How to set layout for QTreeView in QComboBox

    Quote Originally Posted by kode View Post
    Hi all,

    i have QComboBox with QTreeView in it. i set maxwidth = 20 for the combo and i want to make tree view wider(400). i try to make some layout and apply it to the combo, but i get errors.

    How can i set the width of the tree view?
    This sounds to me like a very abnormal way to go about it. I assume what you're trying to do is get a tree view to show up when the user clicks the down arrow of a combo box. A better approach is probably to derive from the combo box (or use composition) and override the behavior of the down arrow (assuming this is possible) to pop up a window at the right location. That window can then be or contain a tree view/widget.

    Maybe there's a way to do it exactly the way you are, but I have my doubts and it's probably not the way I would go about trying.

  2. #2
    Join Date
    Dec 2010
    Posts
    11
    Thanks
    1

    Default Re: How to set layout for QTreeView in QComboBox

    Hi,

    thanks for the reply. The desired result is to have a square combo box 20x20 px. On click the combo shows treeview widget ( because i want to show 4 columns ). The problem is mwhen i set the width of the combo treeview automaticaly shrink to 20px width and i want to make it wider.

    I suppose i have to set some layout for treeview...

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: How to set layout for QTreeView in QComboBox

    Override the QComboBox::showPopup function. and show the view with desired geometry

Similar Threads

  1. QComboBox and QTreeView
    By Carlsberg in forum Qt Programming
    Replies: 7
    Last Post: 14th February 2013, 16:58
  2. QCombobox with QTreeView/QTreeWidget
    By swiety in forum Qt Programming
    Replies: 2
    Last Post: 30th August 2011, 19:27
  3. problem with QTreeView and QComboBox
    By nirab_25 in forum Newbie
    Replies: 0
    Last Post: 22nd January 2010, 13:47
  4. Replies: 0
    Last Post: 2nd April 2008, 07:48
  5. How to use QTreeView in QComboBox?
    By Tamara in forum Qt Programming
    Replies: 2
    Last Post: 20th June 2007, 19:03

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.