Results 1 to 2 of 2

Thread: TreeView with staggered cells and widgets in row

  1. #1
    Join Date
    Jun 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default TreeView with staggered cells and widgets in row

    Hi,
    I am trying to design a way to represent a tree like data structure that contains nodes/rows of different appearances. I attached an image of what I would like it to look like. Note: 'data' in the image means text and the tree structure is dynamic, i.e., users can add/remove nodes and change the type of a node.

    What I am trying to get is a tree where each row contains all of its data together, that is that each piece of data in the row doesn't have to align with other row's data and isn't segregated by column. Additionally, rows don't all have to have the same number of columns or same type of data in each column. Furthermore, certain rows may contain bits of editable text and/or widgets (or an emulation of a widgets behavior/functionality).
    tree.png

    From other posts it seems that the best way to go about handling widgets is just emulating them through a delegate. But what would be a good way to handle having cells in a column with inconsistent sizes and data types, and that certain rows have different number of columns?

    The solution I have thought up is just having 1 column with everything in it and then having the delegate decide if user input landed on an interactable location (i.e. a widget). This way I can easily handle rows having a different number of columns and I don't have to come up with my own implementation of QTreeView. Although, determining when user input landed in one of those interactable locations may be hard/inefficient.

    Before I begin the process of implementing this I just wanted to check if that sounds like a good solution, or if anyone knows a better way to handle something like this.

    Thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: TreeView with staggered cells and widgets in row

    I can't think of a way to handle this except using the one-column-custom-delegate method you have proposed. The standard tree model / view likes things all lined up nice and neat.

    I don't know what your application is for this, but it sounds like a pretty confusing interface for the user. Click somewhere, you can edit; click somewhere else and you can't edit, but it all just looks like text.

Similar Threads

  1. QTreeView- editable cells
    By Pawello in forum Newbie
    Replies: 1
    Last Post: 13th September 2012, 12:17
  2. Replies: 1
    Last Post: 22nd September 2011, 06:33
  3. Replies: 2
    Last Post: 12th February 2010, 04:41
  4. Non-uniform cells
    By ttvo in forum Qt Programming
    Replies: 2
    Last Post: 22nd April 2009, 19:20
  5. QTableWidget swapping rows with widgets in cells
    By dnnc in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2007, 14:11

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.