本文整理汇总了C++中FileReader::fetch方法的典型用法代码示例。如果您正苦于以下问题:C++ FileReader::fetch方法的具体用法?C++ FileReader::fetch怎么用?C++ FileReader::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileReader
的用法示例。
在下文中一共展示了FileReader::fetch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QFileInfo
ExternalTool * ExternalTool::createFromFile(const QString &fileName, QString *errorMessage, const QString &locale)
{
QString absFileName = QFileInfo(fileName).absoluteFilePath();
FileReader reader;
if (!reader.fetch(absFileName, errorMessage))
return 0;
ExternalTool *tool = ExternalTool::createFromXml(reader.data(), errorMessage, locale);
if (!tool)
return 0;
tool->m_fileName = absFileName;
return tool;
}
示例2: open
bool VcsBaseSubmitEditor::open(QString *errorString, const QString &fileName, const QString &realFileName)
{
if (fileName.isEmpty())
return false;
FileReader reader;
if (!reader.fetch(realFileName, QIODevice::Text, errorString))
return false;
const QString text = QString::fromLocal8Bit(reader.data());
if (!setFileContents(text.toUtf8()))
return false;
d->m_file->setFilePath(FileName::fromString(fileName));
d->m_file->setModified(fileName != realFileName);
return true;
}
示例3: setFilePath
Core::IDocument::OpenResult SubmitEditorFile::open(QString *errorString, const QString &fileName,
const QString &realFileName)
{
if (fileName.isEmpty())
return OpenResult::ReadError;
FileReader reader;
if (!reader.fetch(realFileName, QIODevice::Text, errorString))
return OpenResult::ReadError;
const QString text = QString::fromLocal8Bit(reader.data());
if (!m_editor->setFileContents(text.toUtf8()))
return OpenResult::CannotHandle;
setFilePath(FileName::fromString(fileName));
setModified(fileName != realFileName);
return OpenResult::Success;
}
示例4: createUserFields
void VcsBaseSubmitEditor::createUserFields(const QString &fieldConfigFile)
{
FileReader reader;
if (!reader.fetch(fieldConfigFile, QIODevice::Text, Core::ICore::mainWindow()))
return;
// Parse into fields
const QStringList fields = fieldTexts(QString::fromUtf8(reader.data()));
if (fields.empty())
return;
// Create a completer on user names
const QStandardItemModel *nickNameModel = VcsPlugin::instance()->nickNameModel();
auto completer = new QCompleter(NickNameDialog::nickNameList(nickNameModel), this);
auto fieldWidget = new SubmitFieldWidget;
connect(fieldWidget, &SubmitFieldWidget::browseButtonClicked,
this, &VcsBaseSubmitEditor::slotSetFieldNickName);
fieldWidget->setCompleter(completer);
fieldWidget->setAllowDuplicateFields(true);
fieldWidget->setHasBrowseButton(true);
fieldWidget->setFields(fields);
d->m_widget->addSubmitFieldWidget(fieldWidget);
}