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 can I connect to swipe.opened() from C++?
Qt 6.11 is out! See what's new in the release blog

How can I connect to swipe.opened() from C++?

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

    I want to connect a C++ slot to the swipe.opened() signal of the SwipeDelegate QML type. I tried it this way:

    QObject::connect(swipeDelegate, SIGNAL(opened()), &cb, SLOT(on_open_swipe()));
    

    but get the following runtime error:

    No such signal SwipeDelegate_QMLTYPE_0::opened() in...

    I also tried

    QObject::connect(swipeDelegate, SIGNAL(swipe.opened()), &cb, SLOT(on_open_swipe()));
    

    but get the same result.

    1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
      wrote on last edited by
      #2

      Best thing is to expose the cb object to qml side using setContextProperty. Use onOpener(..) signal handler to connect with your slot in cb.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      https://www.pthinks.com

      1 Reply Last reply
      0
      • H Offline
        H Offline
        HJPVVV
        wrote on last edited by
        #3

        I would prefer QML not having to know about the C++ side. A solution would be to provide a handler in QML and emit a custom signal from therein. I already did that.
        But I should maybe rephrase my question: while I am able to connect to pressed() or clicked() signals from C++, there is a problem with swipe.opened(), most likely because of the "swipe.". Is there a way to connect as though opened() would directly belong to SwipeDelegate? If not, it would seem to be an omission in the mechanism.

        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