在QT的学习过程中,调试是非常重要的,单步调试慢慢的让你更容易理解
学习qt调试
1. 使用警告和调试信息
qDubug():输出调试信息
Example:
qDebug( "my window handle = %x", myWidget->id() );
qWarning():输出警告信息
Example:
void f( int c )
{
if ( c > 200 )
qWarning( "f: bad argument, c == %d", c );
}
qFatal():输出致命错误信息 ,程序自动被迫中止
Example:
int divide( int a, int b )
{
if ( b == 0 ) // program error
qFatal( "divide: cannot divide by zero" );
return a/b;
}
使用例子:
#include <qapplica