Results 1 to 2 of 2

Thread: How to make a dynamically created user menu with checkbox

  1. #1
    Join Date
    Feb 2013
    Posts
    71
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to make a dynamically created user menu with checkbox

    Hi, I want to make a program where the user can create his/her own menu using my program. The application pulls the options(e.g apples, oranges etc..) from a sqlite db and then places it all tidely on a grid layout/widget of some sort. I currently have the data on the db but I just need to pull and display something like apples 1 2 3 where the 1,2,3 is how much you like them and so on for bananas, oranges and whatever else is on the database.

    Whats the best widget to use to pull and display this on a UI? Can someone show me an example where you create checkboxes for each lets say newly dynamically created label on your grid layout/widget of some sort?

    Thanks in advance!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to make a dynamically created user menu with checkbox

    I think I would approach this by first creating a widget for the rating input, e.g. a simple widget with a horizontal layout and radio buttons for each level.

    If you only want to display/input ratings, then the most simple layout for the whole form is QFormLayout. You simply add rows for each fruit and a rating widget as the widget.
    If you have more data for each item, then you are probably better of with a grid layout.

    Alternatively you could go with a QTableView and implement the rating input through a delegate for the respective column.
    Given that you seem to have only started using Qt recently I would go for the widget based approach first though

    Cheers,
    _

Similar Threads

  1. Accessing Dynamically created Checkboxe
    By premroxx in forum Newbie
    Replies: 1
    Last Post: 6th November 2012, 07:14
  2. Replies: 12
    Last Post: 24th October 2011, 07:56
  3. Replies: 3
    Last Post: 11th August 2011, 17:16
  4. QTableView with User checkable checkbox
    By hamidarr in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2011, 18:16
  5. Dynamically created buttons.
    By Tomasz in forum Newbie
    Replies: 26
    Last Post: 2nd December 2010, 09:40

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.