Qt QSS中 background

您所在的位置:网站首页 icon和image的区别 Qt QSS中 background

Qt QSS中 background

2024-05-28 00:28| 来源: 网络整理| 查看: 265

background-image:

qt中the style reference中介绍:         The background image used for the widget. Semi-transparent parts of the image let the background-color shine through.Example:         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). Example:         指定部件背景,填充背景方式受background-repeat方式影响,如果图片过小,将会图片裁剪填充其他区域;过大,截取一部分区域填充。

border-image:

qt中the style reference中介绍:         The image used to fill the border. The image is cut into nine parts and stretched appropriately if necessary. See Border Image for details         A border image is an image that is composed of nine parts (top left, top center, top right, center left, center, center right, bottom left, bottom center, and bottom right). When a border of a certain size is required, the corner parts are used as is, and the top, right, bottom, and left parts are stretched or repeated to produce a border with the desired size.See the CSS3 Draft Specification for details.

意思:

        border-image用来填充部件的border区域,border-image会被分割成9部分,已边拉伸适应部件的border区域,一般来说,设置部件的背景,最好使用该属性,会自适应部件区域大小。

image:

qt中the style reference中介绍:         The image that is drawn in the contents rectangle of a subcontrol.The image property accepts a list of Urls or an svg. The actual image that is drawn is determined using the same algorithm as QIcon (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 image-position. This property is for subcontrols only--we don't support it for other elements. 意思:         image用来绘制子控件的内容(content)区域,image只能缩小,不能放大,与设置QIcon表现一样。         例如Qcheckbox中有indictor控件,indictor子控件背景图片样式可以这样设置: QCheckBox::indicator:unchecked {      image: url(:/images/checkbox_unchecked.png);  }



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3