CloneTasksDialog::CloneTasksDialog(QWidget *parent) : QDialog(parent) { setupUi(this); setWindowTitle(tr("Download tasks")); setWindowIcon(QIcon(":/images/seafile.png")); setMinimumSize(QSize(600, 300)); createEmptyView(); table_ = new CloneTasksTableView; model_ = new CloneTasksTableModel(this); table_->setModel(model_); stack_ = new QStackedWidget; stack_->insertWidget(INDEX_EMPTY_VIEW, empty_view_); stack_->insertWidget(INDEX_TASKS_VIEW, table_); QVBoxLayout *vlayout = (QVBoxLayout *)layout(); vlayout->insertWidget(0, stack_); mClearBtn->setToolTip(tr("remove all successful tasks")); connect(mClearBtn, SIGNAL(clicked()), model_, SLOT(clearSuccessfulTasks())); onModelReset(); connect(model_, SIGNAL(modelReset()), this, SLOT(onModelReset())); }
// TODO: There are lots of common logic used in FileBrowserDialog and // SyncErrorsDialog. We should refactor out a base dialog class. SyncErrorsDialog::SyncErrorsDialog(QWidget *parent) : QDialog(parent) { // setupUi(this); setWindowTitle(tr("File Sync Errors")); setWindowIcon(QIcon(":/images/seafile.png")); Qt::WindowFlags flags = (windowFlags() & ~Qt::WindowContextHelpButtonHint & ~Qt::Dialog) | Qt::Window | Qt::WindowSystemMenuHint | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint; setWindowFlags(flags); createEmptyView(); table_ = new SyncErrorsTableView; model_ = new SyncErrorsTableModel(this); table_->setModel(model_); QWidget* widget = new QWidget; widget->setObjectName("mainWidget"); QVBoxLayout* layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); setLayout(layout); layout->addWidget(widget); QVBoxLayout *vlayout = new QVBoxLayout; vlayout->setContentsMargins(1, 0, 1, 0); vlayout->setSpacing(0); widget->setLayout(vlayout); stack_ = new QStackedWidget; stack_->insertWidget(INDEX_EMPTY_VIEW, empty_view_); stack_->insertWidget(INDEX_TABE_VIEW, table_); stack_->setContentsMargins(0, 0, 0, 0); vlayout->addWidget(stack_); onModelReset(); connect(model_, SIGNAL(modelReset()), this, SLOT(onModelReset())); }
void TreeProxyModel::setSourcePlayableModel( TreeModel* model ) { if ( m_model ) { disconnect( m_model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( onRowsInserted( QModelIndex, int, int ) ) ); disconnect( m_model, SIGNAL( modelReset() ), this, SLOT( onModelReset() ) ); } PlayableProxyModel::setSourcePlayableModel( model ); m_model = model; if ( m_model ) { connect( m_model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onRowsInserted( QModelIndex, int, int ) ) ); connect( m_model, SIGNAL( modelReset() ), SLOT( onModelReset() ) ); } }
void FirehoseView::setModel( QAbstractItemModel* p ) { model = p; model->setParent( this ); connect( model, SIGNAL(rowsInserted( QModelIndex, int, int )), SLOT(onRowInserted()) ); connect( model, SIGNAL(modelReset()), SLOT(onModelReset()) ); connect( timer, SIGNAL(finished()), model, SLOT(prune()) ); }
void TreeProxyModel::setSourceTreeModel( TreeModel* sourceModel ) { m_model = sourceModel; if ( m_model ) { if ( m_model->metaObject()->indexOfSignal( "trackCountChanged(uint)" ) > -1 ) connect( m_model, SIGNAL( trackCountChanged( unsigned int ) ), SIGNAL( sourceTrackCountChanged( unsigned int ) ) ); connect( m_model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onRowsInserted( QModelIndex, int, int ) ) ); connect( m_model, SIGNAL( modelReset() ), SLOT( onModelReset() ) ); } QSortFilterProxyModel::setSourceModel( sourceModel ); }
void QgsLayerTreeView::setModel( QAbstractItemModel* model ) { if ( !qobject_cast<QgsLayerTreeModel*>( model ) ) return; connect( model, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SLOT( modelRowsInserted( QModelIndex, int, int ) ) ); connect( model, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SLOT( modelRowsRemoved() ) ); QTreeView::setModel( model ); connect( layerTreeModel()->rootGroup(), SIGNAL( expandedChanged( QgsLayerTreeNode*, bool ) ), this, SLOT( onExpandedChanged( QgsLayerTreeNode*, bool ) ) ); connect( selectionModel(), SIGNAL( currentChanged( QModelIndex, QModelIndex ) ), this, SLOT( onCurrentChanged() ) ); connect( layerTreeModel(), SIGNAL( modelReset() ), this, SLOT( onModelReset() ) ); updateExpandedStateFromNode( layerTreeModel()->rootGroup() ); }
//----------------------------------------------------------------------------- void ctkModelTester::setModel(QAbstractItemModel *_model) { CTK_D(ctkModelTester); if (d->Model) { // disconnect d->Model->disconnect(this); d->AboutToBeInserted.clear(); d->AboutToBeRemoved.clear(); d->LayoutAboutToBeChanged.clear(); } if (_model) { connect(_model, SIGNAL(columnsAboutToBeInserted(const QModelIndex &, int, int)), this, SLOT(onColumnsAboutToBeInserted(const QModelIndex& , int, int))); connect(_model, SIGNAL(columnsAboutToBeRemoved(const QModelIndex &, int, int)), this, SLOT(onColumnsAboutToBeRemoved(const QModelIndex& , int, int))); connect(_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)), this, SLOT(onColumnsInserted(const QModelIndex& , int, int))); connect(_model, SIGNAL(columnsRemoved(const QModelIndex &, int, int)), this, SLOT(onColumnsRemoved(const QModelIndex& , int, int))); connect(_model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), this, SLOT(onDataChanged(const QModelIndex& , const QModelIndex &))); connect(_model, SIGNAL(layoutAboutToBeChanged()), this, SLOT(onLayoutAboutToBeChanged())); connect(_model, SIGNAL(layoutChanged()), this, SLOT(onLayoutChanged())); connect(_model, SIGNAL(modelAboutToBeReset()), this, SLOT(onModelAboutToBeReset())); connect(_model, SIGNAL(modelReset()), this, SLOT(onModelReset())); connect(_model, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)), this, SLOT(onRowsAboutToBeInserted(const QModelIndex& , int, int))); connect(_model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), this, SLOT(onRowsAboutToBeRemoved(const QModelIndex& , int, int))); connect(_model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(onRowsInserted(const QModelIndex& , int, int))); connect(_model, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), this, SLOT(onRowsRemoved(const QModelIndex& , int, int))); } d->Model = _model; this->testModel(); }
TextDocumentStructureModel::TextDocumentStructureModel(QObject *parent) : QAbstractItemModel(parent) { connect(this, SIGNAL(modelReset()), SLOT(onModelReset())); }