Using style sheets... a few questions.



  • I have a couple questions about using style sheets in Qt with widgets.

    I am using Qt Designer to create a user interface for a dialog box. I do not want to embed the pictures used in the style sheet as a resource. However, the dialog is part of a plugin. When using style sheets in a plugin to load a file such as a background image or an icon we are to use the following syntax:
    @
    "background-image: url(path/image.png);"
    @

    1. I understand "path" is relative but I cannot figure out what it is relative to when the program is actually executed. (In the designer it is relative to the location of the .ui file). I have used the working plugin directory as well as the executable directory as the assumed base directory for what "path/image.png" is added to. Neither have worked.

    2. Is it possible to use an alpha in a stylesheet so that a button or other ui object is transparent, or in my case, to allow a little of the background show through? QtDesigner seems to have a problem with using the following syntax in the style sheet: "background-color: rgba(255, 255, 255, 200);" when I enter that using the color picker.

    3. Can I assume that each object can have its own stylesheet?

    4. Do stylesheets get passed on to child objects? Because that is the way it looks in QtDesigner. I don't want my buttons and other objects to use the same background image (in which case they use the same object, only set to the top left corner which looks odd). Instead, I want the dialog background image to show behind the button (though mostly obscured by the button's background color).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.