void PlayableProxyModel::setSourcePlayableModel( PlayableModel* sourceModel ) { if ( m_model ) { disconnect( m_model, SIGNAL( loadingStarted() ), this, SIGNAL( loadingStarted() ) ); disconnect( m_model, SIGNAL( loadingFinished() ), this, SIGNAL( loadingFinished() ) ); disconnect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), this, SIGNAL( itemCountChanged( unsigned int ) ) ); disconnect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), this, SLOT( onIndexPlayable( QModelIndex ) ) ); disconnect( m_model, SIGNAL( indexResolved( QModelIndex ) ), this, SLOT( onIndexResolved( QModelIndex ) ) ); disconnect( m_model, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), this, SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) ); disconnect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), this, SLOT( expandRequested( QPersistentModelIndex ) ) ); disconnect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), this, SLOT( selectRequested( QPersistentModelIndex ) ) ); } m_model = sourceModel; if ( m_model ) { connect( m_model, SIGNAL( loadingStarted() ), SIGNAL( loadingStarted() ) ); connect( m_model, SIGNAL( loadingFinished() ), SIGNAL( loadingFinished() ) ); connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SIGNAL( itemCountChanged( unsigned int ) ) ); connect( m_model, SIGNAL( indexPlayable( QModelIndex ) ), SLOT( onIndexPlayable( QModelIndex ) ) ); connect( m_model, SIGNAL( indexResolved( QModelIndex ) ), SLOT( onIndexResolved( QModelIndex ) ) ); connect( m_model, SIGNAL( currentIndexChanged( QModelIndex, QModelIndex ) ), SLOT( onCurrentIndexChanged( QModelIndex, QModelIndex ) ) ); connect( m_model, SIGNAL( expandRequest( QPersistentModelIndex ) ), SLOT( expandRequested( QPersistentModelIndex ) ) ); connect( m_model, SIGNAL( selectRequest( QPersistentModelIndex ) ), SLOT( selectRequested( QPersistentModelIndex ) ) ); } QSortFilterProxyModel::setSourceModel( m_model ); }
void BedItemModel::slotEdit(const QModelIndex& idx) { if (!idx.isValid()) { return; } BedItem* itm = (BedItem*) itemFromIndex(idx); Bed* bed = itm->getBed(); BedEditorDialog* dlg = new BedEditorDialog((static_cast<ProfileLogger*>(QApplication::instance()))->getMainWindow(), bed); dlg->exec(); reload(); emit selectRequest(indexFromItem(findItemForBed(bed))); }
void BedItemModel::slotCreateBedOnTop() { Bed* bed = _profile->createBed(); if (QMessageBox::Yes != QMessageBox::question((static_cast<ProfileLogger*>(QApplication::instance()))->getMainWindow(), tr("Create Bed On Top?"), tr("Create Bed On Top Of Profile?"), QMessageBox::Yes | QMessageBox::No)) { return; } BedEditorDialog* dlg = new BedEditorDialog((static_cast<ProfileLogger*>(QApplication::instance()))->getMainWindow(), bed); dlg->exec(); reload(); emit selectRequest(indexFromItem(findItemForBed(bed))); }
void BedItemModel::slotCreateBedAbove(const QModelIndex& idxBedBelow) { if (!idxBedBelow.isValid()) { return; } BedItem* bitm = (BedItem*) itemFromIndex(idxBedBelow); if (QMessageBox::Yes != QMessageBox::question((static_cast<ProfileLogger*>(QApplication::instance()))->getMainWindow(), tr("Create Bed Above?"), tr("Create Bed Above Bed %1?").arg(bitm->getBed()->getPosition()), QMessageBox::Yes | QMessageBox::No)) { return; } Bed* bed = _profile->createBed(0, bitm->getBed()->getPosition()); BedEditorDialog* dlg = new BedEditorDialog((static_cast<ProfileLogger*>(QApplication::instance()))->getMainWindow(), bed); dlg->exec(); reload(); emit selectRequest(indexFromItem(findItemForBed(bed))); }
void BedItemModel::slotDuplicateAndInsertOnTop(const QModelIndex& idx) { if (!idx.isValid()) { return; } BedItem* itm = (BedItem*) itemFromIndex(idx); if (!itm) { return; } Bed* src = itm->getBed(); if (!src) { return; } if (QMessageBox::Yes != QMessageBox::question((static_cast<ProfileLogger*>(QApplication::instance()))->getMainWindow(), tr("Duplicate Bed and insert at top?"), tr("Duplicate bed %1 and insert at top?").arg(src->getPosition()), QMessageBox::Yes | QMessageBox::No)) { return; } Bed* bed = _profile->copyBed(src); /* Bed* bed = _profile->createBed(); bed->getHeight()->setValue(src->getHeight()->getValue()); bed->getHeight()->setUnit(src->getHeight()->getUnit()); bed->setName(src->getName()); bed->setLithology(src->getLithology()); bed->setBaseCarbonateGrainSize(src->getBaseCarbonateGrainSize()); bed->setBaseClasticGrainSize(src->getBaseClasticGrainSize()); bed->setBeddingType(src->getBeddingType()); bed->setColor(src->getColor()); bed->setDescription(src->getDescription()); bed->setFacies(src->getFacies()); bed->setGrainSizeMode(src->getGrainSizeMode()); bed->setOutcropQuality(src->getOutcropQuality()); bed->setTopBoundaryType(src->getTopBoundaryType()); bed->setTopCarbonateGrainSize(src->getTopCarbonateGrainSize()); bed->setTopClasticGrainSize(src->getTopClasticGrainSize()); for (QList<Fossil*>::iterator it = src->getFirstFossil(); it != src->getLastFossil(); it++) { bed->addFossil(*it); } for (QList<SedimentStructure*>::iterator it = src->getFirstSedimentStructure(); it != src->getLastSedimentStructure(); it++) { bed->addSedimentStructure(*it); } for (QList<CustomSymbol*>::iterator it = src->getFirstCustomSymbol(); it != src->getLastCustomSymbol(); it++) { bed->addCustomSymbol(*it); } */ BedEditorDialog* dlg = new BedEditorDialog((static_cast<ProfileLogger*>(QApplication::instance()))->getMainWindow(), bed); dlg->exec(); reload(); emit selectRequest(indexFromItem(findItemForBed(bed))); }
void aListView::select() { emit (selectRequest(parentItem)); }
void PlayableProxyModel::selectRequested( const QPersistentModelIndex& idx ) { emit selectRequest( QPersistentModelIndex( mapFromSource( idx ) ) ); }