Reputation: 3931
I'm trying to get started using debug helpers in QtCreator.
But I can't even get anything simple to work.
I made this simple python file:
from dumper import *
def qdump_TestClass(d, value):
d.putNumChild(0)
d.putValue("hi")
Then add that file in here:
This is the C++ definition of the class:
struct TestClass {
int x, y;
};
I have been following the steps in this other question. But that didn't work for me.
Upvotes: 0
Views: 370
Reputation: 14587
Use double underscores in function name:
def qdump__TestClass(d, value):
^^
And, correct your path according to the documentation:
~/<Qt>/Tools/QtCreator/share/qtcreator/debugger/personaltypes.py
Use your Qt folder name (or path if it's not at ~
).
The path showing in that dialog box is relative to your app
.
Here's a complete working example:
main.cpp
struct TestClass
{
int x {12}, y {34};
};
int main()
{
TestClass t;
(void) t;
return 0;
}
personaltypes.py
from dumper import *
def qdump__TestClass(d, value):
d.putValue("TestClass")
d.putNumChild(2)
if d.isExpanded():
with Children(d):
d.putSubItem("x", value["x"])
d.putSubItem("y", value["y"])
Screenshot:
Upvotes: 3