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. QSignalTransition setSignal
Forum Updated to NodeBB v4.3 + New Features

QSignalTransition setSignal

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 113 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.
  • R Offline
    R Offline
    Redman
    wrote on last edited by
    #1

    Hello,

    I'm trying to add a signal which triggeres execution of the QSignalTransition via void QSignalTransition::setSignal(const QByteArray &signal)

    MyTransitions is sub classing QSignalTransition

    My code:

       QSharedPointer<MyTransition> transition = QSharedPointer<MyTransition>(new MyTransition());
       // Set the sender and  signal the QSignalTransition is listening for
       transition.data()->setSenderObject(this);
       transition.data()->setSignal(&MySender::echoStateChange);
    

    The line with setSignal() throws following error:

    error: C2664: 'void QSignalTransition::setSignal(const QByteArray &)': cannot convert argument 1 from 'void (__cdecl MySender::* )(const MySender::State &)' to 'const QByteArray &'
    

    How can I properly set the signal?

    I am aware, that passing the sender to the QSignalTransition ctor works, but this approach is not possible in my implementation

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Redman
      wrote on last edited by Redman
      #2
         QByteArray sig = QMetaMethod::fromSignal(&MySender::echoStateChange)
                              .methodSignature()
                              .constData();
         transition.data()->setSignal(sig);
      
      1 Reply Last reply
      0
      • R Redman has marked this topic as solved on

      • Login

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