QT中的Q_PROPERTY? [英] Q_PROPERTY in Qt?

查看:1123
本文介绍了QT中的Q_PROPERTY?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法真正弄清楚为什么我需要它,请阅读:
http://doc.qt.io/qt-4.8/properties.html#requirements-for-declaring-properties

I cant really figure out why do I need it, Been reading: http://doc.qt.io/qt-4.8/properties.html#requirements-for-declaring-properties

仍然不能真正理解它的使用。
任何种类的帮助将是巨大的!

still cant really understand the use of it. any kind of help would be great!

推荐答案

阅读 Qt属性系统,这就像一个通常的类方法,但它可以与Qt的元对象系统一起使用:

Read about the Qt Property System , this is just like a usual class method but it can be used with Qt's meta-object system:

 QPushButton *button = new QPushButton;
 QObject *object = button;

 button->setDown(true);
 object->setProperty("down", true);

这些属性也将在Qt Designer下可见,因此您可以创建一个自定义窗口部件,请在Qt Designer中进行关联,请参阅本文详情。

Also these properties will be visible under Qt Designer too so you could create a custom widget with some properties and hook it up in Qt Designer, see this article for details.

这篇关于QT中的Q_PROPERTY?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