Results 1 to 2 of 2

Thread: Adding items to a QTableWidget from a QComboBox

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

    Default Adding items to a QTableWidget from a QComboBox

    Hello everyone, I'm a newbie in Qt and so, I have no idea of how to do this.

    The thing is I have a QComboBox with 3 items, and depending on what I choose it has to create a different table, i.e for option 1 the table will contain 2 rows, option 2 will contain 5 rows and option 3 will contain 20 rows.

    But that's not all, I have the empty Table and a button to add items, when you click a QDialog asks for the price, residual value and the type which is the Combo Box.

    based on the type I have to make the table so the question should be, how do I read the type from the combo box and based on that make the table because on each option the size of the table will be different.

    Thanks in advance and sorry if I'm not clear enough

    Capture.PNG

  2. #2
    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: hello...

    I don't know if I get you right, but simply make getters for all values you need from that dialog. Then after accepting, you can retrieve the values and based on that you can build the table. Google for "getters and setters C++" for more info.

Similar Threads

  1. QComboBox extremely slow on adding a lot of items
    By Buldozer in forum Qt Programming
    Replies: 2
    Last Post: 24th September 2013, 11:54
  2. Adding popup menu to QComboBox
    By squidge in forum Qt Programming
    Replies: 1
    Last Post: 10th November 2009, 06:18
  3. adding items in qtablewidget
    By Djony in forum Qt Programming
    Replies: 17
    Last Post: 24th November 2006, 11:03
  4. Adding QComboBox to QTableWidget very slow
    By munna in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2006, 16:45
  5. [QT3] QComboBox: Disable adding items on Enter-keypress
    By BrainB0ne in forum Qt Programming
    Replies: 7
    Last Post: 14th January 2006, 20:43

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.