/*! Constructs a QTemporaryDir with a template of \a templatePath. If \a templatePath is a relative path, the path will be relative to the current working directory. You can use QDir::tempPath() to construct \a templatePath if you want use the system's temporary directory. If the \a templatePath ends with XXXXXX it will be used as the dynamic portion of the directory name, otherwise it will be appended. Unlike QTemporaryFile, XXXXXX in the middle of the template string is not supported. \sa QDir::tempPath() */ QTemporaryDir::QTemporaryDir(const QString &templatePath) : d_ptr(new QTemporaryDirPrivate) { if (templatePath.isEmpty()) d_ptr->create(defaultTemplateName()); else d_ptr->create(templatePath); }
QIcon TemplateManager::templateIcon(const QString& target, const QString& _template) { QFileInfo templateInfo(_template); const QString& base = pathForTemplate(target, templateInfo.path() + "/" + templateInfo.baseName()); QFileInfo file(base + ".png"); if(!file.exists()) file.setFile(file.path() + "/" + defaultTemplateName() + ".png"); return QIcon(file.filePath()); }
/*! Constructs a QTemporaryDir using as template the application name returned by QCoreApplication::applicationName() (otherwise \c qt_temp). The directory is stored in the system's temporary directory, QDir::tempPath(). \sa QDir::tempPath() */ QTemporaryDir::QTemporaryDir() : d_ptr(new QTemporaryDirPrivate) { d_ptr->create(defaultTemplateName()); }
/*! Constructs a QTemporaryFile (with the given \a parent) using as file template the application name returned by QCoreApplication::applicationName() (otherwise \c qt_temp) followed by ".XXXXXX". The file is stored in the system's temporary directory, QDir::tempPath(). \sa setFileTemplate() */ QTemporaryFile::QTemporaryFile(QObject *parent) : QFile(*new QTemporaryFilePrivate, parent) { Q_D(QTemporaryFile); d->templateName = defaultTemplateName(); }
/*! Constructs a QTemporaryFile using as file template the application name returned by QCoreApplication::applicationName() (otherwise \c qt_temp) followed by ".XXXXXX". The file is stored in the system's temporary directory, QDir::tempPath(). \sa setFileTemplate(), QDir::tempPath() */ QTemporaryFile::QTemporaryFile() : QFile(*new QTemporaryFilePrivate, 0) { Q_D(QTemporaryFile); d->templateName = defaultTemplateName(); }