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. How to connect a signal to another in QML
Forum Updated to NodeBB v4.3 + New Features

How to connect a signal to another in QML

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

    As I know, I can connect a signal to another signal with "connect() method" in cpp.

    so, I thought It would also possible in QML, I have no ideal about the way though.

    function connectActionTo(item) {
            if (item === undefined || item.senderType === undefined) {
                return;
            }
    
            if (item.pressed !== undefined) {
                // some code about connection for two object's signals
            }
    
            if (item.clicked !== undefined) {
                // (tried 1), but no effect. I am expecting something similar under line.
                item.clicked = function(item){action.clicked(item.type);}
            }
        }
    

    Any Your Comments Would Be Welcome. Thank You :)

    JKSHJ 1 Reply Last reply
    0
    • hslee_6560H hslee_6560

      As I know, I can connect a signal to another signal with "connect() method" in cpp.

      so, I thought It would also possible in QML, I have no ideal about the way though.

      function connectActionTo(item) {
              if (item === undefined || item.senderType === undefined) {
                  return;
              }
      
              if (item.pressed !== undefined) {
                  // some code about connection for two object's signals
              }
      
              if (item.clicked !== undefined) {
                  // (tried 1), but no effect. I am expecting something similar under line.
                  item.clicked = function(item){action.clicked(item.type);}
              }
          }
      

      Any Your Comments Would Be Welcome. Thank You :)

      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      @hslee_6560 said in How to connect a signal to another in QML:

      so, I thought It would also possible in QML

      You're right! https://doc.qt.io/qt-5/qtqml-syntax-signals.html

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      3

      • Login

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