gpt4 book ai didi

Debugging QT symbols with CLion(使用Clion调试QT符号)

转载 作者:bug小助手 更新时间:2023-10-24 19:53:00 29 4
gpt4 key购买 nike



Question


How does one get a debug view of properties of QT items? I'm currently using CLion.

如何获得Qt项属性的调试视图?我现在用的是克利安。


For example, the application uses a QModelIndex.

例如,应用程序使用QModelIndex。


enter image description here


I've gathered from documentation that QModelIndex is used in combination with an AbstractItemModel. It seems like the property m is supposed to be a pointer to that model. How do I view the data associated with this QModelIndex and/or QAbstractItemModel? Shouldn't m be showing me additional properties?

我从文档中了解到QModelIndex与AbstractItemModel结合使用。似乎m属性应该是指向该模型的指针。如何查看与此QModelIndex和/或QAbstractItemModel关联的数据?我是不是应该带我去看看其他的房产?


Is my understanding so far off as to make this a pointless question and I should run back for the safe hills of C#, Java, and Python where I belong 😅? Or this is an IDE-issue and using something else (Eclipse? KDevelop? QT Creator Open Source?) would yield better results?

我的理解是不是太离谱了,以至于把这个问题变成了一个毫无意义的问题,我应该回到属于😅的C#、JAVA和PYTHON的安全山丘上?或者这是一个IDE问题,正在使用其他东西(Eclipse?凯文·戴夫?Qt Creator开源?)会产生更好的结果吗?


I did follow the CLion Documentation for setting up debug renderers. I used Lekensteyn's qt5printers, which at least allowed some basic types like QString to have a pretty view. But it seems like only a handful of the data types are accessible.

我确实遵循了Clion文档来设置调试呈现器。我使用的是Lekensteyn的qt5打印机,它至少允许一些基本类型,如QString,有一个漂亮的视图。但似乎只有少数数据类型是可访问的。


Background


I'm typically a C#, Java, and Python developer, but came across a bug in a tool I use that is C++/QT5 based. I'd like to build a bit more knowledge of real C++ development and thought this might be a good opportunity to dive in and see what I can figure out. I'm realizing I have possibly been spoiled by these languages and am a little lost on something that seems basic.

我通常是一名C#、Java和Python开发人员,但在我使用的一个基于C++/QT5的工具中遇到了一个错误。我想对真正的C++开发有更多的了解,我想这可能是一个很好的机会来深入研究,看看我能弄明白什么。我意识到我可能已经被这些语言宠坏了,对一些看似基本的东西有点迷失。


更多回答
优秀答案推荐

The memory management mechanism of C++ is quite different from those language you mentioned. For the m you provide is a pointer to c, so the value 0x1aa7120 is correct. It indicates the address in memory the pointer point to.

C++的内存管理机制与您提到的语言有很大的不同。因为您提供的m是指向c的指针,所以值0x1aa7120是正确的。它指示指针指向的内存中的地址。


If you want to see member variables or functions of m, then use -> operator, like m->checkIndex(). Here is the Qt official documentation for you: QModelIndex and QAbstractItemModel.

如果要查看m的成员变量或函数,请使用->运算符,如m->check Index()。这是Qt官方文档:QModelIndex和QAbstractItemModel。


By the way, if you are new to C++ and Qt, I would suggest to use Qt Creator as your IDE, which provides templates and documentations you can refer to.

顺便说一句,如果您是C++和Qt的新手,我建议您使用Qt Creator作为您的IDE,它提供了您可以参考的模板和文档。


更多回答

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com