void SubmitEditorWidget::setFileModel(QAbstractItemModel *model) { d->m_ui.fileView->clearSelection(); // trigger the change signals d->m_ui.fileView->setModel(model); if (model->rowCount()) { const int columnCount = model->columnCount(); for (int c = 0; c < columnCount; c++) d->m_ui.fileView->resizeColumnToContents(c); } connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(updateSubmitAction())); connect(model, SIGNAL(modelReset()), this, SLOT(updateSubmitAction())); connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(updateCheckAllComboBox())); connect(model, SIGNAL(modelReset()), this, SLOT(updateCheckAllComboBox())); connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(updateSubmitAction())); connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(updateSubmitAction())); connect(d->m_ui.fileView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(updateDiffAction())); updateActions(); }
void SubmitEditorWidget::updateActions() { updateSubmitAction(); updateDiffAction(); updateCheckAllComboBox(); }