Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e0599c6064
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (22 sloc) 0.823 kb
#include <QtGui>
#include <iostream>
#include "main.h"
Qt::ItemFlags CheckBoxModel::flags(const QModelIndex& index) const
{
//return Qt::ItemIsUserCheckable;
std::cout << "Set flags." << std::endl;
return QStandardItemModel::flags(index) | Qt::ItemIsUserCheckable;
}
MainWindow::MainWindow(QMainWindow* parent) : QMainWindow(parent)
{
setupUi(this);
checkboxModel = new CheckBoxModel;
QStandardItem* item = new QStandardItem;
item->setText("test");
item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
item->setData(Qt::Unchecked, Qt::CheckStateRole);
checkboxModel->insertRow(0, item);
//std::cout << comboBox->model()->rowCount() << " rows before." << std::endl;
this->comboBox->setModel(checkboxModel);
std::cout << comboBox->model()->rowCount() << " rows after." << std::endl;
}
Jump to Line
Something went wrong with that request. Please try again.