Results 1 to 3 of 3

Thread: QComboBox -> setModel -> Strange behaviour

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2007
    Posts
    31
    Thanked 1 Time in 1 Post

    Default QComboBox -> setModel -> Strange behaviour

    Hi,

    If I associate a QComboBox to a table with setModel, then I can only manually add one item to this combobox. If I add 2 items, only one empty item appears at the end of the list.
    How can I do? (I don't want to put the missing items into the database, I want them to be added dynamically).

    Here is the source code:

    Qt Code:
    1. myModel = new QSqlRelationalTableModel();
    2. myModel->setTable("woundType");
    3. myModel->select();
    4. typeCbx->setModel(myModel);
    5. typeCbx->setModelColumn(2);
    6. typeCbx->insertItem(2, QString(""));
    7. typeCbx->addItem(QString("Ajout/Modification/Suppression"));
    8. typeCbx->addItem(QString("Others")); //if I add this item, only one empty line appears at the end of the combobox
    To copy to clipboard, switch view to plain text mode 

    Thanks for yout help
    Regards,
    Oscar
    Last edited by jpn; 13th August 2008 at 14:41. Reason: missing [code] tags

Similar Threads

  1. qinputdialog strange behaviour
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 11th May 2008, 19:29
  2. very strange behaviour
    By regix in forum Qt Programming
    Replies: 23
    Last Post: 20th July 2006, 17:38
  3. QComboBox +SUSE10.0 +qt4.1 strange behavior
    By antonio.r.tome in forum Qt Programming
    Replies: 6
    Last Post: 20th March 2006, 17:49
  4. Replies: 1
    Last Post: 26th February 2006, 05:52
  5. [Qt 4.1] Strange behaviour with QTableView
    By fane in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2006, 06:17

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.