Hello, I discovered some problem with make ComboBox with checkable items.
I have used simple code from http://stackoverflow.com/questions/8...of-checkboxes:
#include <QtGui>
int main(int argc, char** argv)
{
for (int r = 0; r < 3; ++r)
{
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setData(Qt::Unchecked, Qt::CheckStateRole);
model.setItem(r, 0, item);
}
combo->setModel(&model);
list->setModel(&model);
table->setModel(&model);
container.setLayout(containerLayout);
containerLayout->addWidget(combo);
containerLayout->addWidget(list);
containerLayout->addWidget(table);
container.show();
return app.exec();
}
#include <QtGui>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QStandardItemModel model(3, 1); // 3 rows, 1 col
for (int r = 0; r < 3; ++r)
{
QStandardItem* item = new QStandardItem(QString("Item %0").arg(r));
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setData(Qt::Unchecked, Qt::CheckStateRole);
model.setItem(r, 0, item);
}
QComboBox* combo = new QComboBox();
combo->setModel(&model);
QListView* list = new QListView();
list->setModel(&model);
QTableView* table = new QTableView();
table->setModel(&model);
QWidget container;
QVBoxLayout* containerLayout = new QVBoxLayout();
container.setLayout(containerLayout);
containerLayout->addWidget(combo);
containerLayout->addWidget(list);
containerLayout->addWidget(table);
container.show();
return app.exec();
}
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?
Bookmarks