コード例 #1
0
void BtModuleTextModel::setHighlightWords(const QString& highlightWords) {
    beginResetModel();
    m_highlightWords = highlightWords;
    endResetModel();
}
コード例 #2
0
void FormGenBagModel::clear()
{
    beginResetModel();
    mItems.clear();
    endResetModel();
}
コード例 #3
0
void djvFileBrowserModel::modelUpdate()
{
    if (_p->path.isEmpty())
        return;

    //DJV_DEBUG("djvFileBrowserModel::modelUpdate");
    //DJV_DEBUG_PRINT("path = " << _p->path);

    beginResetModel();
    
    _p->listTmp = _p->list;
    
    // File sequence directory contents.

    //djvFileInfoUtil::compressSequence(_p->listTmp, _p->seq);

    // Filter directory contents.

    if (_p->filterText.length() > 0 || !_p->showHidden)
    {
        const djvFileInfoUtil::FILTER filter =
            !_p->showHidden ?
            djvFileInfoUtil::FILTER_HIDDEN :
            djvFileInfoUtil::FILTER_NONE;

        djvFileInfoUtil::filter(_p->listTmp, filter, _p->filterText);
    }

    // Sort directory contents.

    djvFileInfoUtil::SORT sort = static_cast<djvFileInfoUtil::SORT>(0);

    switch (_p->sort)
    {
        case NAME:        sort = djvFileInfoUtil::SORT_NAME; break;
        case SIZE:        sort = djvFileInfoUtil::SORT_SIZE; break;
#if ! defined(DJV_WINDOWS)
        case USER:        sort = djvFileInfoUtil::SORT_USER; break;
#endif
        case PERMISSIONS: sort = djvFileInfoUtil::SORT_PERMISSIONS; break;
        case TIME:        sort = djvFileInfoUtil::SORT_TIME; break;

        default: break;
    }

    djvFileInfoUtil::sort(_p->listTmp, sort, _p->reverseSort);

    if (_p->sortDirsFirst)
    {
        djvFileInfoUtil::sortDirsFirst(_p->listTmp);
    }
    
    _p->items.clear();
    
    for (int i = 0; i < _p->listTmp.count(); ++i)
    {
        _p->items += djvFileBrowserItem(_p->listTmp[i]);
    }
    
    endResetModel();
}
コード例 #4
0
void ScheduleModel::setTimes(const QVector<QPair<QDateTime, QDateTime> > &times)
{
    beginResetModel();    
    m_times = times;
    endResetModel();
}
コード例 #5
0
ファイル: TablaModelInfo.cpp プロジェクト: Teide2/teide2
 void TablaModelInfo::setCurrencyMap(QString * &map)   // cuando modifiquemos la matriz
 {
    beginResetModel();
    distances = map;
    endResetModel();     
 }
