86狂战刷图加点qt加抗性怎么样

Qt属性系统详解 - 推酷
Qt属性系统详解
Qt提供了一个绝妙的属性系统。跟那些由编译器提供的属性差不多。然而,作为一个独立于编译器和平台的库,Qt不依赖于非标准的编译特性,比如__property 或[property]。Qt可以在任何平台上的标准编译器下编译。Qt属性系统基于元数据对象系统--就是那个提供了对象内置信号和槽通讯机制的家伙。
声明属性需要什么
要声明一个属性,需在继承自QObject的类中使用Q_PROPERTY()宏。
Q_PROPERTY(type name
& &READ getFunction
& &[WRITE setFunction]
& &[RESET resetFunction]
& &[NOTIFY notifySignal]
& &[DESIGNABLE bool]
& &[SCRIPTABLE bool]
& &[STORED bool]
& &[USER bool]
& &[CONSTANT]
& &[FINAL])
下面是一些典型的声明属性的示例:
Q_PROPERTY(bool focus READ hasFocus)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor)
一个属性的行为就像类的数据成员,但是它还具有附加的特性,这些特性可以被元数据对象系统操作。这些特性是:
需要一个READ访问器函数。用于读属性的值。理想情况下,有一个不变的函数用于此目的,并且它必须返回属性的类型的值或指针或引用。例如,QWidget::focus是一个只读的属性,它对应一个读函数:QWidget::hasFocus()。
一个可选的WRITE访问器函数。它用于设置属性的值。它必须返回空并且至少具有一个参数,参数是属性类型的值或指针或引用。例如:QWidget::enabled具有WRITE函数QWidget::setEnable()。只读属性不需要写函数。例如,QWidget::focus没有对应的写函数。
一个可选的RESET函数。用于设置属性的值到它的默认值。例如:QWidget::cursor具有典型的READ和WRITE函数,QWidget::cursor()和QWidget::setCursor(),并且它也具有一个RESET函数,QWidget::unsetCursor()。RESET函数必须返回void并且不带有任何参数。
一个可选的NOTIFY信号。如果被定义了,信号将在属性的值改变时发出。信号必须带有一个参数,这个参数的类型必须与属性相同;参数保存的是属性的新值。
一个DESIGNABLE变量表明此属性是否在界面设计器的属性编辑器中出现。大多数属性是可见的,除了为这个变量传入true或false,你还可以指定一个bool型的成员函数。
SCRIPTABLE变量表明这个属性是否可以被一个脚本引擎操作(默认是true)。你也可以赋予它true或false或bool型函数。
STORED变量表明了属性是否被认为是独立存在还是依赖于其它的值而存在。它也表明是否在保存对象状态时保存此属性的值。大多数属性都是需要保存的,但是,如QWidget::minimumWidth()就是不被保存的,因为它的值是从另一个属性QWidget::minimumSize()得来的。
USER变量表明属性是否被设计为面向用户的或用户可修改的类属性。通常,每个类只有一个USER属性。例如,QAbstractButton::checked是按钮类的用户可修改属性。注意QItemDelegate获取和设置widget的USER属性。
CONSTANT的出现表明属性的值是不变的。对于一个object实例,常量属性的READ方法在每次被调用时必须返回相同的值。此常量值可能在不同的object实例中不相同。一个常量属性不能具有WRITE方法或NOYIFY信号。
FINAL变量的出现表明属性不能被派生类所重写。有些情况下,这可以用于效率优化,但不是被moc强制的。程序员必须永远注意不能重写一个FINAL属性。
READ,WRITE和RESET函数都可以被继承。它们也可以是虚函数。当它们在被多重继承中被继承时,它们必须出现在第一个被继承的类中。
属性的类型可以是被QVariant支持的所有类型,也可以是用户定义的类型。在下面的例子中,类QDate被当作用户自定义类型。
Q_PROPERTY(QDate data READ getDate WRITE setDate)
因为QDate是用户定义的,你必须包含&QDate&头文件。
对于QMap,QList和QValueList属性,属性的值是一个QVariant,它包含整个list或map。注意Q_PROPERTY字符串不能包含逗号,因为逗号会划分宏的参数。因此,你必须使用QMap作为属性的类型而不是QMap&QString,QVariant&。为了保持一致性,也需要用QList和QValueList而不是QList&QVariant&和QValueList&QVariant&。
通过元数据对象系统读写属性
一个属性可以使用常规函数QObject::property()和QObject::setProperty()进行读写,不用知道属性所在类的任何细节,除了属性的名字。在下面的小代码片段中,调用QAbstractButton::setDown()和QObject::setProperty()都把属性设置为“down”。
QPushButton *button = new QPushB
QObject *object =
button-&setDown(true);
object-&setProperty(&down&, true);
通过WRITE操作器来操作一个属性是上面两者中更好的,因为它快并且在编译时给于更好的诊断帮助,但是以这种方式设置属性要求你必须在编译时了解其类。通过名字来操作属性使你可以操作在编译器你不了解的类。你可以在运行时发现一个类的属性们,通过查询它的QObject,QMetaObject和QMetaProerties。
QObject *object = ...
const QMetaObject *metaobject = object-&metaObject();
int count = metaobject-&propertyCount();
for (int i=0; i& ++i) {
QMetaProperty metaproperty = metaobject-&property(i);
const char *name = metaproperty.name();
QVariant value = object-&property(name);
在上面的代码片段中,QMetaObject::property()被用于获取未知类中的属性的metadata。从metadata中获取属性名然后传给QObject::property()来获取
一个简单例子
假设我们有一个类MyClass,它从QObject派生并且在它的private区使用 了Q_OBJECT宏。我们想在MyClass类中声明一个属性来持续追踪一个Priorty值。属性的值叫做priority,并且它的类型是一个在类MyClass中定义的叫做Priority的枚举。
我们在类的private区使用Q_PROPERTY()来声明属性。READ函数叫做priority,并且我们包含一个WRITE函数叫做setPriority。枚举类型必须使用Q_ENUMS()注册到元数据对象系统中。注册一个枚举类型使得枚举的名字可以在调用QObject::setProperty()时使用。我们还必须为READ和WRITE函数提供我们自己的声明。MyClass的声明看起来应该是这样的:
class MyClass : public QObject
Q_PROPERTY(Priority priority READ priority WRITE setPriority)
Q_ENUMS(Priority)
MyClass(QObject *parent = 0);
~MyClass();
enum Priority { High, Low, VeryHigh, VeryLow };
void setPriority(Priority priority);
Priority priority()
READ函数是const的并且返回属性的类型。WRITE函数返回void并且具有一个属性类型的参数。元数据对象编译器强制做这些事情。
在有了一个指向MyClass实例的指针时,我们有两种方法来设置priority属性:
MyClass *myinstance = new MyC
QObject *object =
myinstance-&setPriority(MyClass::VeryHigh);
object-&setProperty(&priority&, &VeryHigh&);
在此例子中,枚举类型在MyClass中声明并被使用Q_ENUMS()注册到元数据对象系统中。这使得枚举值可以在调用setProperty()时做为字符串使用。如果枚举类型是在其它类中声明的,那么我们就需要用枚举的全名(如OtherClass::Priority),并且这个其它类也必须从QObject中派生并且也要注册枚举类型。
另一个简单的Q_FLAGS()也是可用的。就像Q_ENUMS(),它注册一个枚举类型,但是它把枚举类型作为一个flag的集合,也就是,值可以用OR操作来合并。一个I/O类可能具有枚举值Read和Write并且QObject::setProperty()可以接受 Read|Write。此时应使用Q_FLAGS()来注册枚举值。
Qobject::setProperty()也可以用来在运行时向一个类的实例添加新的属性。当使用一个名字和值调用它时,如果一个对应的属性已经存在,并且如果值的类型与属性的类型兼容,那么值就被存储到属性中,然后返回true。如果值类型不兼容,属性的值就不会发生改变,就会返回false。但是如果对应名字的属性不存在,那么一个新的属性就诞生了,以传入的名字为名,以传入的值为值,但是依然会返回false。这表示返回值不能用于确定一个属性是否被设置值,除非你已经知道这个属性已经存在于QObject中了。
注意动态属性被添加到单个实现的基础中,也就是,被添加到QObject,而不是QMetaObject。一个属性可以从一个实例中删除,通过传入属性的名字和非法的QVariant值给QObject::setProperty()。默认的QVariant构造器构造一个非法的QVariant。
动态属性可用QObject::property()来查询,就行使用Q_PROPERTY()声明的属性一样。
属性和自定义类型
被属性使用的自定义类型需要使用Q_DECLARE_METATYPE()宏注册,以使它们的值能被保存在QVariant对象中。这使得它们可以用于被Q_PROPERTY()声明的静态类型中,也可以被用于动态类型中。
已发表评论数()
请填写推刊名
描述不能大于100个字符!
权限设置: 公开
仅自己可见
正文不准确
标题不准确
排版有问题
主题不准确
没有分页内容
图片无法显示
视频无法显示
与原文不一致1976人阅读
跨平台(15)
通用属性列表&&-&&List&of&Properties
下列表格中的Qt样式表支持所有的Qt控件,除非有特殊声明的,在列表中含有*号的表示和&CSS2&or&CSS3有很大区别的属性。
Description
alternate-background-color
The&&used&in&&subclasses.
If&this&property&is&not&set,&the&default&value&is&whatever&is&set&for&the&palette's&&role.
&QTreeView&{
&&&&&alternate-background-color:&
&&&&&background:&
See&also&&and&.
background
Shorthand&notation&for&setting&the&background.&Equivalent&to&specifying&background-color,&background-image,&background-repeat,&and/orbackground-position.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&,&,&and&plain&s.
&QTextEdit&{&background:&yellow&}
Often,&it&is&required&to&set&a&fill&pattern&similar&to&the&styles&in&.&You&can&use&the&background-color&property&for&,,&&and&.&The&other&patterns&are&easily&achieved&by&creating&a&background&image&that&contains&the&pattern.
&&&&&background-image:&url(dense6pattern.png);
&&&&&background-repeat:&repeat-
See&also&,&,&,&&and&.
background-color
The&background&color&used&for&the&widget.
&QLabel&{&background-color:&yellow&}
&QLineEdit&{&background-color:&rgb(255,&0,&0)&}
background-image
The&background&image&used&for&the&widget.&Semi-transparent&parts&of&the&image&let&the&background-color&shine&through.
&QFrame&{&background-image:&url(:/images/hydro.png)&}
background-repeat
Whether&and&how&the&background&image&is&repeated&to&fill&the&background-origin&rectangle.
If&this&property&is&not&specified,&the&background&image&is&repeated&in&both&directions&(repeat).
&&&&&background:&white&url(:/images/ring.png);
&&&&&background-repeat:&repeat-y;
&&&&&background-position:&
background-position
The&alignment&of&the&background&image&within&the&background-origin&rectangle.
If&this&property&is&not&specified,&the&alignment&is&top&left.
&&&&&background:&url(:/images/footer.png);
&&&&&background-position:&bottom&
background-attachment
Determines&whether&the&background-image&in&a&&is&scrolled&or&fixed&with&respect&to&the&viewport.&By&default,&the&background-image&scrolls&with&the&viewport.
&QTextEdit&{
&&&&&background-image:&url(&leaves.png&);
&&&&&background-attachment:&
background-clip
The&widget's&rectangle,&in&which&the&background&is&drawn.
This&property&specifies&the&rectangle&to&which&the&background-color&and&background-image&are&clipped.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&and&plain&s.
If&this&property&is&not&specified,&the&default&is&border.
&&&&&background-image:&url(:/images/header.png);
&&&&&background-position:&top&
&&&&&background-origin:&
&&&&&background-clip:&
See&also&,&&and&.
background-origin
The&widget's&background&rectangle,&to&use&in&conjunction&with&background-position&and&background-image.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&and&plain&s.
If&this&property&is&not&specified,&the&default&is&padding.
&&&&&background-image:&url(:/images/header.png);
&&&&&background-position:&top&
&&&&&background-origin:&
See&also&&and&.
Shorthand&notation&for&setting&the&widget's&border.&Equivalent&to&specifying&border-color,&border-style,&and/or&border-width.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&,&and&plain&s.
&QLineEdit&{&border:&1px&solid&white&}
border-top
Shorthand&notation&for&setting&the&widget's&top&border.&Equivalent&to&specifying&border-top-color,&border-top-style,&and/or&border-top-width.
border-right
Shorthand&notation&for&setting&the&widget's&right&border.&Equivalent&to&specifying&border-right-color,&border-right-style,&and/or&border-right-width.
border-bottom
Shorthand&notation&for&setting&the&widget's&bottom&border.&Equivalent&to&specifying&border-bottom-color,&border-bottom-style,&and/or&border-bottom-width.
border-left
Shorthand&notation&for&setting&the&widget's&left&border.&Equivalent&to&specifying&border-left-color,&border-left-style,&and/or&border-left-width.
border-color&
The&color&of&all&the&border's&edges.&Equivalent&to&specifying&border-top-color,&border-right-color,&border-bottom-color,&and&border-left-color.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&,&and&plain&s.
If&this&property&is&not&specified,&it&defaults&to&&(i.e.,&the&widget's&foreground&color).
&QLineEdit&{
&&&&&border-width:&1
&&&&&border-style:&
&&&&&border-color:&
See&also&,&,&,&and&.
border-top-color
The&color&of&the&border's&top&edge.
border-right-color
The&color&of&the&border's&right&edge.
border-bottom-color
The&color&of&the&border's&bottom&edge.
border-left-color
The&color&of&the&border's&left&edge.
border-image
The&image&used&to&fill&the&border.&The&image&is&cut&into&nine&parts&and&stretched&appropriately&if&necessary.&See&&for&details.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&&and&.
See&also&,&,&,&and&.
border-radius
The&radius&of&the&border's&corners.&Equivalent&to&specifying&border-top-left-radius,&border-top-right-radius,&border-bottom-right-radius,&and&border-bottom-left-radius.
The&border-radius&clips&the&element's&.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&and&.
If&this&property&is&not&specified,&it&defaults&to&0.
&QLineEdit&{
&&&&&border-width:&1
&&&&&border-style:&
&&&&&border-radius:&4
See&also&&and&.
border-top-left-radius
The&radius&of&the&border's&top-left&corner.
border-top-right-radius
The&radius&of&the&border's&top-right&corner.
border-bottom-right-radius
The&radius&of&the&border's&bottom-right&corner.&Setting&this&property&to&a&positive&value&results&in&a&rounded&corner.
border-bottom-left-radius
The&radius&of&the&border's&bottom-left&corner.&Setting&this&property&to&a&positive&value&results&in&a&rounded&corner.
border-style
The&style&of&all&the&border's&edges.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&and&.
If&this&property&is&not&specified,&it&defaults&to&none.
&QLineEdit&{
&&&&&border-width:&1
&&&&&border-style:&
&&&&&border-color:&
See&also&,&,&,&and&.
border-top-style
The&style&of&the&border's&top&edge.
border-right-style
The&style&of&the&border's&right&edge/
border-bottom-style
The&style&of&the&border's&bottom&edge.
border-left-style
The&style&of&the&border's&left&edge.
border-width
The&width&of&the&border.&Equivalent&to&setting&border-top-width,&border-right-width,&border-bottom-width,&and&border-left-width.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&and&.
&QLineEdit&{
&&&&&border-width:&2
&&&&&border-style:&
&&&&&border-color:&
See&also&,&,&,&,&and&.
border-top-width
The&width&of&the&border's&top&edge.
border-right-width
The&width&of&the&border's&right&edge.
border-bottom-width
The&width&of&the&border's&bottom&edge.
border-left-width
The&width&of&the&border's&left&edge.
If&&is&relative&(the&default),&moves&a&&by&a&certain&offset&&specifying&bottom:&y&is&then&equivalent&to&specifying&:&-y.
If&&is&absolute,&the&bottom&property&specifies&the&subcontrol's&bottom&edge&in&relation&to&the&parent's&bottom&edge&(see&also&).
&QSpinBox::down-button&{&bottom:&2px&}
See&also&,&,&and&.
button-layout
The&layout&of&buttons&in&a&&or&a&.&The&possible&values&are&0&(),&1&(),&2&(),&and&3&().
If&this&property&is&not&specified,&it&defaults&to&the&value&specified&by&the&current&style&for&the&&style&hint.
&*&{&button-layout:&2&}
The&color&used&to&render&text.
This&property&is&supported&by&all&widgets&that&respect&the&.
If&this&property&is&not&set,&the&default&is&whatever&is&set&for&in&the&widget's&palette&for&the&QWidget::foregroundRole&(typically&black).
&QPushButton&{&color:&red&}
See&also&&and&.
dialogbuttonbox-buttons-have-icons
Whether&the&buttons&in&a&&show&icons
If&this&property&is&set&to&1,&the&buttons&of&a&&show&&if&it&is&set&to&0,&the&icons&are&not&shown.
See&the&&section&for&information&on&how&to&set&icons.
&QDialogButtonBox&{&dialogbuttonbox-buttons-have-icons:&1;&}
Note:&Styles&defining&this&property&must&be&applied&before&the&&is&&this&means&that&you&must&apply&the&style&to&the&parent&widget&or&to&the&application&itself.
Shorthand&notation&for&setting&the&text's&font.&Equivalent&to&specifying&font-family,&font-size,&font-style,&and/or&font-weight.
This&property&is&supported&by&all&widgets&that&respect&the&.
If&this&property&is&not&set,&the&default&is&the&.
&QCheckBox&{&font:&bold&italic&large&&Times&New&Roman&&}
font-family
The&font&family.
&QCheckBox&{&font-family:&&New&Century&Schoolbook&&}
The&font&size.&In&this&version&of&Qt,&only&pt&and&px&metrics&are&supported.
&QTextEdit&{&font-size:&12px&}
font-style
The&font&style.
&QTextEdit&{&font-style:&italic&}
font-weight
The&weight&of&the&font.
gridline-color*
The&color&of&the&grid&line&in&a&.
If&this&property&is&not&specified,&it&defaults&to&the&value&specified&by&the&current&style&for&the&&style&hint.
&*&{&gridline-color:&gray&}
The&height&of&a&&(or&in&some&case,&a&widget).
If&this&property&is&not&specified,&it&defaults&to&a&value&that&depends&on&the&subcontrol/widget&and&on&the&current&style.
Warning:&Unless&otherwise&specified,&this&property&has&no&effect&when&set&on&widgets.&If&you&want&a&widget&with&a&fixed&height,&set&the&&and&&to&the&same&value.
&QSpinBox::down-button&{&height:&10px&}
See&also&.
The&width&and&height&of&the&icon&in&a&widget.
The&icon&size&of&the&following&widgets&can&be&set&using&this&property.
The&image&that&is&drawn&in&the&contents&rectangle&of&a&.
The&image&property&accepts&a&list&of&s&or&an&svg.&The&actual&image&that&is&drawn&is&determined&using&the&same&algorithm&as&&(i.e)&the&image&is&never&scaled&up&but&always&scaled&down&if&necessary.&If&a&svg&is&specified,&the&image&is&scaled&to&the&size&of&the&contents&rectangle.
Setting&the&image&property&on&sub&controls&implicitly&sets&the&width&and&height&of&the&sub-control&(unless&the&image&in&a&SVG).
In&Qt&4.3&and&later,&the&alignment&of&the&image&within&the&rectangle&can&be&specified&using&.
This&property&is&for&s&only--we&don't&support&it&for&other&elements.
Warning:&The&&SVG&plugin&is&needed&to&render&SVG&images.
&/*&implicitly&sets&the&size&of&down-button&to&the&size&of&spindown.png&*/
&QSpinBox::down-button&{&image:&url(:/images/spindown.png)&}
image-position
In&Qt&4.3&and&later,&the&alignment&of&the&image&image's&position&can&be&specified&using&relative&or&absolute&position.
If&&is&relative&(the&default),&moves&a&&by&a&certain&offset&to&the&right.
If&&is&absolute,&the&left&property&specifies&the&subcontrol's&left&edge&in&relation&to&the&parent's&left&edge&(see&also&).
If&this&property&is&not&specified,&it&defaults&to&0.
&QSpinBox::down-button&{&left:&2px&}
See&also&,&,&and&.
lineedit-password-character*
The&&password&character&as&a&Unicode&number.
If&this&property&is&not&specified,&it&defaults&to&the&value&specified&by&the&current&style&for&the&&style&hint.
&*&{&lineedit-password-character:&9679&}
The&widget's&margins.&Equivalent&to&specifying&margin-top,&margin-right,&margin-bottom,&and&margin-left.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&and&.
If&this&property&is&not&specified,&it&defaults&to&0.
&QLineEdit&{&margin:&2px&}
See&also&,&,&and&.
margin-top
The&widget's&top&margin.
margin-right
The&widget's&right&margin.
margin-bottom
The&widget's&bottom&margin.
margin-left
The&widget's&left&margin.
max-height
The&widget's&or&a&subcontrol's&maximum&height.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&,&,&,&and&.
The&value&is&relative&to&the&contents&rect&in&the&.
&QSpinBox&{&max-height:&24px&}
See&also&.
The&widget's&or&a&subcontrol's&maximum&width.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&,&,&,&and&.
The&value&is&relative&to&the&contents&rect&in&the&.
&QComboBox&{&max-width:&72px&}
See&also&.
messagebox-text-interaction-flags*
The&interaction&behavior&for&text&in&a&message&box.&Possible&values&are&based&on&.
If&this&property&is&not&specified,&it&defaults&to&the&value&specified&by&the&current&style&for&the&&style&hint.
&QMessageBox&{&messagebox-text-interaction-flags:&5&}
min-height
The&widget's&or&a&subcontrol's&minimum&height.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&,&,&,&and&.
If&this&property&is&not&specified,&the&minimum&height&is&derived&based&on&the&widget's&contents&and&the&style.
The&value&is&relative&to&the&contents&rect&in&the&.
&QComboBox&{&min-height:&24px&}
See&also&.
The&widget's&or&a&subcontrol's&minimum&width.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&,&,&,&and&.
If&this&property&is&not&specified,&the&minimum&width&is&derived&based&on&the&widget's&contents&and&the&style.
The&value&is&relative&to&the&contents&rect&in&the&.
&QComboBox&{&min-width:&72px&}
See&also&.
The&opacity&for&a&widget.&Possible&values&are&from&0&(transparent)&to&255&(opaque).&For&the&moment,&this&is&only&supported&for&.
If&this&property&is&not&specified,&it&defaults&to&the&value&specified&by&the&current&style&for&the&&style&hint.
&QToolTip&{&opacity:&223&}
The&widget's&padding.&Equivalent&to&specifying&padding-top,&padding-right,&padding-bottom,&and&padding-left.
This&property&is&supported&by&&subclasses,&&subclasses,&,&,&,&,&,,&,&,&,&,&,&,&and&.
If&this&property&is&not&specified,&it&defaults&to&0.
&QLineEdit&{&padding:&3px&}
See&also&,&,&and&.
padding-top
The&widget's&top&padding.
padding-right
The&widget's&right&padding.
padding-bottom
The&widget's&bottom&padding.
padding-left
The&widget's&left&padding.
paint-alternating-row-colors-for-empty-area
Whether&the&&paints&alternating&row&colors&for&the&empty&area&(i.e&the&area&where&there&are&no&items)
|&absolute
Whether&offsets&specified&using&,&,&,&and&&are&relative&or&absolute&coordinates.
If&this&property&is&not&specified,&it&defaults&to&relative.
If&&is&relative&(the&default),&moves&a&&by&a&certain&offset&to&the&&specifying&right:&x&is&then&equivalent&to&specifying&:&-x.
If&&is&absolute,&the&right&property&specifies&the&subcontrol's&right&edge&in&relation&to&the&parent's&right&edge&(see&also&).
&QSpinBox::down-button&{&right:&2px&}
See&also&,&,&and&.
selection-background-color*
The&background&of&selected&text&or&items.
This&property&is&supported&by&all&widgets&that&respect&the&&and&that&show&selection&text.
If&this&property&is&not&set,&the&default&value&is&whatever&is&set&for&the&palette's&&role.
&QTextEdit&{&selection-background-color:&darkblue&}
See&also&&and&.
selection-color*
The&foreground&of&selected&text&or&items.
This&property&is&supported&by&all&widgets&that&respect&the&&and&that&show&selection&text.
If&this&property&is&not&set,&the&default&value&is&whatever&is&set&for&the&palette's&&role.
&QTextEdit&{&selection-color:&white&}
See&also&&and&.
show-decoration-selected*
Controls&whether&selections&in&a&&cover&the&entire&row&or&just&the&extent&of&the&text.
If&this&property&is&not&specified,&it&defaults&to&the&value&specified&by&the&current&style&for&the&&style&hint.
&*&{&show-decoration-selected:&1&}
Internal&spacing&in&the&widget.
This&property&is&supported&by&,&checkable&es,&,&and&.
If&this&property&is&not&specified,&the&default&value&depends&on&the&widget&and&on&the&current&style.
&QMenuBar&{&spacing:&10&}
See&also&&and&.
subcontrol-origin*
The&origin&rectangle&of&the&&within&the&parent&element.
If&this&property&is&not&specified,&the&default&is&padding.
&QSpinBox::up-button&{
&&&&&image:&url(:/images/spinup.png);
&&&&&subcontrol-origin:&
&&&&&subcontrol-position:&right&
See&also&.
subcontrol-position*
The&alignment&of&the&&within&the&origin&rectangle&specified&by&.
If&this&property&is&not&specified,&it&defaults&to&a&value&that&depends&on&the&subcontrol.
&QSpinBox::down-button&{
&&&&&image:&url(:/images/spindown.png);
&&&&&subcontrol-origin:&
&&&&&subcontrol-position:&right&
See&also&.
text-align
The&alignment&of&text&and&icon&within&the&contents&of&the&widget.
If&this&value&is&not&specified,&it&defaults&to&the&value&that&depends&on&the&native&style.
&QPushButton&{
&&&&&text-align:&
This&property&is&currently&supported&only&by&&and&.
text-decoration
underline&
line-through
Additional&text&effects
If&&is&relative&(the&default),&moves&a&&by&a&certain&offset&down.
If&&is&absolute,&the&top&property&specifies&the&subcontrol's&top&edge&in&relation&to&the&parent's&top&edge&(see&also&).
If&this&property&is&not&specified,&it&defaults&to&0.
&QSpinBox::up-button&{&top:&2px&}
See&also&,&,&and&.
The&width&of&a&&(or&a&widget&in&some&cases).
If&this&property&is&not&specified,&it&defaults&to&a&value&that&depends&on&the&subcontrol/widget&and&on&the&current&style.
Warning:&Unless&otherwise&specified,&this&property&has&no&effect&when&set&on&widgets.&If&you&want&a&widget&with&a&fixed&width,&set&the&&and&&to&the&same&value.
&QSpinBox::up-button&{&width:&12px&}
See&also&.
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:416909次
积分:5557
积分:5557
排名:第3504名
原创:150篇
转载:25篇
评论:142条
阅读:17111
(7)(1)(5)(1)(2)(7)(7)(2)(1)(5)(4)(5)(2)(1)(2)(8)(2)(2)(1)(1)(2)(1)(4)(1)(10)(13)(10)(4)(5)(4)(4)(6)(5)(40)(2)}

我要回帖

更多关于 86级狂战刷图加点 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信