[Qt-interest] Rookie without missunderstanding of QTreeView
Aleksandar Lazic
al-qtinterest at none.at
Tue Jun 16 20:33:45 CEST 2009
Dear List,
I try a 'more or less' simple step.
1.) open a XML File
2.) Display the content as tree.
The 1st step was easy.
###
void qtXml01::on_actionOpen_triggered(){
QString filePath = QFileDialog::getOpenFileName(this, tr("Open
File"),QCoreApplication::applicationDirPath(),tr("XML-Files
(*.xml);;All Files(*.*)"));
if( filePath.isEmpty() ){
QMessageBox::critical(this,tr("File selection error"),tr("No file was selected"));
return;
}
QFile file(filePath);
if (!file.open(QFile::ReadOnly | QFile::Text)){
QMessageBox::critical(this,tr("File open error"),tr("File unable
to open"));
return;
}
QString errorStr;
int errorLine;
int errorColumn;
if (!MyDomdoc.setContent(&file,true, &errorStr, &errorLine,&errorColumn)) {
QMessageBox::critical(this, tr("DOM IO"),
tr("Parse error at line %1, column %2:\nError: %3")
.arg(errorLine)
.arg(errorColumn)
.arg(errorStr));
file.close();
return;
}
file.close();
}
###
The 2nd thing is looks to me very difficult.
In which state change the Qt after the on_actionOpen_triggered()
I'am sure I have overread something of the book
C++ GUI Programming with Qt 4
and
http://doc.qtsoftware.com/4.5/xml-dombookmarks.html
Please can anybody point me to the right way?
Many thanks.
Cheers
Aleks
More information about the Qt-interest-old
mailing list