Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QMetaProperty Class

TheQMetaProperty class provides meta-data about a property.More...

Header:#include <QMetaProperty>

Public Functions

QMetaEnumenumerator() const
boolhasNotifySignal() const
boolisConstant() const
boolisDesignable(const QObject * object = 0) const
boolisEnumType() const
boolisFinal() const
boolisFlagType() const
boolisReadable() const
boolisResettable() const
boolisScriptable(const QObject * object = 0) const
boolisStored(const QObject * object = 0) const
boolisUser(const QObject * object = 0) const
boolisValid() const
boolisWritable() const
const char *name() const
QMetaMethodnotifySignal() const
intnotifySignalIndex() const
intpropertyIndex() const
QVariantread(const QObject * object) const
boolreset(QObject * object) const
QVariant::Typetype() const
const char *typeName() const
intuserType() const
boolwrite(QObject * object, const QVariant & value) const

Detailed Description

TheQMetaProperty class provides meta-data about a property.

Property meta-data is obtained from an object's meta-object. SeeQMetaObject::property() andQMetaObject::propertyCount() for details.

Property Meta-Data

A property has aname() and atype(), as well as various attributes that specify its behavior:isReadable(),isWritable(),isDesignable(),isScriptable(), andisStored().

If the property is an enumeration,isEnumType() returns true; if the property is an enumeration that is also a flag (i.e. its values can be combined using the OR operator),isEnumType() andisFlagType() both return true. The enumerator for these types is available fromenumerator().

The property's values are set and retrieved withread(),write(), andreset(); they can also be changed throughQObject's set and get functions. SeeQObject::setProperty() andQObject::property() for details.

Copying and Assignment

QMetaProperty objects can be copied by value. However, each copy will refer to the same underlying property meta-data.

See alsoQMetaObject,QMetaEnum,QMetaMethod, andQt's Property System.

Member Function Documentation

QMetaEnum QMetaProperty::enumerator() const

Returns the enumerator if this property's type is an enumerator type; otherwise the returned value is undefined.

See alsoisEnumType() andisFlagType().

bool QMetaProperty::hasNotifySignal() const

Returns true if this property has a corresponding change notify signal; otherwise returns false.

See alsonotifySignal().

bool QMetaProperty::isConstant() const

Returns true if the property is constant; otherwise returns false.

A property is constant if theQ_PROPERTY()'sCONSTANT attribute is set.

This function was introduced in Qt 4.6.

bool QMetaProperty::isDesignable(constQObject * object = 0) const

Returns true if this property is designable for the givenobject; otherwise returns false.

If noobject is given, the function returns false if theQ_PROPERTY()'sDESIGNABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

See alsoisScriptable() andisStored().

bool QMetaProperty::isEnumType() const

Returns true if the property's type is an enumeration value; otherwise returns false.

See alsoenumerator() andisFlagType().

bool QMetaProperty::isFinal() const

Returns true if the property is final; otherwise returns false.

A property is final if theQ_PROPERTY()'sFINAL attribute is set.

This function was introduced in Qt 4.6.

bool QMetaProperty::isFlagType() const

Returns true if the property's type is an enumeration value that is used as a flag; otherwise returns false.

Flags can be combined using the OR operator. A flag type is implicitly also an enum type.

See alsoisEnumType(),enumerator(), andQMetaEnum::isFlag().

bool QMetaProperty::isReadable() const

Returns true if this property is readable; otherwise returns false.

See alsoisWritable(),read(), andisValid().

bool QMetaProperty::isResettable() const

Returns true if this property can be reset to a default value; otherwise returns false.

See alsoreset().

bool QMetaProperty::isScriptable(constQObject * object = 0) const

Returns true if the property is scriptable for the givenobject; otherwise returns false.

If noobject is given, the function returns false if theQ_PROPERTY()'sSCRIPTABLE attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

See alsoisDesignable() andisStored().

bool QMetaProperty::isStored(constQObject * object = 0) const

Returns true if the property is stored forobject; otherwise returns false.

If noobject is given, the function returns false if theQ_PROPERTY()'sSTORED attribute is false; otherwise returns true (if the attribute is true or is a function or expression).

See alsoisDesignable() andisScriptable().

bool QMetaProperty::isUser(constQObject * object = 0) const

Returns true if this property is designated as theUSER property, i.e., the one that the user can edit forobject or that is significant in some other way. Otherwise it returns false. e.g., thetext property is theUSER editable property of aQLineEdit.

Ifobject is null, the function returns false if theQ_PROPERTY()'sUSER attribute is false. Otherwise it returns true.

See alsoQMetaObject::userProperty(),isDesignable(), andisScriptable().

bool QMetaProperty::isValid() const

Returns true if this property is valid (readable); otherwise returns false.

See alsoisReadable().

bool QMetaProperty::isWritable() const

Returns true if this property is writable; otherwise returns false.

See alsoisReadable() andwrite().

constchar * QMetaProperty::name() const

Returns this property's name.

See alsotype() andtypeName().

QMetaMethod QMetaProperty::notifySignal() const

Returns theQMetaMethod instance of the property change notifying signal if one was specified, otherwise returns an invalidQMetaMethod.

This function was introduced in Qt 4.5.

See alsohasNotifySignal().

int QMetaProperty::notifySignalIndex() const

Returns the index of the property change notifying signal if one was specified, otherwise returns -1.

This function was introduced in Qt 4.6.

See alsohasNotifySignal().

int QMetaProperty::propertyIndex() const

Returns this property's index.

This function was introduced in Qt 4.6.

QVariant QMetaProperty::read(constQObject * object) const

Reads the property's value from the givenobject. Returns the value if it was able to read it; otherwise returns an invalid variant.

See alsowrite(),reset(), andisReadable().

bool QMetaProperty::reset(QObject * object) const

Resets the property for the givenobject with a reset method. Returns true if the reset worked; otherwise returns false.

Reset methods are optional; only a few properties support them.

See alsoread() andwrite().

QVariant::Type QMetaProperty::type() const

Returns this property's type. The return value is one of the values of theQVariant::Type enumeration.

See alsouserType(),typeName(), andname().

constchar * QMetaProperty::typeName() const

Returns the name of this property's type.

See alsotype() andname().

int QMetaProperty::userType() const

Returns this property's user type. The return value is one of the values that are registered withQMetaType, or 0 if the type is not registered.

This function was introduced in Qt 4.2.

See alsotype(),QMetaType, andtypeName().

bool QMetaProperty::write(QObject * object, constQVariant & value) const

Writesvalue as the property's value to the givenobject. Returns true if the write succeeded; otherwise returns false.

See alsoread(),reset(), andisWritable().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp