Qt struct应用

来源:互联网 发布:淘宝店铺模板修改 编辑:程序博客网 时间:2024/05/21 18:17
#include <QtDebug>
#include <QVariant>
struct Test
 {    
         QString str;
         operator QVariant() const
         {
                  return QVariant::fromValue(*this);
         }
 };
 Q_DECLARE_METATYPE(Test)
//qRegisterMetaType<Test>(); //注册  跨线程使用信号槽
inline QDebug operator<< (QDebug debug, const Test& t)
{        
        debug.nospace() << "Test("                << t.str << ")";        return debug.space();
}
原创粉丝点击