本文整理汇总了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);
}
}
示例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;
}
示例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);
}
示例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());
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
}
示例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));
}
示例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);
}
示例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
}
示例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;
}