Results 1 to 4 of 4

Thread: Custom QTreeWidgetItem with QSliders

  1. #1
    Join Date
    Aug 2013
    Location
    Texas, U.S.A.
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Question Custom QTreeWidgetItem with QSliders

    I have a QTreeWidget, and I want to populate it with a list of items. Each item would be just a standard one sort of like this:

    Screen Shot 2013-08-25 at 10.25.37 AM.png

    (Sorry that these came out so small)


    Ideally, upon clicking on the label ("Node 0" in this case), the item would expand to give an array of QSliders with a little set button, like this:


    Screen Shot 2013-08-25 at 10.25.49 AM.png

    As you might have guessed, this QTreeWidget is part of an interface that lets the user move objects around a scene. All interpretations aside, though, is this sort of customization feasible with QTreeWidgetItems (e.g., with setItemWidget)? Or do I need to use something like QTreeView?

    Alternatively, if anyone knows of a good example of some sort of list structure filled with custom, dynamic widgets, please provide a link.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Custom QTreeWidgetItem with QSliders

    All interpretations aside, though, is this sort of customization feasible with QTreeWidgetItems (e.g., with setItemWidget)? Or do I need to use something like QTreeView?
    Yes it is possible using QTreeWidget, but it will trun out not be trival. Also the child widgets (the sliding bars) will be offset from the left when compared to the parent item. If you have multiple columns in the QTreeWidget then will have little more work to do.

    Alternatively, if anyone knows of a good example of some sort of list structure filled with custom, dynamic widgets, please provide a link.
    Well some more information is required to make good suggestions.
    1. How many such "Node 0" are expeted (How many rows)?
    2. Can they change from some background event, or only user can change them?
    3. If some back ground event changed the slider values, do you need to update the slider values on scenn?

    One suggestion which I can make with provided information is that QTreeWidget / QTreeView may not be required, if the interface is just to change the item position/orientation in the scene. You could just make a custom widget with sliders and edit the selected item in the scene.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

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

    Default Re: Custom QTreeWidgetItem with QSliders

    Why not just use QScrollArea?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Aug 2013
    Location
    Texas, U.S.A.
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Custom QTreeWidgetItem with QSliders

    Quote Originally Posted by Santosh Reddy View Post
    1. How many such "Node 0" are expeted (How many rows)?
    2. Can they change from some background event, or only user can change them?
    3. If some back ground event changed the slider values, do you need to update the slider values on scenn?
    .
    1. That depends on how many such "nodes" happen to be present in the scene. The user will load a scene with a map, which is made up of 0 or more nodes and/or edges.
    2. Only the user can edit the node locations/orientations through this menu (at least as I envision it now).
    3. Probably not applicable due to 2., but in such an event, yes.

    This might make things a little more clear. The entire widget for editing nodes looks like this. The upper scroll area is the one I'm concerned with now:

    WholeGUI.png

Similar Threads

  1. Custom editor for derived QTreeWidgetItem in a QTreeWidget
    By olivier1978 in forum Qt Programming
    Replies: 5
    Last Post: 28th February 2013, 13:14
  2. Custom QTreeWidgetItem class and signals&slots issue
    By devla in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2012, 01:15
  3. how to set custom type data to a QTreeWidgetItem?
    By qlands in forum Qt Programming
    Replies: 2
    Last Post: 4th July 2011, 17:28
  4. Custom QTreeWidgetItem context menu?
    By AaronMK in forum Qt Programming
    Replies: 4
    Last Post: 1st February 2010, 05:42
  5. Custom controls when QTreeWidgetItem edited.
    By kubas in forum Qt Programming
    Replies: 3
    Last Post: 4th September 2009, 11:27

Tags for this Thread

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.