0
텍스트 파일에서 문자열 (데이터)을 읽고 QDoubleSpinBox에 데이터를 쓰고 싶습니다. 나는 오류 메시지를 얻을 컴파일 할 때텍스트 파일의 값을 읽고 QDoubleSpinBox에 값을 쓰십시오.
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");
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()));
qDebug() << Value << (start + startWith.length()) << (end - (start + startWith.length()));
double ValueNumber = Value.toDouble();
ValueNumber = ui.ValueQDoubleSpinBox->value();
}
while(!Text.isNull());
GEO.close();
}
}
else if (GeoDat2.exists() == true)
{
...
}
}
을,하지만 난 방법을 사용할 때 QString "값"의 방법 "QString :: 같이 IndexOf"와 "QString :: 중반"로 검색 LoadDirectory : 그러므로 내가 사용 파일 "/1_geo.m4"QFileInfo :: exists()로 증명 한 존재는 QDoubleSpinBox "ValueQDoubleSpinBox"에 기록되지 않습니다. 누군가가 왜 작동하지 않는지 말할 수 있습니까? 인사
그래 당신 말이 맞아요 - 지금은 잘 작동합니다. :디 – Streight