Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGuiApplication & QXmlQuery problems on qt5
Forum Updated to NodeBB v4.3 + New Features

QGuiApplication & QXmlQuery problems on qt5

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    inopportuno
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You should run the event loop:
      @
      return a.exec();
      @

      Otherwise, it might be a bug.

      (Z(:^

      1 Reply Last reply
      0
      • I Offline
        I Offline
        inopportuno
        wrote on last edited by
        #3

        I tried it but Unfortunately I get the same behaviour.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved