• Qt QSS中 background-image,border-image,以及image属性差别


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

  • 相关阅读:
    电脑访问不到在同网络的手机设备
    【LeetCode144、145、94. 二叉树遍历】——递归算法、利用栈
    若依VUE 从一个页面跳转另一个页面并携带参数
    nginx 部署前端资源的最佳方案
    RK3399驱动开发 | 03 - WK2124串口芯片驱动调试
    禁止methtype联网
    【设计模式】【单例模式】python实现单例模式的几种方式
    haddop shuffle最详细的解释
    从0到1完全掌握 XSS
    SpringBoot-运维实用篇复习(全)
  • 原文地址:https://blog.csdn.net/qq_39280795/article/details/128084732