qdebug

qDebug not displaying anything

我的未来我决定 提交于 2020-05-28 13:44:26
问题 Often when I need to debug something it's easier to print something using qDebug() instead of debugging step-by-step using a debugger. The problem is that from time to time the output of qDebug() isn't displayed at all! The same with qWarning and qCritical . What's strange, it only occurs when running the project normally (Ctrl+R), while when debugging (F5) the output shows up. 回答1: The solution is simple: add CONFIG += console to your .pro file and rebuild the whole project. 回答2: Solution

qDebug not displaying anything

孤街醉人 提交于 2020-05-28 13:44:12
问题 Often when I need to debug something it's easier to print something using qDebug() instead of debugging step-by-step using a debugger. The problem is that from time to time the output of qDebug() isn't displayed at all! The same with qWarning and qCritical . What's strange, it only occurs when running the project normally (Ctrl+R), while when debugging (F5) the output shows up. 回答1: The solution is simple: add CONFIG += console to your .pro file and rebuild the whole project. 回答2: Solution

qDebug() doesn't support unicode strings on Windows

大兔子大兔子 提交于 2020-01-13 18:30:06
问题 I have a line edit that contains a file name with Unicode-characters and it displays correctly in the GUI, but when I print it with qDebug() , it shows the Unicode symbols as question marks. For example, for "C:/Test/абв" this code will show only "C:/Test/???" . This line: qDebug() << ui->lineEditFileName->text(); Would show: This problem happens only on Windows (both XP and 7), on Linux it works fine. The version of Qt is 4.8.0. 回答1: It seems that the Unicode text is 'lost in translation',

qDebug() not showing const std::string&

≡放荡痞女 提交于 2019-12-30 23:22:14
问题 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 'operator<<' in 'qDebug()() << testName' I don't have options to change const std::string& type. Could you please help me to solve this issue without changing type? 回答1: qDebug() does not know anything about std::string but it works with const char* .

Qt qDebug() doesn't work in Windows shell

青春壹個敷衍的年華 提交于 2019-12-12 11:05:27
问题 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? 回答1: You have to add CONFIG += console to your projects .pro file and do not forget to clean and build (rebuild) your project. 回答2: Run your application with application.exe > log.txt 2>&1 It redirects stderr to stdout and stdout to a file. 来源: https://stackoverflow.com/questions

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

假如想象 提交于 2019-12-10 21:09:29
问题 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 and any other chatter from the QML engine, in abd logcat output. But in a vanilla build of a Qt app for Android, any such messages just seem to be blackholed (or at least I have no idea where they're going). I have had some success by the

Qdebug display hex value

南笙酒味 提交于 2019-12-10 12:30:44
问题 I am trying to display a number using QDebug in the Hex format. Below is the code which I have written. It is working but the output has string contents enclosed in double quotes: How to remove these quotes? m_CanMsg_ptr->id = 0x720; m_CanMsg_ptr->sizeData = 1; m_CanMsg_ptr->data[0] = 0x05; MessageID.setNum(m_CanMsg_ptr->id,16); DataSize = QString("%1").arg(m_CanMsg_ptr->sizeData, 0, 16); data = QString("%1").arg(m_CanMsg_ptr->data[0], 0, 16) qDebug() << "Heart-Beat : Msg ID = " << MessageID

qDebug() doesn't support unicode strings on Windows

扶醉桌前 提交于 2019-12-06 04:04:31
I have a line edit that contains a file name with Unicode-characters and it displays correctly in the GUI, but when I print it with qDebug() , it shows the Unicode symbols as question marks. For example, for "C:/Test/абв" this code will show only "C:/Test/???" . This line: qDebug() << ui->lineEditFileName->text(); Would show: This problem happens only on Windows (both XP and 7), on Linux it works fine. The version of Qt is 4.8.0. It seems that the Unicode text is 'lost in translation', because Qt Creator uses QString::fromLocal8Bit() when reading the debug output from the process. I found the

Cannot retrieve debugging output in Qt Creator

百般思念 提交于 2019-12-05 10:31:17
问题 In Qt Creator on Windows, qDebug() statements don't work, and the following message appears in the output window: Cannot retrieve debugging output. How can it be fixed? 回答1: This problem can show up if more than one instance of Qt Creator is active. To fix the issue, simply close all the other instances of Qt Creator and it should work. 回答2: For me, I solved the problem by simply closing the running application built with the other qt creator. So not necessary to close the other qt creator.

qDebug Qt console application to output to Qt Creator application output

不打扰是莪最后的温柔 提交于 2019-12-04 12:28:31
问题 How do I use qDebug in a Qt console application to output to the Qt Creator "application output" window? Currently qDebug writes to the console window which interferes with the non-debug output. Using qDebug in a Qt GUI app outputs to application output window by default. 回答1: To redirect QDebug to multiple places, you might have to write some code, maybe like this: QList<QtMsgHandler> messageHandlers_; static void messageDispatcher(QtMsgType type, const char *msg) { foreach (QtMsgHandler