QGuiApplication & QXmlQuery problems on qt5
-
I'm trying to use QtXmlPatterns module in order to parse an XML file. Unfortunately using Qt5.1 on MacOsX 10.7&10.8 I found a problem I have not with Qt4.8.5.
@#include <QCoreApplication>
#include <QGuiApplication>
#include <QXmlQuery>
#include <QStringList>
#include <QDebug>int main(int argc, char *argv[])
{
//QGuiApplication a(argc, argv);
QCoreApplication a(argc, argv);
QXmlQuery qry;
qry.setQuery("doc("file.xml")");
QStringList lst;
qry.evaluateTo(&lst);
qDebug() << lst;
return 0;
}@this is the .pro I'm using.
@QT += core gui xmlpatterns
TARGET = Test
TEMPLATE = app
CONFIG -= app_bundle
SOURCES += main.cpp@If I run a QCoreApplication everything works properly, instead if I switch on QGuiApplication (or a QApplication) this small program hangs forever on the evaluteTo function. It doesn't matter if file.xml exists or not.
On Windows and on Linux the same program run smoothly even if I use the QCoreApplication or the QGuiApplication or the QApplication.
I tried also to play a little with the QXmlQuery functions. If I call the setFocus function I got the same behaviour (with QCoreApplication everything it's ok, with QGuiApplication it hangs for ever on the setFocus function).
Suggestions?
-
You should run the event loop:
@
return a.exec();
@Otherwise, it might be a bug.
-
I tried it but Unfortunately I get the same behaviour.