Results 1 to 4 of 4

Thread: how to create something like widget box in qt designer

  1. #1
    Join Date
    Mar 2008
    Posts
    5
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default how to create something like widget box in qt designer

    Hi,

    in our application called Orange we also have a set of widgets split into categories. We would like to have an interface to select these widgets which would be as similar as possible to Qt designer's Widget Box.



    Do you have any idea how would I do this?

    Thanks in advance for any help.
    Gregor

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to create something like widget box in qt designer

    Is this not a QToolBox

  3. #3
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to create something like widget box in qt designer

    a QToolBox is like a QTabWidget, but the tabs are 'above each other'.
    See the Qt widget gallery for an example.

    This looks like a QTreeView to me.
    Probably the header items are painted differently with a custom delegate.

  4. #4
    Join Date
    Mar 2008
    Posts
    5
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to create something like widget box in qt designer

    I already found a simple the solution.

    If somebody else finds this widget box nice, here is how I do it:

    1. I create a QDockWidget and put a QTreeWidget in it.
    2. I set treeWidget.setRootIsDecorated(0)
    3. Then I create a QTreeWidgetItem for each widget category and call
    treeWidget.setItemWidget(item, 0, QPushButton("name", treeWidget))
    4. I add widgets into each category by creating instances of QTreeWidgetItem.

    Actually, instead of QPushButton I use MyPushButton, which is derived from QPushButton, in which I define mousePressEvent() using which I show or hide the widgets inside the category.

    This is how the result looks like:



    Quite similar to the Designer's gui, right.
    Gregor

  5. The following user says thank you to gregsan for this useful post:

    ricardo (2nd May 2009)

Similar Threads

  1. Replies: 4
    Last Post: 9th August 2007, 08:20
  2. Replies: 2
    Last Post: 12th July 2007, 09:55
  3. QFormbuilder : can not create widget of Q3ListView
    By user_mail07 in forum Qt Programming
    Replies: 5
    Last Post: 26th January 2007, 23:12
  4. How to create pop up widgets in designer.
    By gsQT4 in forum Qt Tools
    Replies: 1
    Last Post: 25th May 2006, 16:40
  5. QT4: Custom widget for QT Designer
    By Michiel in forum Qt Tools
    Replies: 4
    Last Post: 4th May 2006, 13:35

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.