Qt Forum

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

    Qt output too verbose

    General and Desktop
    2
    4
    2805
    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.
    • E
      enutt last edited by

      Hi there,

      How can I adjust the verbosity of applications that use Qt? I'm using the Qt installed by package manager in Ubuntu 12.04 lts. For instance, all my applications print stuff to the terminal:

      @
      Got bus address: "unix:abstract=/tmp/dbus-uYtYuIHkwF,guid=bf09af5765943413637ce5a500000313"
      Connected to accessibility bus at: "unix:abstract=/tmp/dbus-uYtYuIHkwF,guid=bf09af5765943413637ce5a500000313"
      Registered DEC: true
      Registered event listener change listener: true
      @

      And using ui features causes more stuff to print:

      @
      QSpiAccessible::accessibleEvent not handled: "6" obj: QMenu(0x10902c0, name = "menuFile") "menuFile"
      QSpiAccessible::accessibleEvent not handled: "7" obj: QMenu(0x10902c0, name = "menuFile") "menuFile"
      @

      Is there a way to disable this log?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • M
        MuldeR last edited by

        Install your own "dummy" message handler:

        @void myMessageOutput(QtMsgType type, const char *msg)
        {
        /do nothing, i.e. discard message completely/
        }

        int main(int argc, char **argv)
        {
        qInstallMsgHandler(myMessageOutput);

        /* ... */
        

        }@

        --

        See also:
        http://qt-project.org/doc/qt-4.8/qtglobal.html#qInstallMsgHandler

        My OpenSource software at: http://muldersoft.com/

        Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

        Go visit the coop: http://youtu.be/Jay...

        1 Reply Last reply Reply Quote 0
        • E
          enutt last edited by

          Thanks for the answer! Although, I don't understand why this is necessary. When running the same application on two difference machines, only one of them prints messages from Qt in such a verbose way. Why is this?

          1 Reply Last reply Reply Quote 0
          • M
            MuldeR last edited by

            If you don't install your own message handler, the default one writes the output the STDOUT stream. On Linux, if you run a GUI application from the terminal, the STDOUT becomes visible there. If you run the GUI application without a terminal (e.g. from Nautilus) you simply don't see the STDOUT anywhere (it probably goes to /dev/null). And on Windows, the STDOUT of GUI applications is discarded anyway, even if you run them from a console.

            My OpenSource software at: http://muldersoft.com/

            Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

            Go visit the coop: http://youtu.be/Jay...

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