- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
在我的一个方法中,我需要一个 QFile 对象:
void GUIsubclassKuehniGUI::LoadDirectory()
{
QString loadedDirectory = QFileDialog::getExistingDirectory(this,
"/home",tr("Create Directory"),
QFileDialog::DontResolveSymlinks);
ui.PathDirectory -> setText(loadedDirectory);
QFileInfo GeoDat1 = loadedDirectory + "/1_geo.m4";
QFileInfo GeoDat2 = loadedDirectory + "/2_geo.m4";
QString Value;
if (GeoDat1.exists() == true)
{
QFile GEO = (loadedDirectory + "/1_geo.m4"); // ERROR LINE HERE!
if(GEO.open(QIODevice::ReadOnly | QIODevice::Text))
{
QTextStream Stream (&GEO);
QString Text;
do
{
Text = Stream.readLine();
QString startWith = "start";
QString endWith = "stop" ;
int start = Text.indexOf(startWith, 0, Qt::CaseInsensitive);
int end = Text.indexOf(endWith, Qt::CaseInsensitive);
if (start != -1)
Value = Text.mid(start + startWith.length(), end - ( start + startWith.length() ) );
double ValueNumber = Value.toDouble();
ValueNumber = ui.ValueLineEdit->value();
}
while(!Text.isNull());
GEO.close();
}
}
else if (GeoDat2.exists() == true)
{
...
}
}
问题出在我标记为“//ERROR LINE HERE!”的行。编译时出现错误消息:QFile::QFile (const QFile &) 'is private。我不明白这一点,因为在 QFile 纪录片中该函数被声明为公共(public)的。谁能告诉我如何解决这个问题?
最佳答案
替换:
QFile GEO = (loadedDirectory + "/1_geo.m4");
用这一行:
QFile GEO(loadedDirectory + "/1_geo.m4");
关于c++ - QFile::QFile 函数 --> 错误:QFile::QFile (const QFile &) 'is private,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9601821/
在我的一个方法中,我需要一个 QFile 对象: void GUIsubclassKuehniGUI::LoadDirectory() { QString load
我需要将一个 QFile 成 block 地复制到另一个 QFile,所以我不能使用 QFile::copy。这是最原始的实现: bool CFile::copyChunk(int64_t chunk
我正在我的类中实现一个方法,它将数据从 TableView 对象写出到 CSV 文件。然而,当程序运行时,程序以非常慢的速度(3 或 4 秒)将数据写入 USB 驱动器上的文件,但在系统的内部驱动器上
我不知道为什么,但我无法让最简单的 QTemporaryFile 示例运行...我的真正意图是在稍后处理之前将来自 QAudioInput 的数据写入临时文件。 尝试了几次后,我意识到 .read()
我想知道如何 QFile当多个句柄打开到同一个文件时(在 Windows 7 上的 Visual Studio 2013 中使用 C++),我编写了以下小程序: QFile file("tmp.t
当我定义如下结构时出现问题 struct TInputData { QString filename; QFile file; QTextStream
我有一个类(class): Class MyClass { void myMember(); ///code etc private: QFile fileMB
我需要编写一个控制台应用程序来接收一个文件,打开它,然后根据文本文件中的信息调用另一个过程。唯一的问题是 QFile::errorString() 返回: No such file or direct
我编写了以下代码来从文件中检索数据(该文件已经存在并且因为我在 Windows 操作系统上而获得了权限),并创建了项目以在列表中显示数据片段,但该列表不会显示任何内容事物。此外,我发现即使未创建文件,
我有一个名为“sequence_30.dat”的文件,其中包含垂直表示中的 1 和 -1 序列(即:每个 1 或 -1 在单独的行中)..我正在尝试读取文件以获取使用以下代码的另一个操作: int l
是否可以做到以下几点? QFile file("Test.txt") If (file.exists) { //Start writing new data at th
从文件中读取数据并将其保存在 QHash 中,如下所示: QHash > 我的数据文件不包含标题,所以当我第一次创建 vector 然后进入文件循环时,我错过了第一行的数据。我的来源是: Q
我有几个窗口标志为 WindowStaysonTopHint 的对话框。当我打开 QFileDialog 时,它显示在这些对话框的底部。如何为 QFileDialog 设置窗口标志。我使用以下代码在顶
我有一个基本上是从 Qt 网站上窃取的程序,用于尝试打开一个文件。该程序拒绝打开任何我不明白为什么的东西。我已经查找了很多文档,但一无所获,请您解释一下为什么它不起作用。 #include "main
QLabel* codeLabel = new Qlabel; QFile file("C:\index.txt"); file.open(stderr, QIODevice::WriteOnly);
我可以第二次初始化一个QFile并赋值吗?我这样试过 ... QFile file; ... if (i == 0) file = QFile("foo.txt"); else file = QFil
我在 generateCSVHeader(*file4); 处遇到非法间接错误。 函数声明: void generateCSVHeader(QFile * file); 功能使用: str="MyDa
我想知道是否可以一次性创建文件及其目录。例如我想创建文件scripts/myFile.txt。 我写了这样的代码: QFile _file( path ); QDir _dir; // check i
例如: QFile f("/home/umanga/Desktop/image.jpg"); 如何仅获取文件名 - “image.jpg”? 最佳答案 使用 QFileInfo删除路径(如果有): Q
造成这种情况的一些常见原因是什么?我的第一个想法是我正在读取的文件是只读的,但我已经检查过了。 调用它的代码是: QFile histogramFile(fileName); quint64 file
我是一名优秀的程序员,十分优秀!