当前位置: 首页>>代码示例>>C++>>正文


C++ QFileInfoList::append方法代码示例

本文整理汇总了C++中QFileInfoList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfoList::append方法的具体用法?C++ QFileInfoList::append怎么用?C++ QFileInfoList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QFileInfoList的用法示例。


在下文中一共展示了QFileInfoList::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: alternativeFilePaths

QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameFilters,
    QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort,
    bool uniqueFileNames = true)
{
    QFileInfoList result;

    // Prepare a 'soft to hard' drive list: W:, X: ... A:, Z:
    QStringList driveStrings;
    foreach (const QFileInfo &drive, QDir::drives())
        driveStrings.append(drive.absolutePath());
    driveStrings.sort();
    const QString zDriveString(QLatin1String("Z:/"));
    driveStrings.removeAll(zDriveString);
    driveStrings.prepend(zDriveString);

    QStringList uniqueFileNameList;
    for (int i = driveStrings.count() - 1; i >= 0; --i) {
        const QDir dirOnDrive(driveStrings.at(i) + path);
        const QFileInfoList entriesOnDrive = dirOnDrive.entryInfoList(nameFilters, filters, sort);
        if (uniqueFileNames) {
            foreach(const QFileInfo &entry, entriesOnDrive) {
                if (!uniqueFileNameList.contains(entry.fileName())) {
                    uniqueFileNameList.append(entry.fileName());
                    result.append(entry);
                }
            }
        } else {
            result.append(entriesOnDrive);
        }
    }
开发者ID:jbartolozzi,项目名称:CIS462_HW1,代码行数:30,代码来源:qfontdatabase_s60.cpp

示例2: themeDirs

QList<ThemeInfo> MythUIHelper::GetThemes(ThemeType type)
{
    QFileInfoList fileList;
    QList<ThemeInfo> themeList;
    QDir themeDirs(GetThemesParentDir());
    themeDirs.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
    themeDirs.setSorting(QDir::Name | QDir::IgnoreCase);

    fileList.append(themeDirs.entryInfoList());

    themeDirs.setPath(d->m_userThemeDir);

    fileList.append(themeDirs.entryInfoList());

    for (QFileInfoList::iterator it =  fileList.begin();
         it != fileList.end(); ++it)
    {
        QFileInfo  &theme = *it;

        if (theme.baseName() == "default" ||
            theme.baseName() == "default-wide" ||
            theme.baseName() == "Slave")
            continue;

        ThemeInfo themeInfo(theme.absoluteFilePath());

        if (themeInfo.GetType() & type)
            themeList.append(themeInfo);
    }

    return themeList;
}
开发者ID:chadparry,项目名称:mythtv,代码行数:32,代码来源:mythuihelper.cpp

示例3: checkTestSuiteResult

void tst_SuiteTest::checkTestSuiteResult() const
{
    if(m_abortRun)
        QSKIP("This test takes too long time to run on the majority of platforms.", SkipAll);

    typedef QList<QFileInfo> QFileInfoList;

    const QFileInfo baseline(m_existingBaseline);
    const QFileInfo result(m_candidateBaseline);
    QFileInfoList list;
    list.append(baseline);
    list.append(result);

    const QFileInfoList::const_iterator end(list.constEnd());

    QEventLoop eventLoop;
    const QPatternist::AutoPtr<Worker> worker(new Worker(eventLoop, m_existingBaseline, result));

    /* Passed to ResultThreader so it knows what kind of file it is handling. */
    ResultThreader::Type type = ResultThreader::Baseline;

    QProcess::execute(QLatin1String("p4 edit ") + m_existingBaseline);

    for(QFileInfoList::const_iterator it(list.constBegin()); it != end; ++it)
    {
        QFileInfo i(*it);
        i.makeAbsolute();

        QVERIFY2(i.exists(), qPrintable(QString::fromLatin1("File %1 does not exist.")
                                        .arg(i.fileName())));

        QFile *const file = new QFile(i.absoluteFilePath(), worker.data());

        QVERIFY2(file->open(QIODevice::ReadOnly), qPrintable(QString::fromLatin1("Could not open file %1 for reading.")
                 .arg(i.fileName())));

        ResultThreader *handler = new ResultThreader(eventLoop, file, type, worker.data());

        QObject::connect(handler, SIGNAL(finished()), worker.data(), SLOT(threadFinished()));

        handler->start(); /* Start the thread. It now parses the file
                             and emits threadFinished() when done. */
        type = ResultThreader::Result;
    }

    const int exitCode = eventLoop.exec();

    QProcess::execute(QLatin1String("p4 revert -a ") + m_existingBaseline);

    QCOMPARE(exitCode, 0);
}
开发者ID:selebro,项目名称:qt,代码行数:51,代码来源:tst_suitetest.cpp

示例4: ui

SnifferDialog::SnifferDialog(QWidget * parent):
QDialog(parent), ui(new Ui::SnifferDialog)
{
    ui->setupUi(this);

    openedSniffersModel = new OpenedSniffersModel;
    ui->snifferTable->setModel(openedSniffersModel);

    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(onAddSniffer()));
    connect(ui->removeButton, SIGNAL(clicked()), this, SLOT(onRemoveSniffer()));
    connect(ui->browseButton, SIGNAL(clicked()), this, SLOT(onBrowseSniffer()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(onCloseDialog()));

    QFileInfoList captureInterfaces;
    QDir searchPath;
    QStringList extensions;

    extensions << QString("*.so") << QString("*.dylib");

    searchPath = QDir("/usr/lib/foren6/interfaces");
    if(!searchPath.exists())
        searchPath = QDir(QApplication::applicationDirPath() + "/capture");
    if(!searchPath.exists())
        searchPath = QDir(QApplication::applicationDirPath());

    captureInterfaces.append(searchPath.entryInfoList(extensions, QDir::Files, QDir::Name));

    QFileInfo captureInterface;

    foreach(captureInterface, captureInterfaces) {
        qDebug("Loading %s", captureInterface.absoluteFilePath().toLatin1().constData());
        loadInterface(captureInterface.absoluteFilePath().toLatin1().constData());
    }
开发者ID:tim-ist,项目名称:foren6-gui-qt,代码行数:33,代码来源:SnifferDialog.cpp

示例5: getReport

QFileInfoList CDspHaClusterHelper::getReport()
{
	QFileInfoList output;
	QFileInfo p("/usr/bin/vstorage-make-report");
	if (!p.exists())
		return output;
	QDir d("/etc/vstorage/clusters");
	if (!d.exists())
		return output;
	QStringList a = d.entryList(QDir::NoDotAndDotDot | QDir::Dirs);
	foreach (QString x, a)
	{
		QTemporaryFile t;
		t.setFileTemplate(QString("%1/pstorage.%2.XXXXXX.tgz")
			.arg(QDir::tempPath()).arg(x));
		if (!t.open())
		{
			WRITE_TRACE(DBG_FATAL, "QTemporaryFile::open() error: %s",
					QSTR2UTF8(t.errorString()));
			continue;
		}
		QString b, c = QString("%1 -f %2 \"%3\"").arg(p.filePath()).arg(t.fileName()).arg(x);
		if (!HostUtils::RunCmdLineUtility(c, b, -1) || t.size() == 0)
		{
			t.close();
			continue;
		}
		t.setAutoRemove(false);
		output.append(QFileInfo(t.fileName()));
		t.close();
	}
开发者ID:OpenVZ,项目名称:prl-disp-service,代码行数:31,代码来源:CDspHaClusterHelper.cpp

示例6: selectedInfoItems

QFileInfoList QextFileSystemController::selectedInfoItems() const
{
    const Q_D(QextFileSystemController);
    QFileInfoList selInfo;
    foreach(QModelIndex index, d->view->selectionModel()->selectedRows())
        selInfo.append(QFileInfo(path(index)));
    return selInfo;
}
开发者ID:FengBanIcorrLog,项目名称:vault,代码行数:8,代码来源:qextfilesystemcontroller.cpp

示例7: findReferences

QFileInfoList GameControllerAttachment::findReferences(const QDomElement &node) const
{
	QFileInfoList references;	
	if (node.tagName() == "Sound3D" && node.hasAttribute("file"))
	{
		QFileInfo file(node.attribute("file"));
		references.append(file);
	}
	if( node.tagName() == "StaticAnimation" && node.hasAttribute("file"))
	{
		QFileInfo file(node.attribute("file"));
		references.append(file);
	}
	QDomNodeList children = node.childNodes();
	for (int i=0; i<children.size(); ++i)
		references << findReferences(children.at(i).toElement());
	return references;
}
开发者ID:algts,项目名称:Horde3D,代码行数:18,代码来源:GameControllerAttachment.cpp

示例8:

/*
 * name : get_file_list
 * desc : Scan indicated path list and return file info list of images
 * in   :
 *   pathList, String list of source path
 *   filters, String list of file extension name
 * ret  : List of QFileInfo for all files under indicated path
 */
QFileInfoList
PicIn_Core::get_file_list(QStringList pathList, QStringList filters)
{
    QFileInfoList fileInfoList;
    for(int i = 0; i < pathList.size(); i++){
        fileInfoList.append(get_file_list(pathList.at(i), filters));
    }

    return fileInfoList;
}
开发者ID:ChunKai-Wang,项目名称:PicIn,代码行数:18,代码来源:picin_core.cpp

示例9: dir

void NewWizardPage4::buildTemplatesList()
      {

      QDir dir(mscoreGlobalShare + "/templates");
      QFileInfoList fil = dir.entryInfoList(QDir::NoDotAndDotDot | QDir::Readable | QDir::Dirs | QDir::Files, QDir::Name);
      if(fil.isEmpty()){
          fil.append(QFileInfo(QFile(":data/Empty_Score.mscz")));
          }

      QDir myTemplatesDir(preferences.getString(PREF_APP_PATHS_MYTEMPLATES));
      fil.append(myTemplatesDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Readable | QDir::Dirs | QDir::Files, QDir::Name));

      // append templates directories from extensions
      QStringList extensionsDir = Extension::getDirectoriesByType(Extension::templatesDir);
      for (QString extDir : extensionsDir) {
            QDir extTemplateDir(extDir);
            fil.append(extTemplateDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Readable | QDir::Dirs | QDir::Files, QDir::Name));
            }
      templateFileBrowser->setScores(fil);
      }
开发者ID:salewski,项目名称:MuseScore,代码行数:20,代码来源:newwizard.cpp

示例10: allFilesRecursive

static QFileInfoList allFilesRecursive(const QString &path)
{
    const QDir currentDirectory(path);

    QFileInfoList allFiles = currentDirectory.entryInfoList(QDir::Files);

    foreach (const QFileInfo &subDirectory, currentDirectory.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot))
        allFiles.append(allFilesRecursive(subDirectory.absoluteFilePath()));

    return allFiles;
}
开发者ID:aizaimenghuangu,项目名称:QtTestor,代码行数:11,代码来源:qmlapp.cpp

