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

相关内容

热门资讯

手机模拟定位安卓系统 你有没有想过,你的手机其实是个“大侦探”,可以随意穿梭在不同的地方?没错,就是那个小小的安卓手机,它...
安卓是虚拟系统升级,探索技术革... 你知道吗?在这个科技飞速发展的时代,手机更新换代的速度简直就像坐上了火箭!而作为安卓用户,你是否也期...
erx5安卓系统,功能解析与使... 你有没有发现,最近你的安卓手机好像变得不一样了?没错,就是那个神秘的erx5安卓系统!今天,就让我带...
小米6安卓系统内核更换,深度解... 你有没有想过,你的手机系统是不是也能来个“大变身”?没错,今天咱们就来聊聊小米6的安卓系统内核更换,...
安卓系统能显示流量吗,安卓系统... 你有没有想过,你的安卓手机里那些小小的流量数字,其实藏着大大的秘密呢?没错,今天就要来聊聊这个话题—...
oppo如何恢复安卓10系统,... 手机系统出了问题,别慌!今天就来教你怎么把OPPO手机恢复到安卓10系统。是不是觉得听起来有点复杂?...
安卓系统会不让大家使用 你知道吗?最近在安卓系统上发生了一件让人有点摸不着头脑的事情。安卓系统,这个陪伴我们多年的老朋友,竟...
安卓考勤系统签到流程 你有没有想过,每天早上打卡签到,竟然也能变得如此有趣和高效?没错,就是那个我们每天都要面对的安卓考勤...
安卓系统玩苹果手机王者,安卓玩... 亲爱的手机控们,你是否有过这样的经历:一边是安卓系统,一边是苹果手机,而你的心却始终被《王者荣耀》这...
安卓系统刷miui系统怎么样,... 你有没有想过,给你的安卓手机换换口味呢?没错,就是刷机!今天,咱们就来聊聊安卓系统刷MIUI系统怎么...
洛基亚为啥不用安卓系统,探寻其... 你有没有想过,为什么洛基亚(Lokia)手机不用安卓系统呢?是不是觉得这个品牌有点神秘,有点特别?今...
安卓系统与小米miu系统哪个好... 你有没有想过,手机里的操作系统就像是我们的大脑,它决定了我们手机的使用体验。今天,咱们就来聊聊这个话...
安卓怎么苹果系统锁屏,揭秘系统... 你是不是也和我一样,对安卓手机和苹果手机的系统锁屏功能充满了好奇呢?想知道它们各自有什么特别的地方,...
苹果安卓系统软件互通,共创未来... 你知道吗?在这个科技飞速发展的时代,手机已经成为了我们生活中不可或缺的一部分。而说到手机,不得不提的...
天籁系统的安卓怎么更新 亲爱的安卓用户们,你是否也和我一样,对天籁系统的更新充满了期待呢?每次系统更新,都仿佛是给我们的手机...
手机安卓木马系统高版本,技术演... 手机安卓木马系统:高版本的潜在风险与防范策略在数字化时代,智能手机已成为我们生活中不可或缺的一部分。...
小米用的是安卓系统,引领智能生... 你知道吗?现在手机市场上,各种品牌琳琅满目,让人挑花了眼。但是,说到性价比之王,那可非小米莫属了。你...
小游戏安卓换装系统下载,打造个... 你有没有发现,手机里的小游戏越来越好玩了?这不,最近我发现了一个超级有趣的小游戏——安卓换装系统下载...
鸿蒙系统融合安卓怎么用,跨平台... 你知道吗?最近手机圈里可是热闹非凡呢!华为的鸿蒙系统终于和安卓系统来了个亲密接触,这可是个让人眼前一...
安卓10系统为什么老化,揭秘老... 你有没有发现,你的安卓手机自从升级到安卓10系统后,好像变得有点“老态龙钟”了呢?别急,让我来给你细...