QTextDocument* parseDoc
(std
::vector<double>
& time, std
::vector<std
::array<double,
3>>
& pos, std
::vector<std
::array<double,
3>>
& pos
){
textFormat.setFontFamily("Courier");
myDocumentCursor->setCharFormat(textFormat);
formattedString
= QString("This is th Data of Some object. It was retrieved on %2\r\n").
arg(QDateTime::currentDateTime().
toString());
myDocumentCursor->insertText(formattedString);
myDocumentCursor->insertBlock();
formattedString
= QString("Epoch").
leftJustified(21,
' ');
formattedString.
append(QString("Position x-Axis").
leftJustified(21,
' '));
formattedString.
append(QString("Position y-Axis").
leftJustified(21,
' '));
formattedString.
append(QString("Position z-Axis").
leftJustified(21,
' '));
formattedString.
append(QString("Velocity x-Axis").
leftJustified(21,
' '));
formattedString.
append(QString("Velocity y-Axis").
leftJustified(21,
' '));
formattedString.
append(QString("Velocity z-Axis").
leftJustified(16,
' '));
myDocumentCursor->insertText(formattedString);
myDocumentCursor->insertBlock();
formattedString.clear();
for(int i = 0; i < time.size(); i++){
formattedString
= QString("%1 %2 %3 %4 %5 %6 %7").
arg(time[i
],
-16,
'f',
-1) .arg(pos[i][0], -16, 'f', -1).arg(pos[i][1], -16, 'f', -1).arg(pos[i][2], -16, 'f', -1)
.arg(vel[i][0], -16, 'f', -1).arg(vel[i][1], -16, 'f', -1).arg(vel[i][2], -16, 'f', -1);
myDocumentCursor->insertText(formattedString);
myDocumentCursor->insertBlock();
}
return parsedDocument;
}
QTextDocument* parseDoc(std::vector<double>& time, std::vector<std::array<double,3>>& pos, std::vector<std::array<double,3>>& pos){
parsedDocument = new QTextDocument();
myDocumentCursor = new QTextCursor(parsedDocument);
QTextCharFormat textFormat = myDocumentCursor->charFormat();
textFormat.setFontFamily("Courier");
myDocumentCursor->setCharFormat(textFormat);
QString formattedString;
formattedString = QString("This is th Data of Some object. It was retrieved on %2\r\n").arg(QDateTime::currentDateTime().toString());
myDocumentCursor->insertText(formattedString);
myDocumentCursor->insertBlock();
formattedString = QString("Epoch").leftJustified(21, ' ');
formattedString.append(QString("Position x-Axis").leftJustified(21, ' '));
formattedString.append(QString("Position y-Axis").leftJustified(21, ' '));
formattedString.append(QString("Position z-Axis").leftJustified(21, ' '));
formattedString.append(QString("Velocity x-Axis").leftJustified(21, ' '));
formattedString.append(QString("Velocity y-Axis").leftJustified(21, ' '));
formattedString.append(QString("Velocity z-Axis").leftJustified(16, ' '));
myDocumentCursor->insertText(formattedString);
myDocumentCursor->insertBlock();
formattedString.clear();
for(int i = 0; i < time.size(); i++){
formattedString = QString("%1 %2 %3 %4 %5 %6 %7").arg(time[i], -16, 'f', -1)
.arg(pos[i][0], -16, 'f', -1).arg(pos[i][1], -16, 'f', -1).arg(pos[i][2], -16, 'f', -1)
.arg(vel[i][0], -16, 'f', -1).arg(vel[i][1], -16, 'f', -1).arg(vel[i][2], -16, 'f', -1);
myDocumentCursor->insertText(formattedString);
myDocumentCursor->insertBlock();
}
return parsedDocument;
}
To copy to clipboard, switch view to plain text mode
Bookmarks