本文整理汇总了C++中qfileinfolist::const_iterator::absoluteFilePath方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::absoluteFilePath方法的具体用法?C++ const_iterator::absoluteFilePath怎么用?C++ const_iterator::absoluteFilePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qfileinfolist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::absoluteFilePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dir
QVector<QString> FileUtils::getAllFiles(const QString &path)
{
QVector<QString> result;
QDir dir(path);
QFileInfoList fileInfoLists = dir.entryInfoList();
QFileInfoList::const_iterator iterator = fileInfoLists.constBegin();
for(; iterator != fileInfoLists.constEnd(); iterator++)
{
QString filename = iterator->fileName();
if (!filename.startsWith("."))
{
if (iterator->isDir())
{
result += getAllFiles(iterator->absoluteFilePath());
}
else if (iterator->isFile())
{
result.push_back(iterator->absoluteFilePath());
}
else
{
//
}
}
}
return result;
}
示例2: addDirectoryToPreview
int QgsSVGDiagramFactoryWidget::addDirectoryToPreview( const QString& path )
{
//go through all files of a directory
QDir directory( path );
if ( !directory.exists() || !directory.isReadable() )
{
return 1; //error
}
QFileInfoList fileList = directory.entryInfoList( QDir::Files );
QFileInfoList::const_iterator fileIt = fileList.constBegin();
QProgressDialog progress( "Adding Icons...", "Abort", 0, fileList.size() - 1, this );
//cancel button does not seem to work properly with modal dialog
//progress.setWindowModality(Qt::WindowModal);
int counter = 0;
for ( ; fileIt != fileList.constEnd(); ++fileIt )
{
progress.setLabelText( tr( "Creating icon for file %1" ).arg( fileIt->fileName() ) );
progress.setValue( counter );
QCoreApplication::processEvents();
if ( progress.wasCanceled() )
{
break;
}
QString filePath = fileIt->absoluteFilePath();
//test if file is svg or pixel format
bool fileIsSvg = testSvgFile( filePath );
//exclude files that are not svg or image
if ( !fileIsSvg )
{
++counter; continue;
}
QListWidgetItem * listItem = new QListWidgetItem( mPreviewListWidget );
if ( fileIsSvg )
{
QIcon icon( filePath );
listItem->setIcon( icon );
}
listItem->setText( "" );
//store the absolute icon file path as user data
listItem->setData( Qt::UserRole, fileIt->absoluteFilePath() );
++counter;
}
return 0;
}
示例3: read_dir
//*******************************************************************
// read_dir PRIVATE
//-------------------------------------------------------------------
// Rekursywne odczytywanie calej zawartosci wskazanego katalogu.
// Odczytana zawrtosc katalogu jest zapamietywania w hash-tablicy.
//*******************************************************************
void QBtCompareDirsDialog::read_dir( const QString& in_parent,
const QString& in_dir,
DirMap& out_data ) const
{
static const int sflag = QDir::AllDirs
| QDir::Files
| QDir::NoDotAndDotDot
| QDir::Readable
| QDir::Writable
| QDir::Hidden;
const QDir dir( in_dir, "*", QDir::Unsorted, QFlags<QDir::Filter>( sflag ) );
const QFileInfoList items = dir.entryInfoList();
FileMap files_map = FileMap();
QFileInfoList::const_iterator it = items.begin();
const QFileInfoList::const_iterator end = items.end();
while( continue_ && ( it != end ) ) {
if( it->isDir() ) read_dir( in_parent, it->absoluteFilePath(), out_data );
else files_map.insert( it->fileName(), *it );
++it;
}
QString path = in_dir;
out_data.insert( path.remove( in_parent ), files_map );
}
示例4: setDirectory
bool SimpleSearchEngine::setDirectory(const QString &path)
{
QDir dir(path);
if(!dir.exists())
{
Log().warning("SimpleSearchEngine: set directory failed: directory doesn't"
"exist '%s'",
qPrintable(path));
return false;
}
Log().debug("SimpleSearchEngine: set directory '%s'", qPrintable(path));
QFileInfoList fileInfoList = dir.entryInfoList(
QDir::Files);
mFilenames.clear();
QFileInfoList::const_iterator iter = fileInfoList.begin();
for(; iter != fileInfoList.end(); ++iter)
mFilenames.append(iter->absoluteFilePath());
updateResults();
return true;
}
示例5: svgDirectory
//list all directories in $prefix/share/qgis/svg
foreach( QString path, QgsApplication::svgPaths() )
{
QDir svgDirectory( path );
if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
{
continue; //error
}
QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
QFileInfoList::const_iterator dirIt = directoryList.constBegin();
for ( ; dirIt != directoryList.constEnd(); ++dirIt )
{
if ( addDirectoryToPreview( dirIt->absoluteFilePath() ) == 0 )
{
mSearchDirectoriesComboBox->addItem( dirIt->absoluteFilePath() );
}
}
}
示例6: addStandardDirectoriesToPreview
void QgsComposerPictureWidget::addStandardDirectoriesToPreview()
{
mPreviewListWidget->clear();
//list all directories in $prefix/share/qgis/svg
QStringList svgPaths = QgsApplication::svgPaths();
for ( int i = 0; i < svgPaths.size(); i++ )
{
QDir svgDirectory( svgPaths[i] );
if ( !svgDirectory.exists() || !svgDirectory.isReadable() )
{
continue;
}
//add directory itself
mSearchDirectoriesComboBox->addItem( svgDirectory.absolutePath() );
addDirectoryToPreview( svgDirectory.absolutePath() );
//and also subdirectories
QFileInfoList directoryList = svgDirectory.entryInfoList( QDir::Dirs | QDir::NoDotAndDotDot );
QFileInfoList::const_iterator dirIt = directoryList.constBegin();
for ( ; dirIt != directoryList.constEnd(); ++dirIt )
{
if ( addDirectoryToPreview( dirIt->absoluteFilePath() ) == 0 )
{
mSearchDirectoriesComboBox->addItem( dirIt->absoluteFilePath() );
}
}
}
//include additional user-defined directories for images
QSettings s;
QStringList userDirList = s.value( "/Composer/PictureWidgetDirectories" ).toStringList();
QStringList::const_iterator userDirIt = userDirList.constBegin();
for ( ; userDirIt != userDirList.constEnd(); ++userDirIt )
{
addDirectoryToPreview( *userDirIt );
mSearchDirectoriesComboBox->addItem( *userDirIt );
}
mPreviewsLoaded = true;
}
示例7: update
void NowReadingEngine::update()
{
QFileInfoList okularFiles = getOkularXMLFiles();
QFileInfoList::const_iterator it = okularFiles.constBegin();
uint limit = MaxDataModelSize;
for ( ; it != okularFiles.constEnd() && limit--; ++it) {
QString okularFileName = it->absoluteFilePath();
DataModel::iterator itDm = _dataModel.find(okularFileName);
if ((itDm != _dataModel.end()) && /* We have an entry for this element */
(itDm.value().accessTime >= it->lastModified())) { /* And it's up to date */
/* No need to update */
continue;
}
NowReadingEntry entry;
if (convertOkularXMLFileToEntry(okularFileName, entry)) {
setData(entry.path, "currentPage", entry.currentPage);
setData(entry.path, "totalPages", entry.totalPages);
setData(entry.path, "accessTime", entry.accessTime);
_dataModel[okularFileName] = entry;
}
}
/* Cleanup */
if (_dataModel.size() > MaxDataModelSize) {
// Find elements to evict
// First - what is the modification time of the last element we want to preserve?
QDateTime oldestElementDate;
QList<DataModel::mapped_type> values = _dataModel.values();
nth_element(values.begin(), values.begin()+MaxDataModelSize-1, values.end());
oldestElementDate = (values.begin()+MaxDataModelSize-1)->accessTime;
// Now find all elements older than the oldest allowable
DataModel::iterator it = _dataModel.begin();
while (it != _dataModel.end()) {
if (it.value().accessTime < oldestElementDate) {
removeSource(it.value().path);
it = _dataModel.erase(it);
}
else {
++it;
}
}
}
/* Single shot timer used as in case the update takes very long
we can get overflow of timer events to handle */
QTimer::singleShot(PollingInterval, this, SLOT(update()));
}
示例8: run
void FindImageRunnable::run()
{
using std::vector;
using std::string;
using itk::GDCMSeriesFileNames;
if (m_forceFinish) {
emit finish();
return;
}
// Find Dicom files
{
// Generate a sequence of fileNames from a DICOM series
GDCMSeriesFileNames::Pointer nameGenerator = GDCMSeriesFileNames::New();
nameGenerator->SetUseSeriesDetails(true);
nameGenerator->SetDirectory(m_folderPath.toStdString().c_str());
//nameGenerator->AddSeriesRestriction("0008|0021");
nameGenerator->GetInputFileNames();
// basing on all seriesUIDs
// get file names form corresponding serires UID
try {
const vector<string>& seriesUID = nameGenerator->GetSeriesUIDs();
vector<string>::const_iterator seriesEnd = seriesUID.end();
for (vector<string>::const_iterator cit = seriesUID.cbegin();
cit != seriesUID.cend(); ++cit) {
GDCImageIORead(nameGenerator->GetFileNames(*cit));
}
}
catch (itk::ExceptionObject& e) {
qDebug() << e.what();
}
}
//Find Nifti file
{
QStringList filterList;
filterList << "*.nii" << "*.nii.gz";
QDir dir(m_folderPath);
QFileInfoList niiFileList = dir.entryInfoList(filterList);
// basing on wildcard to find out all NIFTI files
for (QFileInfoList::const_iterator cit = niiFileList.cbegin();
cit != niiFileList.cend(); ++cit)
{
vector<string> fileNames(1, cit->absoluteFilePath().toStdString());
GDCImageIORead(fileNames);
}
}
emit finish();
}
示例9: PopulateWithImages
static void PopulateWithImages(QListWidget * const imagelist, const QString &path)
{
QDir imagesDir(path);
QStringList extensions;
extensions << "*.jpg" << "*.png" << "*.bmp" << "*.gif";
const QFileInfoList fileList = imagesDir.entryInfoList(extensions, QDir::Files, QDir::Name | QDir::IgnoreCase);
for (QFileInfoList::const_iterator it = fileList.begin(); it != fileList.end(); ++it)
{
QListWidgetItem * const item = new QListWidgetItem(QIcon(QPixmap(it->absoluteFilePath())), it->fileName());
imagelist->addItem(item);
}
}
示例10: FilesModelUpdate
/*
* FilesModelUpdate
* extfilter_imgs_ 에 들어있는 파일들을 실제로 보여지도록 만든다.
* 조그만 아이콘으로 만들기 위한 작업
*/
void MainWindow::FilesModelUpdate() {
QFileInfoList::const_iterator iter;
file_model_->clear();
for (iter=extfilter_imgs_.begin(); iter!=extfilter_imgs_.end(); ++iter) {
qDebug() << iter->absoluteFilePath();
QImage img_buffer(iter->absoluteFilePath());
QIcon icon = GetThumnail(&img_buffer);
QStandardItem* item;
if(!icon.isNull()) {
item = new QStandardItem(icon,iter->fileName());
file_model_->appendRow(item);
}
}
extfilter_imgs_.clear();;
}
示例11: LoadThumbnail
void IconView::LoadThumbnail(ThumbItem *item)
{
if (!item)
return;
bool canLoadGallery = m_isGallery;
QString imagePath;
if (canLoadGallery)
{
if (item->IsDir())
{
// try to find a highlight
QDir subdir(item->GetPath(), "*.highlight.*",
QDir::Name, QDir::Files);
if (subdir.count() > 0)
{
// check if the image format is understood
QFileInfoList::const_iterator it = subdir.entryInfoList().begin();
if (it != subdir.entryInfoList().end())
{
imagePath = it->absoluteFilePath();
}
}
}
else
{
QString fn = item->GetName();
int firstDot = fn.indexOf('.');
if (firstDot > 0)
{
fn.insert(firstDot, ".thumb");
imagePath = QString("%1/%2").arg(m_currDir).arg(fn);
}
}
canLoadGallery = !(QFile(imagePath).exists());
}
if (!canLoadGallery)
imagePath = QString("%1%2.jpg")
.arg(ThumbGenerator::getThumbcacheDir(m_currDir))
.arg(item->GetName());
item->SetImageFilename(imagePath);
}
示例12: getDataSizeByAbsolutePath
int FmDriveDetailsContent::getDataSizeByAbsolutePath( const QString &driveName,
const FmDriveDetailsDataGroup &dataGroup,
QList<FmDriveDetailsSize*> &detailsSizeList, volatile bool *isStopped )
{
quint64 totalSize = 0;
QStringList typeFilter = dataGroup.pathList();
for( QStringList::const_iterator it = typeFilter.begin();
it!= typeFilter.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
QString driver(FmUtils::removePathSplash(FmUtils::getDriveNameFromPath(driveName)));
QFileInfo fileInfo(QString(driver + (*it)));
if (fileInfo.exists()) {
if (fileInfo.isFile()) {
totalSize += fileInfo.size();
} else if (fileInfo.isDir()) {
QList<QDir> dirs;
dirs.append(QDir(fileInfo.absolutePath()));
// traverse the whole path
while (!dirs.isEmpty()) {
QDir::Filters filter = QDir::NoDotAndDotDot | QDir::AllEntries;
QFileInfoList infoList = dirs.first().entryInfoList( filter );
for ( QFileInfoList::const_iterator it = infoList.begin(); it != infoList.end(); ++it ) {
if ( *isStopped ){
return FmErrCancel;
}
if ( it->isFile() ) {
totalSize += it->size();
}
else if ( it->isDir() ) {
dirs.append( QDir( it->absoluteFilePath() ) );
}
}
dirs.removeFirst();
}
}
}
}
detailsSizeList.append( new FmDriveDetailsSize( dataGroup.dataType(), totalSize ) );
return FmErrNone;
}
示例13: ImageCollectionShared
KipiImageCollectionShared::KipiImageCollectionShared(const QUrl& albumPath)
: ImageCollectionShared(),
m_albumPath(albumPath),
m_images()
{
// go through the album and add its images:
const QString albumPathString = m_albumPath.toLocalFile();
// add only the files, because recursion through directories should be
// handled in KipiInterface::add[Selected]Album
// TODO: restrict the search to images!
const QFileInfoList files = QDir(albumPathString).entryInfoList(QDir::Files);
for (QFileInfoList::const_iterator it = files.constBegin(); it!=files.constEnd(); ++it)
{
m_images.append(QUrl::fromLocalFile(it->absoluteFilePath()));
}
}
示例14: defaultTemplateDir
QMap<QString, QString> QgsComposerManager::defaultTemplates() const
{
QMap<QString, QString> templateMap;
//search for default templates in $pkgDataPath/composer_templates
QDir defaultTemplateDir( QgsApplication::pkgDataPath() + "/composer_templates" );
if ( !defaultTemplateDir.exists() )
{
return templateMap;
}
QFileInfoList fileInfoList = defaultTemplateDir.entryInfoList( QDir::Files );
QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
{
templateMap.insert( infoIt->baseName(), infoIt->absoluteFilePath() );
}
return templateMap;
}
示例15: defaultTemplateDir
QMap<QString, QString> QgsComposerManager::defaultTemplates( bool fromUser ) const
{
QMap<QString, QString> templateMap;
//search for default templates in $pkgDataPath/composer_templates
// user templates in $qgisSettingsDirPath/composer_templates
QDir defaultTemplateDir( fromUser ? mUserTemplatesDir : mDefaultTemplatesDir );
if ( !defaultTemplateDir.exists() )
{
return templateMap;
}
QFileInfoList fileInfoList = defaultTemplateDir.entryInfoList( QDir::Files );
QFileInfoList::const_iterator infoIt = fileInfoList.constBegin();
for ( ; infoIt != fileInfoList.constEnd(); ++infoIt )
{
templateMap.insert( infoIt->baseName(), infoIt->absoluteFilePath() );
}
return templateMap;
}