重定向 QObject::dumpObjectInfo()
是否可以获取 QObject::dumpObjectInfo() 的输出并通过 qDebug 通道以外的其他方式显示它?理想情况下,我想将此方法的输出转换为字符串。
Is it possible to get the output of QObject::dumpObjectInfo() and display it through something other than the qDebug channel? Ideally, I would like to get the output of this method into a string.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,这是不可能的,因为
qDebug()
调用在方法中被硬编码:http://qt.gitorious.org/qt/qt/blobs/fd529383c4491580db344fb3d8035bd0ad3cb5e0/src/corelib/kernel/qobject.cpp#line3689但是您可以通过安装消息处理程序来重定向调试通道本身:<一href="http://developer.qt.nokia.com/doc/qt-4.8/qtglobal.html#qInstallMsgHandler" rel="nofollow">http://developer.qt.nokia.com/doc/qt-4.8 /qtglobal.html#qInstallMsgHandler
No, it is impossible due to
qDebug()
calls are hardcoded in the method: http://qt.gitorious.org/qt/qt/blobs/fd529383c4491580db344fb3d8035bd0ad3cb5e0/src/corelib/kernel/qobject.cpp#line3689But you can redirect debug channel itself by installing message handler: http://developer.qt.nokia.com/doc/qt-4.8/qtglobal.html#qInstallMsgHandler