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. How to register custom pointer so that signal/slot can use it?
Forum Updated to NodeBB v4.3 + New Features

How to register custom pointer so that signal/slot can use it?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 373 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.
  • M Offline
    M Offline
    Mr Pang
    wrote on last edited by Mr Pang
    #1

    I want to pass 2 custom pointers using signal/slot.
    My signal is defined as

    void createTimerRequest(const timer::CreateTimerRequest* request, std::promise<timer::CreateTimerReply_Status> *promise);
    

    I try to use

    qRegisterMetaType<std::promise<timer::CreateTimerReply_Status>*>("std::promise<timer::CreateTimerReply_Status>*");
    qRegisterMetaType<timer::CreateTimerRequest*>("timer::CreateTimerRequest*");
    

    But it doesnot work. The slot function is no called.
    Any ideas??

    Thank you.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You have to also declare these types using Q_DECLARE_METATYPE. When calling connect check if the return value is true. If not, look for warnings printed to terminal. If there are warnings, post them here.

      (Z(:^

      1 Reply Last reply
      3
      • M Offline
        M Offline
        Mr Pang
        wrote on last edited by
        #3

        Oh, my fault. My eventloop is dead lock. No need to register pointer, in fact.

        1 Reply Last reply
        2

        • Login

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