Results 1 to 1 of 1

Thread: Tristate Flag ignored in QListWidgetItem

  1. #1

    Default Tristate Flag ignored in QListWidgetItem

    I trying to make a QListWidget which contain items which is checkable and they have tristate.
    I set flag Qt::ItemIsTristate on items but when running program it is still possible to set them only in two state Qt::Checked or Qt::Unchecked by clicking on item.

    I try to do this in this way:

    Qt Code:
    1. void step1display::addProductItem(QString programName, QString data, bool status)
    2. {
    3. QListWidgetItem *newItem = new QListWidgetItem(programName, ui.listProgramsAll, 0);
    4. newItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate);
    5. newItem->setData(32, data);
    6. if (status) {
    7. newItem->setCheckState(Qt::PartiallyChecked);
    8. }
    9. else {
    10. newItem->setCheckState(Qt::Unchecked);
    11. }
    12. ui.listProgramsAll->addItem(newItem);
    13. }
    To copy to clipboard, switch view to plain text mode 

    Is it this way, which I use to do this, wrong or it is something else?
    Last edited by ghoust26; 16th April 2008 at 11:34.

Similar Threads

  1. Check Box problem
    By Seema Rao in forum Qt Programming
    Replies: 6
    Last Post: 30th November 2007, 20:32

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.