コード例 #6
0
void SnippetsTableModel::restoreRemovedBuiltInSnippets()
{
    beginResetModel();
    m_collection->restoreRemovedSnippets(m_activeGroupId);
    endResetModel();
}
コード例 #7
0
ファイル: AdHocBoundsModel.cpp プロジェクト: kammoh/kactus2
//-----------------------------------------------------------------------------
// Function: AdHocBoundsModel::setConnection()
//-----------------------------------------------------------------------------
void AdHocBoundsModel::setConnection(HWConnection* connection)
{
    connection_ = connection;
    beginResetModel();
    endResetModel();
}
コード例 #8
0
ファイル: entrymodel.cpp プロジェクト: karagog/Gryptonite
void EntryModel::SetEntry(const Entry &e)
{
    beginResetModel();
    m_entry = e;
    endResetModel();
}
コード例 #9
0
ファイル: qgsfieldmodel.cpp プロジェクト: alexbruy/QGIS
void QgsFieldModel::updateModel()
{
  int offset = mAllowEmpty ? 1 : 0;
  if ( mLayer )
  {
    QgsFields newFields = mLayer->fields();
    if ( mFields.toList() != newFields.toList() )
    {
      // Try to handle two special cases: addition of a new field and removal of a field.
      // It would be better to listen directly to attributeAdded/attributeDeleted
      // so we would not have to check for addition/removal here.

      if ( mFields.count() == newFields.count() - 1 )
      {
        QgsFields tmpNewFields = newFields;
        tmpNewFields.remove( tmpNewFields.count() - 1 );
        if ( mFields.toList() == tmpNewFields.toList() )
        {
          // the only change is a new field at the end
          beginInsertRows( QModelIndex(), mFields.count() + offset, mFields.count() + offset );
          mFields = newFields;
          endInsertRows();
          return;
        }
      }

      if ( mFields.count() == newFields.count() + 1 )
      {
        QgsFields tmpOldFields = mFields;
        tmpOldFields.remove( tmpOldFields.count() - 1 );
        if ( tmpOldFields.toList() == newFields.toList() )
        {
          // the only change is a field removed at the end
          beginRemoveRows( QModelIndex(), mFields.count() - 1 + offset, mFields.count() - 1 + offset );
          mFields = newFields;
          endRemoveRows();
          return;
        }

        for ( int i = 0; i < newFields.count(); ++i )
        {
          if ( mFields.at( i ) != newFields.at( i ) )
          {
            QgsFields tmpOldFields = mFields;
            tmpOldFields.remove( i );
            if ( tmpOldFields.toList() != newFields.toList() )
              break; // the change is more complex - go with general case

            // the only change is a field removed at index i
            beginRemoveRows( QModelIndex(), i + offset, i + offset );
            mFields = newFields;
            endRemoveRows();
            return;
          }
        }
      }

      // general case with reset - not good - resets selections
      beginResetModel();
      mFields = mLayer->fields();
      endResetModel();
    }
    else
      emit dataChanged( index( 0 + offset, 0 ), index( rowCount(), 0 ) );
  }
  else
  {
    beginResetModel();
    mFields = QgsFields();
    endResetModel();
  }
}
コード例 #10
0
ファイル: ItemIndexTableModel.cpp プロジェクト: Tobulus/oscar
void oscar_gui::ItemIndexTableModel::setStore(const liboscar::Static::OsmKeyValueObjectStore& store) {
	emit beginResetModel();
	m_store  = store;
	m_nameTagId = m_store.keyStringTable().find("name");
	emit endResetModel();
}
コード例 #11
0
void ConnectionTesterModel::onStarted()
{
    beginResetModel();
    m_rows.clear();
    endResetModel();
}
コード例 #12
0
ファイル: ItemIndexTableModel.cpp プロジェクト: Tobulus/oscar
void oscar_gui::ItemIndexTableModel::setIndex(const sserialize::ItemIndex& idx) {
	emit beginResetModel();
	m_idx = idx;
	emit endResetModel();
}
コード例 #13
0
ファイル: TaskModelAdapter.cpp プロジェクト: abitduck/Charm
void TaskModelAdapter::resetTasks()
{
    beginResetModel();
    endResetModel();
}
コード例 #14
0
ファイル: ServerTreeModel.hpp プロジェクト: FlibbleMr/neoirc
			void end_refresh()
			{
				endRemoveRows();
				beginResetModel();
				endResetModel();
			}
