在VS中调试QT很奇怪地发现像QByteArray和QString等类型可以直接显示字符串
于是google一下,找到相关网页:
http://qt-project.org/forums/viewthread/7480
http://www.idigitalhouse.com/Blog/?p=83
才明白原来可以在
\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat
中添加信息,如:
[AutoExpand]
;QT_DEBUG_START (Qt Visual Studio Add-in v1.1.10)
QByteArray=<d->data,s> size=<d->size,u>
QPoint =x=<xp> y=<yp>
QPointF =x=<xp> y=<yp>
QRect =x1=<x1> y1=<y1> x2=<x2> y2=<y2>
QRectF =x=<xp> y=<yp> w=<w> h=<h>
QSize =width=<wd> height=<ht>
QSizeF =width=<wd> height=<ht>
QHash<*> =size=<d->size>
QVarLengthArray<*> =size=<s> data=<ptr>
;QT_DEBUG_END
[Visualizer]
;QT_DEBUG_START (Qt Visual Studio Add-in v1.1.10)
; Nokia Qt 4.x visualizers -----------------------------------------[ start ]--
;------------------------------------------------------------------------------
; Feel free to modify these visualizers to suit yours needs! But please let us
; know about the changes you make, so we continuously improve the visualizers.
QString|*::QString{
preview ([$e.d->data,su])
stringview ([$e.d->data,sub])
children
(
#(
d: $c.d,
[size]: $c.d->size,
[referenced]: $c.d->ref._q_value
)
)
}
QByteArray|*::QByteArray{
preview ([$e.d->data,s])
stringview ([$e.d->data,sb])
children
(
#(
d: $c.d,
[size]: $c.d->size,
[referenced]: $c.d->ref._q_value
)
)
}
这些应该就是安装QTVSAddin时写入的,明白了。
关于详细格式要求可以google下。