void ChoiceSearchModel::setChecked(int i, bool checked) { m_entries[i].m_checkState = checked; QModelIndex modelIndex = index(i); emit dataChanged(modelIndex, modelIndex); emit checkStateChanged(m_entries.at(i).m_key, checked); }
bool QxtCheckComboModel::setData(const QModelIndex& index, const QVariant& value, int role) { bool ok = QStandardItemModel::setData(index, value, role); if (ok && role == Qt::CheckStateRole) { emit dataChanged(index, index); emit checkStateChanged(); } return ok; }
/*! Constructs a new QxtCheckComboBox with \a parent. */ QxtCheckComboBox::QxtCheckComboBox(QWidget* parent) : QComboBox(parent) { QXT_INIT_PRIVATE(QxtCheckComboBox); setModel(new QxtCheckComboModel(this)); connect(this, SIGNAL(activated(int)), &qxt_d(), SLOT(toggleCheckState(int))); connect(model(), SIGNAL(checkStateChanged()), &qxt_d(), SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), &qxt_d(), SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), &qxt_d(), SLOT(updateCheckedItems())); // read-only contents QLineEdit* lineEdit = new QLineEdit(this); lineEdit->setReadOnly(true); setLineEdit(lineEdit); setInsertPolicy(QComboBox::NoInsert); view()->installEventFilter(&qxt_d()); view()->window()->installEventFilter(&qxt_d()); view()->viewport()->installEventFilter(&qxt_d()); this->installEventFilter(&qxt_d()); }
/*! Constructs a new QxtCheckComboBox with \a parent. */ QxtCheckComboBox::QxtCheckComboBox(QWidget* parent) : QComboBox(parent), m_containerMousePress(false) { setModel(new QxtCheckComboModel(this)); connect(this, SIGNAL(activated(int)), this, SLOT(toggleCheckState(int))); connect(model(), SIGNAL(checkStateChanged()), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); connect(model(), SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(updateCheckedItems())); // read-only contents QLineEdit* lineEdit = new QLineEdit(this); lineEdit->setReadOnly(true); setLineEdit(lineEdit); lineEdit->disconnect(this); setInsertPolicy(QComboBox::NoInsert); view()->installEventFilter(this); view()->window()->installEventFilter(this); view()->viewport()->installEventFilter(this); this->installEventFilter(this); m_separator = QLatin1String(","); }
void TransferFunctionManager::cellChanged(int row, int col) { if (!m_tfContainer) return; if (col == 0) { QTableWidgetItem *wi; wi = m_tableWidget->item(row, col); SplineTransferFunction *tf = m_tfContainer->transferFunctionPtr(row); tf->setName(wi->text()); } else { QTableWidgetItem *wi; wi = m_tableWidget->item(row, col); m_tfContainer->setCheckState(row, col-1, wi->checkState()); bool flag = wi->checkState() == Qt::Checked; emit checkStateChanged(row, col, flag); qApp->processEvents(); } }
void QtlCheckableHeaderView::processCheckStateChanged() { updateSection(0); emit checkStateChanged(_checkState); }
void AccountItemWidget::on_checkBox_stateChanged(int state) { emit checkStateChanged(state == Qt::Checked); }