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. QtObject created and returned by singleton, how to attached slots ?
Forum Updated to NodeBB v4.3 + New Features

QtObject created and returned by singleton, how to attached slots ?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 239 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.
  • SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #1

    I have a singleton that manages object creation in C++ I return an instance of the created object to a QML property. C++:

        Q_INVOKABLE QObject* newInstance(const QString& crstrTag_) {
            return new staledata_t(crstrTag_);
        }
    

    In the QML:

    instance = DataMngr.newInstance(instanceID)
    

    How can I assign QML slots to the singles that this instance C++ emits: C++ signals:

    signals:
        void dataChanged(double dblData_);
        void interface(bool blnState_);
        void toolTip(QString strToolTip_);
    

    Kind Regards,
    Sy

    SPlattenS 1 Reply Last reply
    0
    • SPlattenS SPlatten

      I have a singleton that manages object creation in C++ I return an instance of the created object to a QML property. C++:

          Q_INVOKABLE QObject* newInstance(const QString& crstrTag_) {
              return new staledata_t(crstrTag_);
          }
      

      In the QML:

      instance = DataMngr.newInstance(instanceID)
      

      How can I assign QML slots to the singles that this instance C++ emits: C++ signals:

      signals:
          void dataChanged(double dblData_);
          void interface(bool blnState_);
          void toolTip(QString strToolTip_);
      
      SPlattenS Offline
      SPlattenS Offline
      SPlatten
      wrote on last edited by SPlatten
      #2

      Solved:

          Connections {
                  target: instance
                  function onDataChanged(dblData_) {
                      rText.text = root.getValue(dblData_, true)
                  }
          }
      

      Kind Regards,
      Sy

      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