Results 1 to 2 of 2

Thread: Ubuntu 13.10 - cant make ComboBox with checkable items

  1. #1
    Join Date
    Mar 2014
    Posts
    7
    Thanks
    1
    Qt products
    Qt5

    Default Ubuntu 13.10 - cant make ComboBox with checkable items

    Hello, I discovered some problem with make ComboBox with checkable items.
    I have used simple code from http://stackoverflow.com/questions/8...of-checkboxes:

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char** argv)
    4. {
    5. QApplication app(argc, argv);
    6.  
    7. QStandardItemModel model(3, 1); // 3 rows, 1 col
    8. for (int r = 0; r < 3; ++r)
    9. {
    10. QStandardItem* item = new QStandardItem(QString("Item %0").arg(r));
    11.  
    12. item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
    13. item->setData(Qt::Unchecked, Qt::CheckStateRole);
    14.  
    15. model.setItem(r, 0, item);
    16. }
    17.  
    18. QComboBox* combo = new QComboBox();
    19. combo->setModel(&model);
    20.  
    21. QListView* list = new QListView();
    22. list->setModel(&model);
    23.  
    24. QTableView* table = new QTableView();
    25. table->setModel(&model);
    26.  
    27. QWidget container;
    28. QVBoxLayout* containerLayout = new QVBoxLayout();
    29. container.setLayout(containerLayout);
    30. containerLayout->addWidget(combo);
    31. containerLayout->addWidget(list);
    32. containerLayout->addWidget(table);
    33.  
    34. container.show();
    35.  
    36. return app.exec();
    37. }
    To copy to clipboard, switch view to plain text mode 

    Its generate sample treeview, tableview and combobox view with checkable items.
    It works well under windos.

    But i compiled it under ubuntu (13.10) and there is a problem wich combo box - the
    items are greyed, unable to clik and without the checkbox.

    Is there a possibility to make it working uner Ubuntu?

  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: Ubuntu 13.10 - cant make ComboBox with checkable items

    I've tested this Qt4 on Linux with several styles and it work with others but cleanlooks.

    You can try yourself, for example
    Qt Code:
    1. programname -style plastique
    To copy to clipboard, switch view to plain text mode 

    Interestingly, if I set the list view as the combobox view
    Qt Code:
    1. combo->setView(new QListView);
    To copy to clipboard, switch view to plain text mode 
    I get checkable items, but clickingan item does not close the popup.

    With Qt5 I get the behavior with all styles.

    Perhaps something to search the bug database for.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    wyder (22nd March 2014)

Similar Threads

  1. Making QTreeView Items Checkable
    By JimDaniel in forum Qt Programming
    Replies: 4
    Last Post: 30th January 2020, 17:43
  2. Replies: 4
    Last Post: 31st March 2010, 12:48
  3. Combobox with checkable items
    By qtneuling in forum Qt Programming
    Replies: 1
    Last Post: 5th July 2008, 15:42
  4. checkable items in QTableView
    By cgorac in forum Qt Programming
    Replies: 6
    Last Post: 11th March 2008, 23:45
  5. QDirModel+QTreeView and checkable items
    By L.Marvell in forum Qt Programming
    Replies: 7
    Last Post: 11th May 2007, 19:54

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.