本文整理汇总了C++中QAbstractItemModel::disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractItemModel::disconnect方法的具体用法?C++ QAbstractItemModel::disconnect怎么用?C++ QAbstractItemModel::disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractItemModel
的用法示例。
在下文中一共展示了QAbstractItemModel::disconnect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refreshJsonTree
void JsonEditorMain::refreshJsonTree()
{
if (!ui->jsonCode->document()->isEmpty())
{
QByteArray ss = ui->jsonCode->toPlainText().toLocal8Bit();
std::string json = ui->jsonCode->toPlainText().toStdString();
Json::Reader jsonReader;
jsonValue.clear();
jsonReader.parse(ss.data(), jsonValue);
QStringList headers;
headers << treeViewColumnKey << treeViewColumnValue << treeViewColumnType;
QAbstractItemModel *oldModel = ui->jsonTree->model();
if (oldModel != NULL)
oldModel->disconnect(SIGNAL(dataChanged(QModelIndex,QModelIndex)));
JsonTreeModel *model = new JsonTreeModel(headers, jsonValue);
QItemSelectionModel *selectionModel = ui->jsonTree->selectionModel();
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(treeViewDataChanged()));
ui->jsonTree->setModel(model);
ui->jsonTree->reset();
delete selectionModel;
delete oldModel;
ui->jsonTree->expandAll();
for (int i = 0; i < ui->jsonTree->model()->columnCount(); i++)
ui->jsonTree->resizeColumnToContents(i);
}
}
示例2: setSourceModel
// *** TreeChainsawFilter ***
void TreeChainsawFilter::setSourceModel(QAbstractItemModel *sourceModel)
{
QAbstractItemModel* oldSource = this->sourceModel();
if (oldSource)
oldSource->disconnect(this);
QAbstractProxyModel::setSourceModel(sourceModel);
connect(sourceModel, SIGNAL(modelReset()), this, SLOT(resetInternalData()));
sort(0, Qt::AscendingOrder);
}
示例3: setSource
void BooksCoverModel::setSource(QObject* aSrc)
{
QAbstractItemModel* oldM = sourceModel();
if (aSrc != oldM) {
const int oldCount = count();
if (oldM) {
BooksShelf* oldShelf = qobject_cast<BooksShelf*>(oldM);
if (oldShelf) {
const int n = oldShelf->count();
for (int i=0; i<n; i++) {
onBookRemoved(oldShelf->bookAt(i));
}
}
oldM->disconnect(this);
}
if (aSrc) {
QAbstractItemModel* newM = qobject_cast<QAbstractItemModel*>(aSrc);
if (newM) {
setSourceModel(newM);
BooksShelf* newShelf = qobject_cast<BooksShelf*>(newM);
if (newShelf) {
const int n = newShelf->count();
for (int i=0; i<n; i++) {
onBookAdded(newShelf->bookAt(i));
}
connect(newShelf,
SIGNAL(bookAdded(BooksBook*)),
SLOT(onBookAdded(BooksBook*)));
connect(newShelf,
SIGNAL(bookRemoved(BooksBook*)),
SLOT(onBookRemoved(BooksBook*)));
}
connect(newM,
SIGNAL(rowsInserted(QModelIndex,int,int)),
SIGNAL(countChanged()));
connect(newM,
SIGNAL(rowsRemoved(QModelIndex,int,int)),
SIGNAL(countChanged()));
connect(newM,
SIGNAL(modelReset()),
SIGNAL(countChanged()));
} else {
HDEBUG("unexpected source" << aSrc);
setSourceModel(NULL);
}
} else {
setSourceModel(NULL);
}
if (oldCount != count()) {
Q_EMIT countChanged();
}
}
}
示例4:
/**
* @brief MainWindow::setDocumentModel
*
* Will be called whe a new q2d::Project is created, to link the projects
* document model with the appropriate list view in the UI.
* @param model
*/
void
MainWindow::slot_setDocumentModel(QStandardItemModel* model) {
// close all tabs related to the old model
m_ui->schematicsTabWidget->clear();
QListView* documentView = m_ui->documentListView;
documentView->clearSelection();
QAbstractItemModel* oldModel = documentView->model();
m_ui->documentListView->setModel(model);
if (oldModel != nullptr) {
oldModel->disconnect();
oldModel->deleteLater();
}
}
示例5: removeTable
void ChartProxyModel::removeTable(Table *table)
{
QAbstractItemModel *model = table->model();
model->disconnect(this);
}