QMetaPropertyclass provides meta-data about a property. 更多 …
def
enumerator
()
def
hasNotifySignal
()
def
hasStdCppSet
()
def
isConstant
()
def
isDesignable
([obj=None])
def
isEditable
([obj=None])
def
isEnumType
()
def
isFinal
()
def
isFlagType
()
def
isReadable
()
def
isRequired
()
def
isResettable
()
def
isScriptable
([obj=None])
def
isStored
([obj=None])
def
isUser
([obj=None])
def
isValid
()
def
isWritable
()
def
name
()
def
notifySignal
()
def
notifySignalIndex
()
def
propertyIndex
()
def
read
(obj)
def
readOnGadget
(gadget)
def
relativePropertyIndex
()
def
reset
(obj)
def
resetOnGadget
(gadget)
def
revision
()
def
type
()
def
typeName
()
def
userType
()
def
write
(obj, value)
def
writeOnGadget
(gadget, value)
Property meta-data is obtained from an object’s meta-object. See
property()andpropertyCount()了解细节。
A property has a
name()和type(), as well as various attributes that specify its behavior:isReadable(),isWritable(),isDesignable(),isScriptable(),revision(),和isStored().If the property is an enumeration,
isEnumType()返回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 with
read(),write(),和reset(); they can also be changed throughQObject‘s set and get functions. SeesetProperty()andproperty()了解细节。
QMetaPropertyobjects can be copied by value. However, each copy will refer to the same underlying property meta-data.
QMetaProperty
¶
QMetaProperty(QMetaProperty)
QMetaProperty
–
QMetaProperty
PySide2.QtCore.QMetaProperty.
enumerator
(
)
¶
Returns the enumerator if this property’s type is an enumerator type; otherwise the returned value is undefined.
另请参阅
PySide2.QtCore.QMetaProperty.
hasNotifySignal
(
)
¶
bool
返回
true
if this property has a corresponding change notify signal; otherwise returns
false
.
另请参阅
PySide2.QtCore.QMetaProperty.
hasStdCppSet
(
)
¶
bool
返回
true
if the property has a C++ setter function that follows Qt’s standard “name” / “setName” pattern. Designer and uic query in order to avoid expensive
setProperty()
calls. All properties in Qt [should] follow this pattern.
PySide2.QtCore.QMetaProperty.
isConstant
(
)
¶
bool
返回
true
if the property is constant; otherwise returns
false
.
A property is constant if the
Q_PROPERTY()
‘s
CONSTANT
attribute is set.
PySide2.QtCore.QMetaProperty.
isDesignable
(
[
obj=None
]
)
¶
obj
–
QObject
bool
返回
true
if this property is designable for the given
object
;否则返回
false
.
若无
object
is given, the function returns
false
若
Q_PROPERTY()
‘s
DESIGNABLE
attribute is false; otherwise returns
true
(if the attribute is true or is a function or expression).
另请参阅
PySide2.QtCore.QMetaProperty.
isEditable
(
[
obj=None
]
)
¶
obj
–
QObject
bool
注意
此函数被弃用。
返回
true
if the property is editable for the given
object
;否则返回
false
.
若无
object
is given, the function returns
false
若
Q_PROPERTY()
‘s
EDITABLE
attribute is false; otherwise returns true (if the attribute is true or is a function or expression).
PySide2.QtCore.QMetaProperty.
isEnumType
(
)
¶
bool
返回
true
if the property’s type is an enumeration value; otherwise returns
false
.
另请参阅
PySide2.QtCore.QMetaProperty.
isFinal
(
)
¶
bool
返回
true
if the property is final; otherwise returns
false
.
A property is final if the
Q_PROPERTY()
‘s
FINAL
attribute is set.
PySide2.QtCore.QMetaProperty.
isFlagType
(
)
¶
bool
返回
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.
PySide2.QtCore.QMetaProperty.
isReadable
(
)
¶
bool
返回
true
if this property is readable; otherwise returns
false
.
另请参阅
PySide2.QtCore.QMetaProperty.
isRequired
(
)
¶
bool
返回
true
if the property is required; otherwise returns
false
.
A property is final if the
Q_PROPERTY()
‘s
REQUIRED
attribute is set.
PySide2.QtCore.QMetaProperty.
isResettable
(
)
¶
bool
返回
true
if this property can be reset to a default value; otherwise returns
false
.
另请参阅
PySide2.QtCore.QMetaProperty.
isScriptable
(
[
obj=None
]
)
¶
obj
–
QObject
bool
返回
true
if the property is scriptable for the given
object
;否则返回
false
.
若无
object
is given, the function returns
false
若
Q_PROPERTY()
‘s
SCRIPTABLE
attribute is false; otherwise returns true (if the attribute is true or is a function or expression).
另请参阅
PySide2.QtCore.QMetaProperty.
isStored
(
[
obj=None
]
)
¶
obj
–
QObject
bool
返回
true
if the property is stored for
object
;否则返回 false。
若无
object
is given, the function returns
false
若
Q_PROPERTY()
‘s
STORED
attribute is false; otherwise returns true (if the attribute is true or is a function or expression).
PySide2.QtCore.QMetaProperty.
isUser
(
[
obj=None
]
)
¶
obj
–
QObject
bool
返回
true
if this property is designated as the
USER
property, i.e., the one that the user can edit for
object
or that is significant in some other way. Otherwise it returns false. e.g., the
text
property is the
USER
editable property of a
QLineEdit
.
若
object
is
None
, the function returns
false
若
Q_PROPERTY()
‘s
USER
attribute is false. Otherwise it returns true.
PySide2.QtCore.QMetaProperty.
isValid
(
)
¶
bool
返回
true
if this property is valid (readable); otherwise returns
false
.
另请参阅
PySide2.QtCore.QMetaProperty.
isWritable
(
)
¶
bool
返回
true
if this property is writable; otherwise returns false.
另请参阅
PySide2.QtCore.QMetaProperty.
name
(
)
¶
str
Returns this property’s name.
另请参阅
PySide2.QtCore.QMetaProperty.
notifySignal
(
)
¶
返回
QMetaMethod
instance of the property change notifying signal if one was specified, otherwise returns an invalid
QMetaMethod
.
另请参阅
PySide2.QtCore.QMetaProperty.
notifySignalIndex
(
)
¶
int
Returns the index of the property change notifying signal if one was specified, otherwise returns -1.
另请参阅
PySide2.QtCore.QMetaProperty.
propertyIndex
(
)
¶
int
Returns this property’s index.
PySide2.QtCore.QMetaProperty.
read
(
obj
)
¶
obj
–
QObject
object
Reads the property’s value from the given
object
. Returns the value if it was able to read it; otherwise returns an invalid variant.
另请参阅
PySide2.QtCore.QMetaProperty.
readOnGadget
(
gadget
)
¶
gadget
–
void
object
Reads the property’s value from the given
gadget
. Returns the value if it was able to read it; otherwise returns an invalid variant.
This function should only be used if this is a property of a
Q_GADGET
PySide2.QtCore.QMetaProperty.
relativePropertyIndex
(
)
¶
int
Returns this property’s index relative within the enclosing meta object.
PySide2.QtCore.QMetaProperty.
reset
(
obj
)
¶
obj
–
QObject
bool
Resets the property for the given
object
with a reset method. Returns
true
if the reset worked; otherwise returns
false
.
Reset methods are optional; only a few properties support them.
PySide2.QtCore.QMetaProperty.
resetOnGadget
(
gadget
)
¶
gadget
–
void
bool
Resets the property for the given
gadget
with a reset method. Returns
true
if the reset worked; otherwise returns
false
.
Reset methods are optional; only a few properties support them.
This function should only be used if this is a property of a
Q_GADGET
PySide2.QtCore.QMetaProperty.
revision
(
)
¶
int
Returns the property revision if one was specified by REVISION, otherwise returns 0.
PySide2.QtCore.QMetaProperty.
type
(
)
¶
QVariant::Type
Returns this property’s type. The return value is one of the values of the
Type
enumeration.
另请参阅
PySide2.QtCore.QMetaProperty.
typeName
(
)
¶
str
Returns the name of this property’s type.
PySide2.QtCore.QMetaProperty.
userType
(
)
¶
int
Returns this property’s user type. The return value is one of the values that are registered with
QMetaType
,或
UnknownType
if the type is not registered.
另请参阅
type()
QMetaType
typeName()
PySide2.QtCore.QMetaProperty.
write
(
obj
,
value
)
¶
obj
–
QObject
value – object
bool
写入
value
as the property’s value to the given
object
. Returns true if the write succeeded; otherwise returns
false
.
若
value
is not of the same type type as the property, a conversion is attempted. An empty QVariant() is equivalent to a call to
reset()
if this property is resetable, or setting a default-constructed object otherwise.
另请参阅
PySide2.QtCore.QMetaProperty.
writeOnGadget
(
gadget
,
value
)
¶
gadget
–
void
value – object
bool
写入
value
as the property’s value to the given
gadget
. Returns true if the write succeeded; otherwise returns
false
.
This function should only be used if this is a property of a
Q_GADGET