Results 1 to 8 of 8

Thread: how to implement list of lists and display it

  1. #1
    Join Date
    Apr 2013
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Smile how to implement list of lists and display it

    Hello, firstly I have to tell that im absolutely beginner in Qt .
    My task is to create program which supports a shop. At the beginning i'd like to create a list of products and display it on the screen but i have no idea how to do it. There are a lots of libs and documentation is very extensive that i dont know what and HOW to use it.
    My problem on pics looks like this:
    4sHSAP9.png

    and as a result i'd like to get view like this:
    rSfyLCn.png
    Last edited by FantaZy; 21st April 2013 at 14:00.

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to implement list of lists and display it

    what you want is a tree widget (with multiple columns)

    http://doc.qt.io/qt-4.8/qtreewidget
    http://www.youtube.com/watch?v=TpkiVlOS3o4
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Apr 2013
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: how to implement list of lists and display it

    one more question, how can i save/load my whole complicated structure to file ? i've found s11n for c++ but maybe Qt involves some library ?

  4. #4
    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: how to implement list of lists and display it

    One simple way is to use QSettings, it supports most of the Qt types already.

    One other you can serialize data into XML stream and save it.
    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.

  5. #5
    Join Date
    Apr 2013
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: how to implement list of lists and display it

    Quote Originally Posted by Santosh Reddy View Post
    One simple way is to use QSettings, it supports most of the Qt types already.

    One other you can serialize data into XML stream and save it.
    im not sure that QSettings lives up my expectations because as i've read in documentation it is generally used for saving/reading application settings.
    in my case, i'd like to read/write whole data from lists etc.

  6. #6
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to implement list of lists and display it

    have you tried it?
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  7. #7
    Join Date
    Apr 2013
    Posts
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: how to implement list of lists and display it

    Quote Originally Posted by amleto View Post
    have you tried it?
    no, i've looked into documenation - http://qt-project.org/doc/qt-4.8/qsettings.html
    Useful method which I see here are beginReadArray and beginWriteArray . okei but i see i should use it.

  8. #8
    Join Date
    Sep 2011
    Posts
    1,241
    Thanks
    3
    Thanked 127 Times in 126 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to implement list of lists and display it

    and what is wrong with
    http://doc.qt.io/qt-4.8/qsettings.html#setValue
    ?

    (you can put quite a lot inside a QVariant)
    Last edited by amleto; 28th April 2013 at 00:53.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. How do I build an Integer List of Lists with QList?
    By danielperaza in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2011, 01:06
  2. [Tab play list]Load play lists on start
    By petrusPL in forum Qt Programming
    Replies: 0
    Last Post: 18th March 2011, 18:12
  3. Replies: 2
    Last Post: 11th January 2011, 13:15
  4. Replies: 4
    Last Post: 26th October 2009, 22:25
  5. display lists
    By rick_st3 in forum Newbie
    Replies: 3
    Last Post: 22nd June 2008, 23:09

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.