Questions tagged [qdebug]

The QDebug class, part of the Qt framework, provides an output stream for debugging information.

Documentation can be found here

99 questions
7
votes
1 answer

What is the difference between qDebug() used as a stream and as a function

I have seen bits of Qt code that uses qDebug as if it were printf() qDebug( format, ... ); Mostly i see it used like std::cout qDebug() << "one " << var_one; What is the difference in the usages and when is it correct/better to use one of the…
Wes Miller
  • 2,191
  • 2
  • 38
  • 64
6
votes
2 answers

qDebug() not showing const std::string&

I am trying to use some vector data's name with struct. I am trying to get see which name in qDebug() To be more clear: const std::string& testName = "asdfqwer"; qDebug() << testName; It gives en error message in build: Error: no match for…
goGud
  • 4,163
  • 11
  • 39
  • 63
6
votes
1 answer

How to send a QString to debug output?

I cannot print out a QString in Qt using QDebug. Below are some attempts (none work): QDebug(letters.toStdString()); QDebug(letters.toLatin1()); QDebug() << letters.toUtf8(); QDebug() << letters.toWCharArray(); QDebug() <<…
user929404
  • 2,153
  • 1
  • 22
  • 27
6
votes
2 answers

Qt qDebug() doesn't work in Windows shell

I am using a qDebug() of Qt Framework for printf something on the screen. It works just fine when I run application from Qt Creator, but when I try to execute it from Windows cmd it shows nothing. Why that happens?
Knight of Ni
  • 1,780
  • 3
  • 20
  • 47
4
votes
1 answer

QDebug-like structure: determine end of input via `operator<<`

Qt has a nice debug feature, called like that qDebug() << first_qobject << second_qobject; it produces a line with some "standard to-string" of the objects and -- and that's the important part -- prints a \n and flushed the steam after…
wal-o-mat
  • 7,158
  • 7
  • 32
  • 41
4
votes
1 answer

What's the simplest way to see logging from a Qt app on Android in adb logcat output?

NB I am not a QtCreator user. I build android apps in build scripts with qmake, make and androiddeployqt, and deploy them to the device with adb install. I'd like to be able to see the output of qDebug, qInfo etc, and also any qml conole.log output…
timday
  • 24,582
  • 12
  • 83
  • 135
4
votes
2 answers

In Qt: Can I output to `stdout`, as easy as I can output to `stderr` using qDebug()?

Up until now, I output everything using qDebug().noquote(). This is easy because it just requires a simple #import Now I need everything to output to stdout, but I don't know how to do it easily. This how I was taught: QTextStream…
Anon
  • 2,267
  • 3
  • 34
  • 51
4
votes
3 answers

Disable qDebug output locally with a macro

I used qDebug all over the code. Now I would like to limit its output by translation units, defining a separate macro to enable/disable qDebug output in a translation unit: test.pro: DEFINES += NO_DEBUG_ONE testone.cpp: #ifdef NO_DEBUG_ONE #define…
rightaway717
  • 2,631
  • 3
  • 29
  • 43
4
votes
2 answers

How can I print Qt:HANDLE on linux? (Qt5)

As a means to verify which thread my code is actually running under I use QThread::currentThreadId(). However the Qt::HANDLE type that is returned from this function is according to the documentation a platform dependant typedef. On my platform…
Mr. Developerdude
  • 9,118
  • 10
  • 57
  • 95
4
votes
1 answer

Printing Qt variables

I'm programming in Qt, but I'm more accustomed to PHP. So with that in mind, how do I 'echo' or 'print' out the contents of a QStringList or QString to ensure the contents are as expected? I'm building a GUI application. Is there anyway to print the…
sark9012
  • 5,485
  • 18
  • 61
  • 99
4
votes
1 answer

Getting the name of sub class within super class in Qt

I have a base class that is inherited by two sub classes. All three classes use qDebug() to do some debug printing and Q_FUNC_INFO to identify the source of the print. The problem is that when printing from the base class, Q_FUNC_INFO contains the…
TheAG
  • 287
  • 1
  • 4
  • 10
3
votes
1 answer

Use qDebug in unit testing Qt

I wanted to use qDebug in the Qt unit testing, i had written the code of qDebug but it is not getting diplayed I even used ctest -R alkimia-alkinvoice -VV But even this shows only the location where the error is coming from. but i needed to use…
Puneet
  • 291
  • 1
  • 5
  • 15
3
votes
0 answers

Redirecting stdout/stderr *to*

I've got a GUI application that makes extensive use of QDebug for logging, and a message handler set up via qInstallMessageHandler. However, it uses some third-party libraries that print logging info to stdout and stderr. I'm running into some…
Jason C
  • 38,729
  • 14
  • 126
  • 182
3
votes
2 answers

Qt output (qDebug qWarning etc) does not work if application is executed via cronjob

I created a reproduction sample for this: #include #include #include #include using namespace std; int main () { int i; QLoggingCategory::setFilterRules("*.debug=true\n"); …
NTG
  • 73
  • 9