how do I see qDebug statements on a Windows 11 installation

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
mrhickman53
Active Member
Posts: 25
Joined: Thu Sep 07, 2023 1:17 am
Location: USA

how do I see qDebug statements on a Windows 11 installation

Post by mrhickman53 » Sat Feb 01, 2025 11:08 pm

I have been developing scripts on a linux machine and am now trying to troubleshoot on a Windows 11 installation. I cannot figure out an incantation that permits me to see qDebug, Warnings or Errors.

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by CVH » Sun Feb 02, 2025 6:36 am

mrhickman53 wrote:
Sat Feb 01, 2025 11:08 pm
I cannot figure out an incantation that permits me to see qDebug, Warnings or Errors.
That is restricted on a Win system, I other words: You can not ... Not in real time.

The presented solution is to stream the output of QCAD to a log file and examine that afterwards.
The 'cat' command is reported as not functional.
It may work under PowerShell, otherwise use 'type'.
I have already problems with starting QCAD from a OS command line.

As said, not in real time and then debugging an interactive script is not really a solution via a log file.

Another option (for the time being) is to run QCAD in debugger mode.
The down side is that this mode is not really stable.
Another problem is that you cannot debug interactions with a Dialog because that is always modal.
Again it is Windows that doesn't allow this.

The debuger will be removed completely, see this topics: QCAD Snapshots & Qt6 ; QCAD + Qt6 vs debugger

I then frequently use EAction.handleUserMessage [-Warning, -Info] ("MessageString") to display these things in the Command History in real time.

Regards,
CVH

User avatar
andrew
Site Admin
Posts: 8769
Joined: Fri Mar 30, 2007 6:07 am

Re: how do I see qDebug statements on a Windows 11 installation

Post by andrew » Mon Feb 03, 2025 10:10 am

You might want to install cygwin (especially when coming from Linux) which can show the output when qcad.exe is run.

333onlyhalfevil
Full Member
Posts: 92
Joined: Fri Apr 28, 2023 12:39 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by 333onlyhalfevil » Wed Feb 05, 2025 6:34 am

I use Windows and generally run qcad using the command:

Code: Select all

qcad.exe 1>log.txt 2>&1 -rescan -enable-script-debugger
This will output your qdebug statement strings to a log.txt file that you can find in the same directory as your qcad.exe.

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by CVH » Wed Feb 05, 2025 6:39 am

333onlyhalfevil wrote:
Wed Feb 05, 2025 6:34 am
This will output your qdebug ...
As explained in the 'stream' link but is this in real time?
For interactive scripts for example.

Regards,
CVH

333onlyhalfevil
Full Member
Posts: 92
Joined: Fri Apr 28, 2023 12:39 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by 333onlyhalfevil » Wed Feb 05, 2025 10:57 pm

CVH wrote:
Wed Feb 05, 2025 6:39 am
As explained in the 'stream' link
Yeah, I was trying to get the full command in here. I used the command in the link originally a long time ago and didn't know that you could have that command and also the debugger going at the same time. When scripting, I would mainly use the debugger, then when I needed qDebugs I'd run the command in the link. It's better to have them both going simultaneously.
CVH wrote:
Wed Feb 05, 2025 6:39 am
but is this in real time?
For interactive scripts for example.
It's not as good as just using a Linux terminal and having the ability to watch the qDebug statements popping up in real time. But using the Linux terminal requires (1) installing it and (2) figuring out how to use it which may or may not be worth it depending on what script is being worked on. I'm fairly sure, for interactive scripts, that you can just keep on opening the log.txt file as you click on stuff in the program and see what qDebug output lines have been added to the log.txt file since the last time you opened it up.

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by CVH » Thu Feb 06, 2025 8:36 am

@333onlyhalfevil
Thanks for the info, for give it a try.
333onlyhalfevil wrote:
Wed Feb 05, 2025 10:57 pm
When scripting, I would mainly use the debugger
Scripting in JS, debugger mode (For the time being), NOT at all a stable environment.
Then cygwin is out of the question, Win7 32bit and myself not acquainted with the Linux environment.

EAction.handleUserMessage [-Warning, -Info] ("MessageString") is then my only option outside the debugger mode.
For that my QCAD Command History/Line is docked at the right and displays several history lines.
I can then debug my code in real time, even with a modal dialog.

Regards,
CVH

333onlyhalfevil
Full Member
Posts: 92
Joined: Fri Apr 28, 2023 12:39 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by 333onlyhalfevil » Mon Mar 10, 2025 6:26 pm

Quick question. When you're on linux and run qcad using ./qcad -rescan -enable-script-debugger, is that supposed to automatically output the qdebug statements by default? or is there another command or settings that needs to be run in order to do it?

CVH
Premier Member
Posts: 4879
Joined: Wed Sep 27, 2017 4:17 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by CVH » Tue Mar 11, 2025 5:39 am

@333onlyhalfevil
333onlyhalfevil wrote:
Mon Mar 10, 2025 6:26 pm
When you're on linux and run qcad using ./qcad -rescan -enable-script-debugger, is that supposed to automatically output the qdebug statements by default?
A bit off-topic.
I think that you might get an answer when you start a new topic ... Linux related

Regards,
CVH

333onlyhalfevil
Full Member
Posts: 92
Joined: Fri Apr 28, 2023 12:39 pm

Re: how do I see qDebug statements on a Windows 11 installation

Post by 333onlyhalfevil » Wed Mar 12, 2025 6:13 am

CVH wrote:
Tue Mar 11, 2025 5:39 am
A bit off-topic.
I think that you might get an answer when you start a new topic ... Linux related
CVH
I suppose I could've added more words to make it on topic, however, it is indeed on topic because I'm on a Windows machine. I was trying to get a linux terminal set up within VS Code and I have it and it is working but the qDebug statements don't get printed out, hence the question. I can't try it on linux because I don't have a linux machine. Assuming I can get it to work, what I have will probably be a great option for windows users, assuming they use vs code.

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”