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. [SOLVED] MOC documentation claims to support class templates, but actually it doesn't

[SOLVED] MOC documentation claims to support class templates, but actually it doesn't

Scheduled Pinned Locked Moved General and Desktop
documentationbug
3 Posts 3 Posters 1.4k 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.
  • J Offline
    J Offline
    Jakob
    wrote on 25 May 2015, 13:01 last edited by Jakob
    #1

    The documentation on http://doc.qt.io/qt-5/moc.html clearly states that moc does not support class templates that have signals or slots. This implies, that as long as my class does not have such things, it should be possible to create class templates that derive from QObject. In reality however, the moc-compiler complains "Template classes not supported by Q_OBJECT". This is a rather different statement.

    The documentation should reflect that template classes are not supported at all.

    ? 1 Reply Last reply 25 May 2015, 14:47
    0
    • J Jakob
      25 May 2015, 13:01

      The documentation on http://doc.qt.io/qt-5/moc.html clearly states that moc does not support class templates that have signals or slots. This implies, that as long as my class does not have such things, it should be possible to create class templates that derive from QObject. In reality however, the moc-compiler complains "Template classes not supported by Q_OBJECT". This is a rather different statement.

      The documentation should reflect that template classes are not supported at all.

      ? Offline
      ? Offline
      A Former User
      wrote on 25 May 2015, 14:47 last edited by
      #2

      Hi @Jakob, well spotted! Please file a bug report: https://bugreports.qt.io

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 25 May 2015, 22:20 last edited by
        #3

        Hi,

        Technically putting the Q_OBJECT macro without using any signals or slots does not really make sense. Anyway, you can create a templated QObject without using the Q_OBJECT macro.

        The Qt Quarterly number 15 talks about that.

        Hope it helps

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        1/3

        25 May 2015, 13:01

        • Login

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