Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1040979
  • 博文数量: 264
  • 博客积分: 6005
  • 博客等级: 大校
  • 技术积分: 2798
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-08 20:15
文章分类

全部博文(264)

文章存档

2011年(42)

2010年(213)

2009年(4)

2008年(2)

2007年(3)

分类: C/C++

2011-02-27 20:04:19

#include
#include
#include



struct MyStruct
{
    int i;
};

Q_DECLARE_METATYPE(MyStruct)



int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    MyStruct s;
    s.i = 999;
    QVariant var;
    var.setValue(s); // copy s into the variant

    MyStruct s2 = var.value();
    QVariant::Type type = var.type();

    int value = s2.i;

    return a.exec();
}

阅读(2789) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~