Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    Solved QWidget::insertAction: Attempt to insert null action?

    General and Desktop
    2
    3
    275
    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.
    • L
      lansing last edited by

      My project has a lot of QAction, I had declared them in the header and in the source, I gave them default to nullptr and instantiated them all at once with a loop. After that I assigned them to the different menus. However at the end, I have missed a couple of QActions somewhere and Qt Creator is giving me a warning

      QWidget::insertAction: Attempt to insert null action?

      How do I find out which one are they?

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        If it is a warning, you can set environment variable QT_FATAL_WARNINGS and app will crash whenever that message is printed. Then it should be trivial to check which action it is using an attached debugger.

        (Z(:^

        L 1 Reply Last reply Reply Quote 3
        • L
          lansing @sierdzio last edited by

          @sierdzio said in QWidget::insertAction: Attempt to insert null action?:

          QT_FATAL_WARNINGS

          Thank you it works. Setting this and the debugger points me right to the spot that causes the warning.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post