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. Extend qDebug, qWarning ... with my own qSomething
Forum Updated to NodeBB v4.3 + New Features

Extend qDebug, qWarning ... with my own qSomething

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 5.9k Views 1 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
    JulienMaille
    wrote on last edited by
    #1

    EDIT:
    I am looking for a smart and simple way to handle thread-safe info and warning QMessageBox popup with a macro.
    I would like to be able to call qInformUser("msg") or qWarnUser("msg") and if possible qAskUser("msg", returnedButton) from any thread and trigger a popup, a printf in the stdout and a new entry in a widget.

    Old post:
    I (ab)use qDebug & co a lot in my code.
    I have installed a message handler and it's been easy to redirect messages in the console, or in a widget. I can also disable the messageboxes on user request. I am now wondering how I could do to:

    • add a qInfo that just give user information without any scary "warning" icon
    • add a qQuestion that can return a boolean

    and keep the same flexibility as with built in macros.
    Thanks in advance for any piece of advice.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

      That's abusing of the QDebug functionality, which is primarly to report stuff relevant for the developer, not for the user. Can't you use QMessageBox for your use cases?

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Chris H
        wrote on last edited by
        #3

        There is nothing magical about qDebug(): it's basically just a class that implements operator<< and plays nice with all of Qt's data types. If you just want your own class that implements operator<< and instead of printing something out fires off a signal it should be straightforward.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #4

          "Qxt":http://dev.libqxt.org/libqxt/wiki/Home, a free extension library for Qt, provides a logger framework. Maybe it is of use for you.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Scylla
            wrote on last edited by
            #5

            I also can recommend the logger framework from qxt.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JulienMaille
              wrote on last edited by
              #6

              Thanks for the hint.
              Do you think qxt logger can easily be extended to handle returned values from the popped message boxes?

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Scylla
                wrote on last edited by
                #7

                bq. Do you think qxt logger can easily be extended to handle returned values from the popped message boxes?

                I didn't get your question! You set the text to message boxes, so you can put the same text to the logger, isn't it!
                The logger is static so you can access the same logger everywhere.

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  JulienMaille
                  wrote on last edited by
                  #8

                  Ok I think it is not the first time I do not express correctly what I am trying to do.
                  I edited the first post. Tell me if it is not clear.

                  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