Dear fellow programmers,
I worked on a simple QTableView example that uses custom data (using a derived class of QStandardItemModel). The (downsized) core is to implement a QStandardItemModel that displays a custom data type with a std::vector<std::string>.
struct MyModel : public QStandardItemModel
{
MyModel(/* */)
for (int i=0; i!=/* */; ++i)
{
QList<QStandardItem*> items;
//Add text
{
QStandardItem * const item = new QStandardItem;
item->setCheckable(false); //NO CHECKBOX!
items.push_back(item);
}
//Only have one column for now
assert(this->columnCount() == items.size());
this->appendRow(items);
}
}
Although I explicity setCheckable to false, when I view my application, it does show checkboxes.
What did I miss?
Full code (including screenshot and full Qt Project download) at http://www.richelbilderbeek.nl/CppQTableViewExample5.htm
Thanks, Bilderbikkel
↧