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] ERROR: "invalid application of ‘sizeof’ ... " with Q_OBJECT
QtWS25 Last Chance

[SOLVED] ERROR: "invalid application of ‘sizeof’ ... " with Q_OBJECT

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 4.9k 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.
  • G Offline
    G Offline
    gorbatschow
    wrote on last edited by
    #1

    Hello community!
    Part of my problem is very similar to "Diagram Scene Example" (http://qt-project.org/doc/qt-5/qtwidgets-graphicsview-diagramscene-example.html, and I decided to take it as a basis.
    However, I encountered a problem.
    The fact is that I would like to use signals in the class "DiagramItem", as is done in class "DiagramTextItem",
    but when I add 'Q_OBJECT' I get an error:
    "invalid application of 'sizeof' to incomplete type 'QStaticAssertFailure<false>'
    enum {Q_STATIC_ASSERT_PRIVATE_JOIN(q_static_assert_result, COUNTER) = sizeof(QStaticAssertFailure<!!(Condition)>)} "

    QT 5.2

    Thanks in advance for any help

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      DiagarmItem doesn't inherit from QObject so you can't just add that macro. You need to also inherit from it

      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
      • G Offline
        G Offline
        gorbatschow
        wrote on last edited by
        #3

        Thank you! Now it works!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You're welcome !

          Happy coding !

          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