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. Beginners documentation question

Beginners documentation question

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.5k Views
  • 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.
  • C Offline
    C Offline
    comjf
    wrote on 19 Feb 2013, 03:48 last edited by
    #1

    I've been going through the documentation on how to make a simple integration with QML to my c++ app (See http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-interactqmlfromcpp.html). I've ported over my code base and gotten it to work in qtcreator without any qml stuff (just to make sure I didnt need any special build flags). In qtcreator I created a new desktop 'Quick 2 Application', and again made sure I can run just my console stuff.. the problem now comes with creating my first simple signal.

    I've followed the documentation and tried multiple different things, but here I'll paste what was autogenerated (minus includes) and explain my problem.

    @
    int main(int argc, char *argv[])
    {
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    viewer.setMainQmlFile(QStringLiteral("qml/eoQMLIntegration/loginPage.qml"));
    
    //What I want to add in but can't figure out how
    QObject *item = viewer.rootObject();
    basicAction* ba = new basicAction();
    QObject::connect(item, SIGNAL(qmlSignal(QString)), ba, SLOT(eoLogin()));
    

    @
    ....

    QObject *item = viewer.rootObject();  is saying Can't convert QQuickItem to QObject. and I need to have QObject as the first parameter for ::connect. I've tried this with the engine/component way, and the view way without any luck.
    

    If anyone could help me out I'd really appreciate it. I just need to get to the point where I can start.

    Thanks!

    1 Reply Last reply
    0
    • U Offline
      U Offline
      utcenter
      wrote on 19 Feb 2013, 04:06 last edited by
      #2

      bq. and I need to have QObject as the first parameter for ::connect

      Not a QObject but a QObject derived, which QQuickItem is, since it inherits QObject.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        comjf
        wrote on 19 Feb 2013, 14:45 last edited by
        #3

        Thanks for the quick reply, however I tried that

        @
        QQuickItem item = viewer.rootObject();
        basicAction
        ba = new basicAction();
        QQuickItem::connect(item, SIGNAL(qmlSignal(QString)), ba, SLOT(eoLogin()));

        @

        I also tried
        @
        QObject::connect(item, SIGNAL(qmlSignal(QString)), ba, SLOT(eoLogin()));
        @

        /home/jflowers/Programming/QT/eoQMLIntegration/main.cpp:26: error: no matching function for call to 'QObject::connect(QQuickItem*&, const char*, basicAction*&, const char*)'

        I guess, Ideally, I am asking if an updated/working documentation for this exists and where?

        Thanks in advance!

        1 Reply Last reply
        0

        1/3

        19 Feb 2013, 03:48

        • Login

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