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);
 }

相关内容

热门资讯

手机在安装安卓系统,从解锁Bo... 手机在安装安卓系统:你的专属升级之旅想象你的手机就像一辆老式老爷车,虽然坚固耐用,但已经跟不上时代的...
安卓怎样释放系统空间,高效清理... 手机里的空间总是不够用,是不是你也和我一样,时不时地收到“存储空间不足”的提醒?别急,今天就来教你几...
联想安卓系统广告关闭,享受清爽... 亲爱的手机控们,你们是不是也和我一样,对安卓手机上的广告感到无比烦恼呢?那些无处不在的广告,不仅占用...
系统映像安卓系统x86,PC端... 哇,你有没有想过,在电脑上也能畅玩安卓游戏,体验安卓应用呢?没错,这就是今天我要跟你分享的神奇之旅—...
安卓系统屏幕下端按钮,功能解析... 亲爱的手机控们,你是否曾为安卓系统屏幕下端的那些小按钮而感到好奇呢?它们看似平凡,却隐藏着大大的秘密...
安卓系统如何调头像,Andro... 亲爱的手机控们,你们有没有想过,手机里的头像可是我们个性的小标志呢!今天,就让我来带你一起探索如何在...
安卓系统怎么把照片,Andro... 你有没有想过,手机里的照片怎么才能变得井井有条呢?尤其是安卓系统,操作起来是不是有点小复杂?别急,今...
安卓360强刷系统,安卓360... 你那安卓手机是不是已经卡到不行了?别急,今天就来教你一招——安卓360强刷系统!这可不是什么高深莫测...
什么系统安卓手机通用,基于通用... 你有没有想过,为什么你的安卓手机不能像电脑那样,随心所欲地安装各种版本的安卓系统呢?今天,就让我带你...
windows远程安卓系统下载... 哇,你有没有想过,在Windows电脑上也能轻松使用安卓系统呢?没错,这就是今天我要跟你分享的神奇之...
安卓系统手机刷任务,步骤、技巧... 亲爱的手机控们,你们是不是也和我一样,对安卓系统手机刷任务充满了好奇和期待呢?想象你的手机就像一辆老...
逍客安卓系统usb,“逍客安卓... 亲爱的车主朋友们,你们有没有想过,你的逍客安卓系统USB接口,竟然能玩出这么多花样?今天,就让我带你...
安卓系统导航不带CD,拥抱智能... 你有没有发现,现在很多车里的导航系统都变成了安卓系统,而且它们好像都不带CD播放功能了呢?这可让那些...
安卓系统和iOS系统运行原理,... 你有没有想过,为什么你的手机可以轻松地打开各种应用,而你的朋友却只能用那几个固定的?这背后,其实是安...
安卓清除系统软件,安卓系统软件... 亲爱的手机控们,你们是不是也和我一样,对那些安卓手机里自带的系统软件感到烦恼呢?它们不仅占用了宝贵的...
安卓卸载系统应用app,无需R... 手机里的系统应用,有时候就像那些黏人的小跟班,总在你最不想它们出现的时候跳出来。今天,就让我来带你一...
安卓系统实现闪信,安卓系统闪信... 亲爱的安卓手机用户们,你们有没有想过,在信息爆炸的时代,如何让你的信息脱颖而出,直接跳进对方的视线里...
盒子怎么刷安卓系统,盒子刷安卓... 亲爱的读者朋友们,你是不是也和我一样,家里的安卓盒子用久了,总觉得有点卡,想要给它来个焕然一新的变身...
安卓系统怎么刷锤子系统,操作指... 你有没有想过给你的安卓手机换换口味?别看它现在运行得风生水起,偶尔来点新鲜感也是不错的。今天,就让我...
物本 安卓系统盒,引领智能生活... 亲爱的读者们,你是否曾想过,在繁忙的生活中,如何让科技为你的日常带来一丝轻松与便捷?今天,我要给大家...