1. QtGui中调出控制台窗口
项目属性中链接器子系统选择控制台
2. QVariant示例
QVariant 本质是一个Union,可以为任意的数据类型
#include "widget.h"
#include <QDebug>
#include <QVariant>
#include <QColor>
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
//ui.setupUi(this);
QVariant v(709);
qDebug() << v.toInt();
QVariant w("How are you!");
qDebug() << w.toString();
QMap<QString, QVariant>map;
map["int"] = 709;
map["double"] = 709.709;
map.insert("string", "how old are you");
map.insert("color", QColor(255, 0, 0));
qDebug() << map["int"] << map["int"].toInt();
qDebug() << map["double"] << map["double"].toDouble();
qDebug() << map["string"] << map["string"].toString();
qDebug() << map["color"] << map["color"].value<QColor>();
}