Results 1 to 11 of 11

Thread: Use QScrollBar and QLayout to display product catalog?

  1. #1
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Use QScrollBar and QLayout to display product catalog?

    I have 15000 products in database; my program will connect to this database and display a list of products. Each product is a Tool Button. Program layout is fluid layout, so I use QGridLayout to make fluid layout in this case.

    Somebody help me a way to make a product list with scroll bar for above case?

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Use QScrollBar and QLayout to display product catalog?

    Why do you want to have 15000 toolbuttons?
    Isn't there a better way to do this? Like a listview or treeview?
    You can add buttons to views though.

  3. #3
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Use QScrollBar and QLayout to display product catalog?

    Do you mean I can use a Tree View, and change Tree Item to button? What are methods I have to override? How to handle when use click on item to see product details?

  4. #4
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Use QScrollBar and QLayout to display product catalog?

    somebody help me, pls....

  5. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Use QScrollBar and QLayout to display product catalog?

    Quote Originally Posted by Kevin Hoang View Post
    somebody help me, pls....
    Well, QGridLayout != fluid layout! Where is your problem after all? Use QSrollArea if you want srollbars, but as tbscope said: 15000 tool buttons is ... Leonidas would say: "This is madness!"
    Better use - also as suggested - QListView with a proper model and delegate.

  6. #6
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Use QScrollBar and QLayout to display product catalog?

    Thank you...

    Can you help me what model is support for this case? I try to use setIndexWidget method, but I don't know how does it works.

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Use QScrollBar and QLayout to display product catalog?

    If you have a database in the background holding your data, I would go for a QSqlTableModel.

  8. #8
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Use QScrollBar and QLayout to display product catalog?

    I have a product table with struct like this:

    id
    langid
    catid
    fullname
    shortname
    image
    ...
    description

    So I want to display each product (each record) as a card on a category widget . Like this
    _____________________________
    |
    |
    | Product image
    |
    |
    |____________________________
    |
    | Short name (Full Name)
    |____________________________

    With QSqlTableModel, I seen it not help me do like this.

  9. #9
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Use QScrollBar and QLayout to display product catalog?

    Ehm, I will not code it for you. Have a look at the model view classes in the documentation. Also read about delegates in that content. Qt does much out of the box, but some things you must do yourself!

  10. #10
    Join Date
    Mar 2010
    Posts
    68
    Thanks
    8
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Use QScrollBar and QLayout to display product catalog?

    I do not ask you code for me. I just want to ask a fast way for my case.

  11. #11
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Use QScrollBar and QLayout to display product catalog?

    When you want to do complex specific things, there's no fast way.

    Check out this example. It will explain almost everything you need:
    http://doc.qt.nokia.com/4.6/itemviews-chart.html

Similar Threads

  1. Replies: 1
    Last Post: 19th April 2010, 11:27
  2. QScrollBar arrow display
    By sgg245 in forum Qt Programming
    Replies: 2
    Last Post: 16th February 2009, 06:57
  3. QScrollBar arrow display
    By sgg245 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th February 2009, 06:36
  4. Replies: 4
    Last Post: 5th November 2008, 18:24
  5. QScrollBar + setToolTip speed on display ... to slow
    By patrik08 in forum Qt Programming
    Replies: 5
    Last Post: 26th February 2007, 13:27

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.