本文整理汇总了C++中QDir::nameFilters方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::nameFilters方法的具体用法?C++ QDir::nameFilters怎么用?C++ QDir::nameFilters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDir
的用法示例。
在下文中一共展示了QDir::nameFilters方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
}
}
示例5: 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;
}
}
}
示例6: 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;
}
示例7: pluginLoader
PlatformPlugin *FactoryPrivate::platformPlugin()
{
if (m_platformPlugin) {
return m_platformPlugin;
}
if (m_noPlatformPlugin) {
return 0;
}
#ifndef QT_NO_DBUS
if (!QCoreApplication::instance() || QCoreApplication::applicationName().isEmpty()) {
pWarning() << "Phonon needs QCoreApplication::applicationName to be set to export audio output names through the DBUS interface";
}
#endif
Q_ASSERT(QCoreApplication::instance());
const QByteArray platform_plugin_env = qgetenv("PHONON_PLATFORMPLUGIN");
if (!platform_plugin_env.isEmpty()) {
QPluginLoader pluginLoader(QString::fromLocal8Bit(platform_plugin_env.constData()));
if (pluginLoader.load()) {
m_platformPlugin = qobject_cast<PlatformPlugin *>(pluginLoader.instance());
if (m_platformPlugin) {
return m_platformPlugin;
}
}
}
const QString suffix(QLatin1String("/phonon_platform/"));
ensureLibraryPathSet();
QDir dir;
dir.setNameFilters(
!qgetenv("KDE_FULL_SESSION").isEmpty() ? QStringList(QLatin1String("kde.*")) :
(!qgetenv("GNOME_DESKTOP_SESSION_ID").isEmpty() ? QStringList(QLatin1String("gnome.*")) :
QStringList())
);
dir.setFilter(QDir::Files);
const QStringList libPaths = QCoreApplication::libraryPaths();
forever {
for (int i = 0; i < libPaths.count(); ++i) {
const QString libPath = libPaths.at(i) + suffix;
dir.setPath(libPath);
if (!dir.exists()) {
continue;
}
const QStringList files = dir.entryList(QDir::Files);
for (int i = 0; i < files.count(); ++i) {
QPluginLoader pluginLoader(libPath + files.at(i));
if (!pluginLoader.load()) {
pDebug() << Q_FUNC_INFO << " platform plugin load failed:"
<< pluginLoader.errorString();
continue;
}
pDebug() << pluginLoader.instance();
QObject *qobj = pluginLoader.instance();
m_platformPlugin = qobject_cast<PlatformPlugin *>(qobj);
pDebug() << m_platformPlugin;
if (m_platformPlugin) {
connect(qobj, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)),
SLOT(objectDescriptionChanged(ObjectDescriptionType)));
return m_platformPlugin;
} else {
delete qobj;
pDebug() << Q_FUNC_INFO << dir.absolutePath() << "exists but the platform plugin was not loadable:" << pluginLoader.errorString();
pluginLoader.unload();
}
}
}
if (dir.nameFilters().isEmpty()) {
break;
}
dir.setNameFilters(QStringList());
}
pDebug() << Q_FUNC_INFO << "platform plugin could not be loaded";
m_noPlatformPlugin = true;
return 0;
}