Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

help in setting stylesheet for Links



  • i need to set theme in my app and i need a way to set "links" color in runtime.
    i am not allowed to use setPallete.



  • You can create a javascript file to import your themes in qml but this approach goes against logic of qml...

    import "myThemes.js" as Themes
    ...
    Item  {
    Component.onComplete: Themes.loadThemeFromNet("http://myServer.com/theme.x");
    
    Rectangle {
    color : Themes[Themes.theme].color
    

    myThemes.js

    var theme = "themeDefault"
    var themes =  { "themeDefault" : { "color": "red" }}
    
    function loadThemeFromNet( url) {
     ... 
    .. get file from net ..
    .. parce file .. 
    .. set object of theme from net in var themes ..
    apply ..
    theme = "newTheme" 
    
    }
    
    

    but this way is very bad ....

    if you want get to stylesheet from internet you need first get the file from internet and parce the file and transform in some logic to apply the style ... is one idea ..
    qml is more to local files and pre-compiled files ...


Log in to reply