How to get CLion ot show QString values in when debugging?
Asked Answered
E

4

14

Seeing this blew my mind:

CLion showing the type of variable in C++

But it would be really awesome if it actually showed me the value inside it. Is it possible to fix this?

Exigent answered 7/6, 2017 at 17:47 Comment(0)
E
4

Not possible yet - but upvote the request on https://youtrack.jetbrains.com/issue/CPP-605 to get this traction.

Exigent answered 29/11, 2017 at 8:41 Comment(0)
L
3

I just added var.toStdString() in watchs.enter image description here

Lovering answered 15/1, 2023 at 10:35 Comment(0)
R
1

You can use gdb command in console:

print ((wchar_t*)((char *)str.d + str.d->offset))

or just add watch in "Variables":

((wchar_t*)((char *)str.d + str.d->offset))

Another way is use this project to add Qt pretty printer.

Rifleman answered 9/9, 2021 at 15:34 Comment(1)
wchar_t is 16 bits on Windows, but 32 bits everywhere else. So, no.Dehumanize
P
1

From https://youtrack.jetbrains.com/issue/CPP-605, the Clion ticket vadim-peretokin linked to in his answer.

On Windows... you can use natvis files with MSVC.

  1. enable the setting Enable NatVis renderers for LLDB.
  2. Add qt5.natvis or qt6.natvis to your source directory,

Download links for the natvis files can be found on https://wiki.qt.io/IDE_Debug_Helpers, but also below. You'll need to drop the .xml extension for the debugger to recongize and load the file.

Pudendum answered 24/10, 2023 at 18:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.