示例11: findDirectories

void OsmAnd::Utilities::findDirectories(const QDir& origin, const QStringList& masks, QFileInfoList& directories, bool recursively /*= true */)
{
    const auto& directoriesList = origin.entryInfoList(masks, QDir::AllDirs | QDir::NoDotAndDotDot);
    directories.append(directoriesList);

    if (recursively)
    {
        const auto& subdirs = origin.entryInfoList(QStringList(), QDir::AllDirs | QDir::NoDotAndDotDot);
        for(const auto& subdir : constOf(subdirs))
            findDirectories(QDir(subdir.absoluteFilePath()), masks, directories, recursively);
    }
}
开发者ID:kendzi,项目名称:OsmAnd-core,代码行数:12,代码来源:Utilities.cpp

示例12: loadItems

bool GdalCatalogConnector::loadItems()
{
    QFileInfoList fileList;

    QUrl location = _location.url();
    if ( location.toString() == "file://") { // root will only contain drives (folders)
        fileList = QDir::drives();
        QFileInfoList dirs;
        foreach(QFileInfo inf , fileList) {
             QDir dir(inf.canonicalPath());
             dirs.append(dir.entryInfoList(QDir::Dirs));
        }
开发者ID:JeroenBrinkman,项目名称:IlwisConnectors,代码行数:12,代码来源:gdalcatalogconnector.cpp

示例13: dir

 foreach (const QString& d, search_dirs) {
     QDir dir(d);
     //qDebug() << "dir: " << dir;
     QFileInfoList fis = dir.entryInfoList(filters, QDir::Files, QDir::Unsorted);
     if (fis.isEmpty()) {
         if (fileters_base.isEmpty())
             continue;
         fis = dir.entryInfoList(fileters_base, QDir::Files, QDir::Unsorted);
     }
     if (fis.isEmpty())
         continue;
     list.append(fis);
 }
开发者ID:alishir,项目名称:QtAV,代码行数:13,代码来源:Subtitle.cpp

示例14: drives

QFileInfoList QFSFileEngine::drives()
{
    QFileInfoList ret;
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
#if defined(Q_OS_WIN32)
    const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
    quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff;
    ::SetErrorMode(oldErrorMode);
#endif
    char driveName[] = "A:/";

    while (driveBits) {
        if (driveBits & 1)
            ret.append(QFileInfo(QLatin1String(driveName)));
        driveName[0]++;
        driveBits = driveBits >> 1;
    }
    return ret;
#else // !Q_OS_WINCE && !Q_OS_WINRT
    ret.append(QFileInfo(QLatin1String("/")));
    return ret;
#endif // Q_OS_WINCE || Q_OS_WINRT
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:23,代码来源:qfsfileengine_win.cpp

示例15: checkForOverwrites

QFileInfoList RemuxQueueModel::checkForOverwrites() const
{
	QFileInfoList list;

	for (const RemuxQueueEntry &entry : queue) {
		if (entry.state == RemuxEntryState::Ready) {
			QFileInfo fileInfo(entry.targetPath);
			if (fileInfo.exists()) {
				list.append(fileInfo);
			}
		}
	}

	return list;
}
开发者ID:ZixiVideo,项目名称:obs-studio,代码行数:15,代码来源:window-remux.cpp


注:本文中的QFileInfoList::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。