コード例 #15
0
void MetaInfoModel::editItem(const QModelIndex &index, QWidget *parent)
{
	bool ok = false;
	int val = -1;
	QStringList generes(QString("(%1)").arg(tr("Unspecified")));
	QString temp;

	QInputDialog input(parent);
	input.setOkButtonText(tr("OK"));
	input.setCancelButtonText(tr("Cancel"));
	input.setTextEchoMode(QLineEdit::Normal);

	switch(index.row() + m_offset)
	{
	case 5:
		input.setWindowTitle(tr("Edit Title"));
		input.setLabelText(EXPAND(tr("Please enter the title for this file:")));
		input.setTextValue(m_metaInfo->title());
		if(input.exec() != 0)
		{
			temp = input.textValue().simplified();
			if(temp.isEmpty())
			{
				QMessageBox::warning(parent, tr("Edit Title"), tr("The title must not be empty. Generating title from file name!"));
				temp = QFileInfo(m_fullInfo->filePath()).completeBaseName().replace("_", " ").simplified();
				int index = temp.lastIndexOf(" - ");
				if(index >= 0) temp = temp.mid(index + 3).trimmed();
			}
			beginResetModel();
			m_metaInfo->setTitle(temp.isEmpty() ? QString() : temp);
			endResetModel();
		}
		break;
	case 6:
		input.setWindowTitle(tr("Edit Artist"));
		input.setLabelText(EXPAND(tr("Please enter the artist for this file:")));
		input.setTextValue(m_metaInfo->artist());
		if(input.exec() != 0)
		{
			temp = input.textValue().simplified();
			beginResetModel();
			m_metaInfo->setArtist(temp.isEmpty() ? QString() : temp);
			endResetModel();
		}
		break;
	case 7:
		input.setWindowTitle(tr("Edit Album"));
		input.setLabelText(EXPAND(tr("Please enter the album for this file:")));
		input.setTextValue(m_metaInfo->album());
		if(input.exec() != 0)
		{
			temp = input.textValue().simplified();
			beginResetModel();
			m_metaInfo->setAlbum(temp.isEmpty() ? QString() : temp);
			endResetModel();
		}
		break;
	case 8:
		input.setWindowTitle(tr("Edit Genre"));
		input.setLabelText(EXPAND(tr("Please enter the genre for this file:")));
		for(int i = 0; g_lamexp_generes[i]; i++) generes << g_lamexp_generes[i];
		input.setComboBoxItems(generes);
		input.setTextValue(m_metaInfo->genre());
		if(input.exec() != 0)
		{
			temp = input.textValue().simplified();
			beginResetModel();
			m_metaInfo->setGenre((temp.isEmpty() || !temp.compare(generes.at(0), Qt::CaseInsensitive)) ? QString() : temp);
			endResetModel();
		}
		break;
	case 9:
		input.setWindowTitle(tr("Edit Year"));
		input.setLabelText(EXPAND(tr("Please enter the year for this file:")));
		input.setIntRange(0, 2100);
		input.setIntValue((m_metaInfo->year() ? m_metaInfo->year() : 1900));
		input.setIntStep(1);
		if(input.exec() != 0)
		{
			val = input.intValue();
			beginResetModel();
			m_metaInfo->setYear(val);
			endResetModel();
		}
		break;
	case 10:
		if(!m_offset)
		{
			input.setWindowTitle(tr("Edit Position"));
			input.setLabelText(EXPAND(tr("Please enter the position (track no.) for this file:")));
			input.setIntRange(0, 99);
			input.setIntValue((m_metaInfo->position() ? m_metaInfo->position() : 1));
			input.setIntStep(1);
			if(input.exec() != 0)
			{
				val = input.intValue();
				beginResetModel();
				m_metaInfo->setPosition(val);
				endResetModel();
			}
		}
		else
		{
			QStringList options;
			options << tr("Unspecified (copy from source file)") << tr("Generate from list position");
			input.setWindowTitle(tr("Edit Position"));
			input.setLabelText(EXPAND(tr("Please enter the position (track no.) for this file:")));
			input.setComboBoxItems(options);
			input.setTextValue(options.value((m_metaInfo->position() == UINT_MAX) ? 1 : 0));
			if(input.exec() != 0)
			{
				temp = input.textValue().simplified();
				beginResetModel();
				m_metaInfo->setPosition((options.indexOf(temp) == 1) ? UINT_MAX : 0);
				endResetModel();
			}
		}
		break;
	case 11:
		input.setWindowTitle(tr("Edit Comment"));
		input.setLabelText(EXPAND(tr("Please enter the comment for this file:")));
		input.setTextValue((m_metaInfo->comment().isEmpty() ? tr("Encoded with LameXP") : m_metaInfo->comment()));
		if(input.exec() != 0)
		{
			temp = input.textValue().simplified();
			beginResetModel();
			m_metaInfo->setComment(temp.isEmpty() ? QString() : temp);
			endResetModel();
		}
		break;
	default:
		QMessageBox::warning(parent, tr("Not editable"), tr("Sorry, this property of the source file cannot be edited!"));
		break;
	}
}
コード例 #16
0
ファイル: qgsfieldmodel.cpp プロジェクト: alexbruy/QGIS
void QgsFieldModel::removeExpression()
{
  beginResetModel();
  mExpression = QList<QString>();
  endResetModel();
}
コード例 #17
0
void SnippetsTableModel::load(const QString &groupId)
{
    beginResetModel();
    m_activeGroupId = groupId;
    endResetModel();
}
コード例 #18
0
void
KernelModel::update()
{
    QHash<QString, QString> installedKernelPackages = getInstalledPackages();
    QHash<QString, QString> availableKernelPackages = getAvailablePackages();

    QHash<QString, QString> allKernelPackages;
    allKernelPackages.unite( installedKernelPackages );
    QHashIterator<QString, QString> i( availableKernelPackages );
    while ( i.hasNext() )
    {
        i.next();
        allKernelPackages.insert( i.key(), i.value() );
    }

    QString runningKernel = getRunningKernel();
    QStringList ltsKernels = getLtsKernels();
    QStringList recommendedKernels = getRecommendedKernels();

    QSet<QString> modulesToInstall;
    for ( const QString& module : QStringList( installedKernelPackages.keys() ).filter( QRegularExpression( "^linux[0-9][0-9]?([0-9])-" ) ) )
    {
        QString aux = QString( module ).remove( QRegularExpression( "^linux[0-9][0-9]?([0-9])-" ) );
        modulesToInstall.insert( aux );
    }

    beginResetModel();
    m_kernels.clear();
    for ( const QString& kernel : QStringList( allKernelPackages.keys() ).filter( QRegularExpression( "^linux[0-9][0-9]?([0-9])$" ) ) )
    {
        Kernel newKernel;

        newKernel.setPackage( kernel );
        newKernel.setAvailable( availableKernelPackages.contains( kernel ) );
        newKernel.setInstalled( installedKernelPackages.contains( kernel ) );
        newKernel.setVersion( allKernelPackages.value( kernel ) );
        newKernel.setAvailableModules( QStringList( availableKernelPackages.keys() )
                                       .filter( QRegularExpression( QString( "^%1-" ).arg( kernel ) ) ) );
        if ( newKernel.isInstalled() )
        {
            newKernel.setInstalledModules( QStringList( installedKernelPackages.keys() )
                                           .filter( QRegularExpression( QString( "^%1-" ).arg( kernel ) ) ) );
        }
        else
        {
            QStringList installableModules;
            for ( const QString& module : modulesToInstall )
            {
                QString modulePackage = QString( "%1-%2" ).arg( kernel ).arg( module );
                if ( availableKernelPackages.contains( modulePackage ) )
                    installableModules << modulePackage;
            }
            newKernel.setInstalledModules( installableModules );
        }
        newKernel.setLts( ltsKernels.contains( kernel ) );
        newKernel.setRecommended( recommendedKernels.contains( kernel ) );
        newKernel.setRunning( QString::compare( runningKernel, kernel ) == 0 );

        m_kernels.append( newKernel );
    }
    endResetModel();
}
コード例 #19
0
void SnippetsTableModel::resetSnippets()
{
    beginResetModel();
    m_collection->reset(m_activeGroupId);
    endResetModel();
}
コード例 #20
0
ファイル: librarymodel.cpp プロジェクト: alorence/tym
void LibraryModel::refresh()
{
    if( ! _elementsList.exec()) {
        LOG_ERROR(QString("Unable to refresh library model : %1")
                  .arg(_elementsList.lastError().text()));
    } else {
        // Invalidate all existing ModelIndexes
        beginResetModel();

        // All items are deleted
        delete _dirMap["/"];

        // Reset the directories map and checked entries
        _dirMap.clear();

        LibraryEntry* systemRootEntry = new LibraryEntry();
        _dirMap["/"] = systemRootEntry;

        // _elementsList.size() always returns -1 on Linux, we must determine the
        // number of results manually
        int resultsCount = 0;
        while(_elementsList.next()) {
            // Helper to extract some informations from file path
            QFileInfo fileInfo(_elementsList.value(Library::FilePath).toString());
            QString filePath = fileInfo.exists() ?
                        fileInfo.canonicalPath() : fileInfo.absolutePath();

            LibraryEntry* parentDir = getLibraryNode(filePath);
            new LibraryEntry(_elementsList.record(), parentDir);
            resultsCount++;
        }
        _elementsList.finish();

        // Update _root pointer
        LibraryEntry *r = systemRootEntry;
        #ifdef Q_OS_WIN
            //: On Windows only, defines the system top level folder (above disks)
            QString path = tr("My Computer");
        #else
            QString path = "";
        #endif
        // From system root path to the first node with more than 1 children
        while(r->rowCount() == 1) {
            r = r->child(0);
            path.append(QDir::separator()).append(r->dirName());
        }
        // 'r' is the current valid root in the tree
        _root = r;

        // Update label above library view
        if(resultsCount < 1) {
            //: Used as displayed root dir when library is empty (no tracks in the database)
            emit rootPathChanged(tr("<empty>"));
        } else {
            emit rootPathChanged(path);
        }

        // Inform view that new items are stored in the model. It will
        // start te rebuild its ModelIndexes
        endResetModel();
    }
}
コード例 #21
0
ファイル: GIndiModel.cpp プロジェクト: DaoWen/gedtools
/* Notify all views that internal data is changing */
void GIndiModel::invalidateViews() {
    beginResetModel();
}
コード例 #22
0
ファイル: qstringlistmodel.cpp プロジェクト: BGmot/Qt
/*!
    Sets the model's internal string list to \a strings. The model will
    notify any attached views that its underlying data has changed.

    \sa dataChanged()
*/
void QStringListModel::setStringList(const QStringList &strings)
{
    emit beginResetModel();
    lst = strings;
    emit endResetModel();
}
コード例 #23
0
ファイル: treemodel.cpp プロジェクト: Nand-e/2to3d
/*
 * Delete All item apartf from rootItem
 * *****************************************/
