本文整理汇总了C++中QDir::filter方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::filter方法的具体用法?C++ QDir::filter怎么用?C++ QDir::filter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDir
的用法示例。
在下文中一共展示了QDir::filter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: directories
void RGBScript_Test::directories()
{
QDir dir = RGBScriptsCache::systemScriptsDirectory();
QCOMPARE(dir.filter(), QDir::Files);
QCOMPARE(dir.nameFilters(), QStringList() << QString("*.js"));
#if defined( __APPLE__) || defined(Q_OS_MAC)
QString path("%1/../%2");
QCOMPARE(dir.path(), path.arg(QCoreApplication::applicationDirPath())
.arg("Resources/RGBScripts"));
#elif defined(WIN32) || defined(Q_OS_WIN)
QVERIFY(dir.path().endsWith("RGBScripts"));
#else
QVERIFY(dir.path().endsWith("qlcplus/rgbscripts"));
#endif
dir = RGBScriptsCache::userScriptsDirectory();
QCOMPARE(dir.filter(), QDir::Files);
QCOMPARE(dir.nameFilters(), QStringList() << QString("*.js"));
#if defined( __APPLE__) || defined(Q_OS_MAC)
QVERIFY(dir.path().endsWith("Library/Application Support/QLC+/RGBScripts"));
#elif defined(WIN32) || defined(Q_OS_WIN)
QVERIFY(dir.path().endsWith("RGBScripts"));
#else
QVERIFY(dir.path().endsWith(".qlcplus/rgbscripts"));
#endif
}
示例2: profileDirectories
void InputMap_Test::profileDirectories()
{
QDir dir = InputMap::systemProfileDirectory();
QVERIFY(dir.filter() & QDir::Files);
QVERIFY(dir.nameFilters().contains(QString("*%1").arg(KExtInputProfile)));
QVERIFY(dir.absolutePath().contains(INPUTPROFILEDIR));
dir = InputMap::userProfileDirectory();
QVERIFY(dir.exists() == true);
QVERIFY(dir.filter() & QDir::Files);
QVERIFY(dir.nameFilters().contains(QString("*%1").arg(KExtInputProfile)));
QVERIFY(dir.absolutePath().contains(USERINPUTPROFILEDIR));
}
示例3: defDirectories
void QLCFixtureDefCache_Test::defDirectories()
{
QDir dir = QLCFixtureDefCache::systemDefinitionDirectory();
QVERIFY(dir.filter() & QDir::Files);
QVERIFY(dir.nameFilters().contains(QString("*%1").arg(KExtFixture)));
QVERIFY(dir.absolutePath().contains(FIXTUREDIR));
dir = QLCFixtureDefCache::userDefinitionDirectory();
#ifndef SKIP_TEST
QVERIFY(dir.exists() == true);
#endif
QVERIFY(dir.filter() & QDir::Files);
QVERIFY(dir.nameFilters().contains(QString("*%1").arg(KExtFixture)));
QVERIFY(dir.absolutePath().contains(USERFIXTUREDIR));
}
示例4: QObject
KDir::KDir(const QDir &d)
: QObject(0, "KDir")
{
initLists();
myNameFilter= d.nameFilter();
setPath(d.path());
mySortSpec= d.sorting();
myFilterSpec= d.filter();
myFilteredDirtyFlag= true;
}
示例5: staticRecursiveEntryInfoList
static void staticRecursiveEntryInfoList(QDir &dir, QFileInfoList &infos, bool includeDirectories) {
foreach (const QFileInfo &info, dir.entryInfoList(dir.nameFilters(), dir.filter(), dir.sorting())) {
if (info.isDir()) {
if (includeDirectories) {
infos << info;
}
dir.setPath(info.absoluteFilePath());
staticRecursiveEntryInfoList(dir, infos, includeDirectories);
}
else {
infos << info;
}
}
}
示例6: staticRecursiveEntryList
static void staticRecursiveEntryList(QDir &dir, QStringList &names, bool includeDirectories) {
foreach (const QFileInfo &info, dir.entryInfoList(dir.nameFilters(), dir.filter(), dir.sorting())) {
const QString path = info.absoluteFilePath();
if (info.isDir()) {
if (includeDirectories) {
names << path;
}
dir.setPath(path);
staticRecursiveEntryList(dir, names, includeDirectories);
}
else {
names << path;
}
}
}
示例7: readDirectory
void TSystem::readDirectory(TFilePathSet &dst, const QDir &dir,
bool groupFrames) {
if (!(dir.exists() && QFileInfo(dir.path()).isDir()))
throw TSystemException(TFilePath(dir.path().toStdWString()),
" is not a directory");
QStringList entries(dir.entryList(dir.filter() | QDir::NoDotAndDotDot));
TFilePath dirPath(dir.path().toStdWString());
std::set<TFilePath, CaselessFilepathLess> fpSet;
int e, eCount = entries.size();
for (e = 0; e != eCount; ++e) {
TFilePath path(dirPath + TFilePath(entries.at(e).toStdWString()));
if (groupFrames && path.getDots() == "..") path = path.withFrame();
fpSet.insert(path);
}
dst.insert(dst.end(), fpSet.begin(), fpSet.end());
}
示例8: entryList
/*!
Constructs a QDirIterator that can iterate over \a dir's entrylist, using
\a dir's name filters and regular filters. You can pass options via \a
flags to decide how the directory should be iterated.
By default, \a flags is NoIteratorFlags, which provides the same behavior
as in QDir::entryList().
The sorting in \a dir is ignored.
\note To list symlinks that point to non existing files, QDir::System must be
passed to the flags.
\sa hasNext(), next(), IteratorFlags
*/
QDirIterator::QDirIterator(const QDir &dir, IteratorFlags flags)
: d(new QDirIteratorPrivate(dir.path(), dir.nameFilters(), dir.filter(), flags))
{
d->q = this;
}