Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    2
    4
    4278
    Loading More Posts
    • 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
      gorbatschow last edited by

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 0
        • G
          gorbatschow last edited by

          Thank you! Now it works!

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            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 Reply Quote 0
            • First post
              Last post