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

[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.5k Views 3 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.
  • J Offline
    J Offline
    Jakob
    wrote on 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
    0
    • J Jakob

      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 last edited by
      #2

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

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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

        • Login

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