Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] Receiving signals from QML to C++

[SOLVED] Receiving signals from QML to C++

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.7k 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.
  • S Offline
    S Offline
    spode
    wrote on last edited by
    #1

    could you help me to understand why signal_creaNuovaParola(); (from a QML file) does not call the method of the same class creaNuovaParola();, please?
    @
    Gestore.cpp
    void Gestore::visualizzaSchermataPrincipale()
    {
    QDeclarativeView* view = new QDeclarativeView;
    view->setSource(QUrl::fromLocalFile("qml/WoerterErinnerung/main.qml"));
    QObject *obj_schermataPrincipale = view->rootObject();
    QObject::connect(obj_schermataPrincipale, SIGNAL(signal_visualizzaLeggimi()), this, SLOT(visualizzaLeggimi()));
    QObject::connect(obj_schermataPrincipale, SIGNAL(signal_creaNuovaParola()), this, SLOT(creaNuovaParola()));
    view->show();
    }
    @
    main.qml
    @
    Rectangle {
    signal signal_creaNuovaParola();
    ...
    onClicked: signal_creaNuovaParola();
    }
    @

    1 Reply Last reply
    0
    • B Offline
      B Offline
      baysmith
      wrote on last edited by
      #2

      Perhaps because a Rectangle element doesn't have an onClicked signal to cause signal_creaNuovaParola to be called. You need a MouseArea element.

      Nokia Certified Qt Specialist.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        spode
        wrote on last edited by
        #3

        there is already a mousearea! ;)
        gestore.cpp
        @
        void Gestore::creaNuovaParola()
        {
        QDeclarativeView *schermataNuovaParola = new QDeclarativeView;
        schermataNuovaParola->setSource(QUrl::fromLocalFile("qml/WoerterErinnerung/schermataNuovaParola.qml"));
        schermataNuovaParola->show();
        }
        @

        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