本文整理汇总了C++中QFileInfoList::front方法的典型用法代码示例。如果您正苦于以下问题:C++ QFileInfoList::front方法的具体用法?C++ QFileInfoList::front怎么用?C++ QFileInfoList::front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QFileInfoList
的用法示例。
在下文中一共展示了QFileInfoList::front方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openProject
QString BaseCheckoutWizard::openProject(const QString &path, QString *errorMessage)
{
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
if (!pe) {
*errorMessage = tr("The Project Explorer is not available.");
return QString();
}
// Search the directory for project files
const QDir dir(path);
if (!dir.exists()) {
*errorMessage = tr("'%1' does not exist.").
arg(QDir::toNativeSeparators(path)); // Should not happen
return QString();
}
QFileInfoList projectFiles = findProjectFiles(dir, errorMessage);
if (projectFiles.empty())
return QString();
// Open. Do not use a busy cursor here as additional wizards might pop up
const QString projectFile = projectFiles.front().absoluteFilePath();
if (!pe->openProject(projectFile, errorMessage))
return QString();
return projectFile;
}
示例2: openProject
QString BaseCheckoutWizardFactory::openProject(const Utils::FileName &path, QString *errorMessage)
{
// Search the directory for project files
const QDir dir(path.toString());
if (!dir.exists()) {
*errorMessage = tr("\"%1\" does not exist.").
arg(path.toUserOutput()); // Should not happen
return QString();
}
QFileInfoList projectFiles = findProjectFiles(dir, errorMessage);
if (projectFiles.empty())
return QString();
// Open. Do not use a busy cursor here as additional wizards might pop up
const QString projectFile = projectFiles.front().absoluteFilePath();
if (!ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(projectFile, errorMessage))
return QString();
return projectFile;
}
示例3: findD3dCompiler
QString findD3dCompiler(Platform platform, const QString &qtBinDir, unsigned wordSize)
{
const QString prefix = QStringLiteral("D3Dcompiler_");
const QString suffix = QLatin1String(windowsSharedLibrarySuffix);
// Get the DLL from Kit 8.0 onwards
const QString kitDir = QString::fromLocal8Bit(qgetenv("WindowsSdkDir"));
if (!kitDir.isEmpty()) {
QString redistDirPath = QDir::cleanPath(kitDir) + QStringLiteral("/Redist/D3D/");
if (platform & ArmBased) {
redistDirPath += QStringLiteral("arm");
} else {
redistDirPath += wordSize == 32 ? QStringLiteral("x86") : QStringLiteral("x64");
}
QDir redistDir(redistDirPath);
if (redistDir.exists()) {
const QFileInfoList files = redistDir.entryInfoList(QStringList(prefix + QLatin1Char('*') + suffix), QDir::Files);
if (!files.isEmpty())
return files.front().absoluteFilePath();
}
}
QStringList candidateVersions;
for (int i = 47 ; i >= 40 ; --i)
candidateVersions.append(prefix + QString::number(i) + suffix);
// Check the bin directory of the Qt SDK (in case it is shadowed by the
// Windows system directory in PATH).
foreach (const QString &candidate, candidateVersions) {
const QFileInfo fi(qtBinDir + QLatin1Char('/') + candidate);
if (fi.isFile())
return fi.absoluteFilePath();
}
// Find the latest D3D compiler DLL in path (Windows 8.1 has d3dcompiler_47).
if (platform & IntelBased) {
QString errorMessage;
unsigned detectedWordSize;
foreach (const QString &candidate, candidateVersions) {
const QString dll = findInPath(candidate);
if (!dll.isEmpty()
&& readPeExecutable(dll, &errorMessage, 0, &detectedWordSize, 0)
&& detectedWordSize == wordSize) {
return dll;
}
}
}
示例4: findProjectFiles
// Try to find the project files in a project directory with some smartness
static QFileInfoList findProjectFiles(const QDir &projectDir, QString *errorMessage)
{
const QStringList projectFilePatterns = ProjectExplorer::ProjectExplorerPlugin::projectFilePatterns();
// Project directory
QFileInfoList projectFiles = projectDir.entryInfoList(projectFilePatterns, QDir::Files|QDir::NoDotAndDotDot|QDir::Readable);
if (!projectFiles.empty())
return projectFiles;
// Try a 'src' directory
QFileInfoList srcDirs = projectDir.entryInfoList(QStringList(QLatin1String("src")), QDir::Dirs|QDir::NoDotAndDotDot|QDir::Readable);
if (srcDirs.empty()) {
*errorMessage = msgNoProjectFiles(projectDir, projectFilePatterns);
return QFileInfoList();
}
const QDir srcDir = QDir(srcDirs.front().absoluteFilePath());
projectFiles = srcDir.entryInfoList(projectFilePatterns, QDir::Files|QDir::NoDotAndDotDot|QDir::Readable);
if (projectFiles.empty()) {
*errorMessage = msgNoProjectFiles(srcDir, projectFilePatterns);
return QFileInfoList();
}
return projectFiles;
}