Results 1 to 9 of 9

Thread: Hierarchical Table/Listview

  1. #1
    Join Date
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Hierarchical Table/Listview

    Goodmorning to all,
    I'm a newbie of qt programming with a long experience in VB6 programming. Now, I'd like to convert my knowledge to Qt to create multiplatform software.
    I've started to learn c++ and i made some small software in QT; now I'd like start the porting of a complete vb6 software to Qt. The first problem on this is the sequent: the original vb6 software use a hierarchical listview control to show two level of data (such as Invoice data and invoice details). This is a merge from treeWidget and TableWidget (or ListviewWidget).
    Collapsed, it shows only the invoice data list, then clicking on one row, it shows an other listview (with different columns, in term of type and number) that contains the invoce details.
    I've also see the example on the "C++ GUI Programming with Qt4, 2nd Edition" relative to the QRelationalSQLModel, but in that case, the example uses two control. I need to fuse those two control to one hierarchical control.
    I looked for any information but I found nothing of useful (or enought clear and simple for me).
    Could you help me? Have you got any ideas about this?

    Thanks in advance for your answers.

    Michele

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Hierarchical Table/Listview

    I think I get what you mean, and you'll need to subclass the closest component to provide the functionality you want.

    Could you post a screenshot or two to reinforce what your after however? Pictures are far easier to parse than text

    (You might even be able to do it using a data model and view)

  3. #3
    Join Date
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hierarchical Table/Listview

    This are two picture that I hope could you understand better what I need. Sorry for confusing description, probably my english isn't perfect too. I try to explain again.
    As you see in tables.png picutre, I've two tables; one of these contain a foreign key for the primary key of the other one. Now, I'd obtain the view in hierarchical_listview.png: filling the view with hierarchical data, selecting one row, i can display the dependent data directly from the view, opening another view (with different columns for number and type) to show the "details data". The classical example is Invoice (for the "master" table) and Invoice detail (for the "slave" table).
    If you have any ideas about this, could you send me any example? As I sayd, I'm not as expert in QT as in vb6

    Thanks in advance for your help.

    Michele
    Attached Images Attached Images

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

    Default Re: Hierarchical Table/Listview

    Can't you just use a tree view? It seems it would do what you want just without that hideous look of tables extending past the end of the parent tree.
    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.


  5. #5
    Join Date
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hierarchical Table/Listview

    Mmm peraphs it could be a solution, but, the treeview give the same columns for parent and child items isn'it? Or I can change? Otherwise, is it possible create a Listview (or table view) as treeviewItem? I looked for something about this, but I didn't find something useful.

    Could you show me an example of your idea?

    Thanks in advance for your help.

    Michele

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

    Default Re: Hierarchical Table/Listview

    Quote Originally Posted by cia.michele View Post
    Mmm peraphs it could be a solution, but, the treeview give the same columns for parent and child items isn'it?
    Yes, so?

    Or I can change?
    No.

    Otherwise, is it possible create a Listview (or table view) as treeviewItem?
    Not really.
    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.


  7. #7
    Join Date
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hierarchical Table/Listview

    [QUOTE=wysota;124934]Yes, so?
    So I need obtain the view in herarchical_table.png, with de slave item grouped in an inner table with different columns.

    How can obtain this?

    Thanks for your help

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

    Default Re: Hierarchical Table/Listview

    The same way you would do this with SQL. The most obvious way is to make a join of both tables. You can also set two headers for the table - one for each table.
    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.


  9. #9
    Join Date
    Oct 2009
    Posts
    65
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Hierarchical Table/Listview

    Ok I know how make a join between the two tables, and I can learn how to set-up the QSqlRelationalModel (it is the most correct in this case isn't it?), but, who i set two headers to the same table? and then, I could select the row from both of different level? Could you show me a small examples?

    Thanks for your time.

    Michele

Similar Threads

  1. hierarchical model in a flat view
    By gniking in forum Qt Programming
    Replies: 4
    Last Post: 10th November 2009, 20:17
  2. Saving hierarchical structures of data.
    By psih128 in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2009, 08:33

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.