void TreeModel::clearAlldata( ObjectItem * item) {
  beginResetModel();
  item->deleteChildren();
  endResetModel();
}
コード例 #24
0
void WorkPackageProxyModel::sourceModelAboutToBeReset()
{
//    kDebug(planDbg());
    beginResetModel();
    detachTasks();
}
コード例 #25
0
ファイル: filmslistmodel.cpp プロジェクト: jeka-js/alexandra
void FilmsListModel::LoadFromFile( QString fileName )
{
    DebugPrintFunc( "FilmsList::LoadFromFile", fileName );

    beginResetModel();
    rootItem->RemoveChildren();
    QFile file( fileName );

    if( !file.exists() )
    {
        isDatabaseChanged = true; // Will be created
        emit DatabaseIsEmpty();
    }
    else if( file.open( QIODevice::ReadOnly ) )
    {
        QDataStream stream( &file );
        QString databaseHeader;
        stream >> databaseHeader;

        if( databaseHeader == Alexandra::databaseHeader )
        {
            bool isLoaded;
            quint8 databaseVersion;
            stream >> databaseVersion;
            file.close();

            if( databaseVersion == Alexandra::databaseVersion )
            {
                isLoaded = FilmsListLoader::Populate( rootItem, fileName );
            }
            else
            {
                emit DatabaseConvertOld();

                isLoaded = FilmsListOldLoader::Populate( rootItem, fileName );

                if( isLoaded )
                {
                    FilmsListLoader::Save( rootItem, fileName );
                }
            }

            if( isLoaded )
            {
                DebugPrint( "Reading done!" );
                emit DatabaseLoaded();
                isReadonly = false;

                if( rootItem->GetChildrenCount() == 0 )
                {
                    emit DatabaseIsEmpty();
                }

                if( !QFileInfo(fileName).isWritable() )
                {
                    emit DatabaseIsReadonly();
                    isReadonly = true;
                }
            }
            else
            {
                emit DatabaseReadError( tr("Can't load database!") );
            }
        }
コード例 #26
0
ファイル: pricelist.cpp プロジェクト: mickele77/qcost
void PriceList::beginChangingColumns() {
    beginResetModel();
}
コード例 #27
0
void ItemProxyModel::setRootIndex( const QModelIndex &root )
{
	beginResetModel();
	m_wizards = m_model->wizards(root);
	endResetModel();
}
コード例 #28
0
 void setColorSchemes(const QList<ColorSchemeEntry> &colorSchemes)
 {
     beginResetModel();
     m_colorSchemes = colorSchemes;
     endResetModel();
 }
コード例 #29
0
void GNUnetNetworkPeersModel::onDataChanged()
{
    beginResetModel();
    endResetModel();
}
コード例 #30
0
ファイル: TablaModelT.cpp プロジェクト: Teide2/teide2
void TablaModelT::setCurrencyCabecH(QStringList &cabecH)   // cuando modifiquemos la cabecera vertical
{
    beginResetModel();
    cabeceraH = cabecH;
    endResetModel();
}