Qt qDebug not working with QConsoleApplication or QApplication

I currently have a terribly nasty problem when developing programs using Qt and Qt Creator. Whenever I try to use qDebug()with QCoreApplicationor QApplicationcreated before use qDebug(), there is no conclusion whether I run the program in Qt Creator or from a regular shell (I use Fedora Linux by the way). For example, even the following simple code does not work:

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    qDebug() << "TestOutput!" << endl;
}

Does anyone know what to do with this problem? Thanks in advance, Marius

+4
source share
4 answers

For better formatting, I'm adding this new solution, marius still found it in this bugzilla .

~/.config/QtProject/qtlogging.ini :

[Rules]
*.debug=true
qt.qpa.input*.debug=false

- moved mouse.

+6

: http://doc.qt.io/qt-5/qloggingcategory.html#details

. :

env (cmd):

$ export QT_LOGGING_RULES="*.debug=true" ./app

env (export):

$ QT_LOGGING_RULES="*.debug=true"
$ ./app

:

#include <QCoreApplication>
#include <QLoggingCategory>
int main(int argc, char *argv[])
{
  QCoreApplication a(argc, argv);
  QLoggingCategory::setFilterRules("*.debug=true");
  qDebug() << "Debugging;
  a.exit();
}
+4
+1

( bashrc):

export QT_LOGGING_DEBUG=1
0

All Articles