Condition_Frame *condition = new Condition_Frame();
Action_Frame *action = new Action_Frame();
if(id == 3)
{
QXmlStreamWriter *stream = new QXmlStreamWriter();
stream->setDevice(file);
stream->setAutoFormatting(true);
if(!file->exists())
{
stream->writeStartDocument("");
}
else
{
}
stream->writeStartElement("statement");
stream->writeStartElement("Condition");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeStartElement("input");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", condition->input_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("operator");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", condition->operator_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("values");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", condition->values_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("more");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", condition->more_combobox->currentText());
stream->writeEndElement();
stream->writeEndElement();
stream->writeStartElement("action");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeStartElement("output");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", action->output_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("operator");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", action->operator_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("values");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", action->values_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("more");
stream
->writeAttribute
("id",
QString::number(1));
stream->writeTextElement("text", action->more_combobox->currentText());
stream->writeEndElement();
stream->writeEndDocument();
file->close();
}
Condition_Frame *condition = new Condition_Frame();
Action_Frame *action = new Action_Frame();
if(id == 3)
{
QFile *file = new QFile("E:/new.txt");
QXmlStreamWriter *stream = new QXmlStreamWriter();
stream->setDevice(file);
stream->setAutoFormatting(true);
if(!file->exists())
{
file->open(QIODevice::WriteOnly);
stream->writeStartDocument("");
}
else
{
file->open(QIODevice::Append);
}
stream->writeStartElement("statement");
stream->writeStartElement("Condition");
stream->writeAttribute("id", QString::number(1));
stream->writeStartElement("input");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", condition->input_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("operator");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", condition->operator_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("values");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", condition->values_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("more");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", condition->more_combobox->currentText());
stream->writeEndElement();
stream->writeEndElement();
stream->writeStartElement("action");
stream->writeAttribute("id", QString::number(1));
stream->writeStartElement("output");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", action->output_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("operator");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", action->operator_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("values");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", action->values_combobox->currentText());
stream->writeEndElement();
stream->writeStartElement("more");
stream->writeAttribute("id", QString::number(1));
stream->writeTextElement("text", action->more_combobox->currentText());
stream->writeEndElement();
stream->writeEndDocument();
file->close();
}
To copy to clipboard, switch view to plain text mode
Bookmarks