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. Is it possible to create template signals?
QtWS25 Last Chance

Is it possible to create template signals?

Scheduled Pinned Locked Moved Solved General and Desktop
signaltemplate
3 Posts 2 Posters 1.2k 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.
  • CJhaC Offline
    CJhaC Offline
    CJha
    wrote on last edited by
    #1

    Is it possible to create a general template signal in a QObject subclass like this:

    signals:
    	template<typename T>
    	void templateSignal(const T& t);
    

    I tried and I get the error: The "QtRunWork" task returned false but did not log an error

    J.HilkJ 1 Reply Last reply
    0
    • CJhaC CJha

      Is it possible to create a general template signal in a QObject subclass like this:

      signals:
      	template<typename T>
      	void templateSignal(const T& t);
      

      I tried and I get the error: The "QtRunWork" task returned false but did not log an error

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @CJha the answer is generally no

      qmake, the magic behind signals and slots, can't run on the expanded templates, those are compiler intern stuff and qmake runs/parses your source files directly. IIRC

      So no, no templates with signals and slots.

      BUT
      there is verdigris, which should work with templates, but its a slightly different philosophy and a good bit more verbose.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      CJhaC 1 Reply Last reply
      3
      • J.HilkJ J.Hilk

        @CJha the answer is generally no

        qmake, the magic behind signals and slots, can't run on the expanded templates, those are compiler intern stuff and qmake runs/parses your source files directly. IIRC

        So no, no templates with signals and slots.

        BUT
        there is verdigris, which should work with templates, but its a slightly different philosophy and a good bit more verbose.

        CJhaC Offline
        CJhaC Offline
        CJha
        wrote on last edited by
        #3

        @J-Hilk Thanks :)

        1 Reply Last reply
        1

        • Login

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