Qt QSS中 background-image,border-image,以及image属性差别
admin
2024-02-24 13:58:54
0

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)区域,iamge只能缩小,不能放大,与设置QIcon表现一样。
        例如Qcheckbox中有indictor控件,indictor子控件背景图片样式可以这样设置:
QCheckBox::indicator:unchecked {
     image: url(:/images/checkbox_unchecked.png);
 }

相关内容

热门资讯

安卓系统应用数据目录,揭秘系统... 你有没有想过,你的安卓手机里那些应用,它们的数据都藏在哪个角落呢?今天,就让我带你一探究竟,揭开安卓...
kindle 安卓 系统 刷机... 亲爱的读者们,你是不是也和我一样,对电子阅读设备情有独钟?尤其是那款小巧便携的Kindle,简直是阅...
平板 win 安卓 双系统,... 你有没有想过,拥有一台既能运行Windows系统,又能流畅使用安卓应用的多功能平板电脑,是不是能让你...
电脑安卓和苹果系统,电脑操作系... 你有没有发现,现在无论是工作还是娱乐,电脑已经成了我们生活中不可或缺的好伙伴呢!而在这众多电脑中,安...
手机安卓系统下载5.0,引领智... 你有没有发现,最近手机界又掀起了一股热潮?没错,就是安卓系统5.0的下载。这可是安卓家族里的一大亮点...
小森生活系统安卓,打造绿色生态... 你知道吗?最近在手机应用市场上,有个叫做“小森生活系统安卓”的新玩意儿火得一塌糊涂。它就像一个神奇的...
王者荣耀安卓系统更换,畅享全新... 最近是不是发现你的王者荣耀游戏体验有点不对劲?别急,让我来给你揭秘一下安卓系统更换背后的那些事儿!一...
ios系统数据如何导入安卓系统... 你是不是也有过这样的经历:手机里存满了珍贵的照片、视频和联系人,突然有一天,你决定换一台安卓手机,却...
王者荣耀启动安卓系统,畅享指尖... 你知道吗?最近王者荣耀可是大动作连连,竟然宣布要启动安卓系统了!这消息一出,瞬间在游戏圈引起了不小的...
安卓始终显示系统栏,安卓系统栏... 你是不是也遇到了这个问题?手机屏幕上那个讨厌的系统栏,有时候它就像一个顽皮的小鬼,总是赖在你的屏幕上...
苹果系统可以装在安卓,探索跨平... 你知道吗?最近在科技圈里可是掀起了一股热潮呢!那就是——苹果系统竟然可以装在安卓设备上!是不是听起来...
安卓系统双清目的,安卓系统双清... 你知道吗?最近在安卓系统圈子里,有个话题可是热得不得了,那就是“双清”。别小看这个“双清”,它可是关...
安卓系统台电平板,畅享智能生活... 你有没有发现,最近身边的朋友都开始讨论起一款叫做台电的安卓系统平板电脑呢?这可不是随便说说,这款平板...
三菱安卓系统,智能科技与驾驶体... 亲爱的读者,你是否曾好奇过,那些在我们生活中默默无闻的汽车品牌,它们是如何将科技与驾驶体验完美结合的...
安卓系统为什么好,引领智能生活... 你有没有发现,身边的朋友、同事,甚至家人,几乎人手一台安卓手机?这可不是偶然现象哦!安卓系统,这个来...
安卓如何改键盘系统,Andro... 你是不是也和我一样,对安卓手机的键盘系统有点儿不满意?想要换一个更顺手的键盘,但又不知道怎么操作?别...
怎么升级安卓14系统,解锁安卓... 你有没有发现,你的安卓手机最近是不是有点儿慢吞吞的?别急,别急,升级到安卓14系统,让你的手机焕发新...
安卓手机如何系统内录,轻松生成... 你有没有想过,有时候想要记录下手机里的精彩瞬间,却发现没有合适的工具?别急,今天就来教你怎么在安卓手...
最绚丽的安卓系统,最绚丽版本全... 哇,你知道吗?在安卓的世界里,有一款系统,它就像是一颗璀璨的明珠,闪耀着最绚丽的色彩。它就是——最绚...
小米系统安卓通知权限,深度解析... 亲爱的手机控们,你是否曾为手机通知栏里乱糟糟的信息而烦恼?又或者,你是否好奇过,为什么有些应用总是能...