Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Change base dir for stylesheet urls

Change base dir for stylesheet urls

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MegamouseM Offline
    MegamouseM Offline
    Megamouse
    wrote on last edited by
    #1

    Hi,

    Is it possible to change the base directory for the paths in the stylesheets?
    Maybe I am looking at it the wrong way. The Problem is that (on Linux) we use the ./config folder for our appimage's additional files. It seems like the stylesheets can't find the relative paths set in there (for example a background.png or some font).

    Thx, Megamouse

    raven-worxR 1 Reply Last reply
    0
    • MegamouseM Megamouse

      Hi,

      Is it possible to change the base directory for the paths in the stylesheets?
      Maybe I am looking at it the wrong way. The Problem is that (on Linux) we use the ./config folder for our appimage's additional files. It seems like the stylesheets can't find the relative paths set in there (for example a background.png or some font).

      Thx, Megamouse

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Megamouse
      IIRC the current dir is used for loading. So if possible you could call QDir::setCurrent() before applying the stylesheet.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • MegamouseM Offline
        MegamouseM Offline
        Megamouse
        wrote on last edited by
        #3

        thanks that seems to work

        1 Reply Last reply
        0
        • MegamouseM Offline
          MegamouseM Offline
          Megamouse
          wrote on last edited by
          #4

          I just noticed that this might not be what I was looking for after all.

          Doesn't QDir::setCurrent set the working directory for the entire process?
          I don't really want that... I only want it for the stylesheet.
          And if I reset the working dir after setStylesheet it won't work anymore if I open a new Dialog afterwards for example.

          JonBJ 1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            In that case what you can do is to have a stylesheet which contains a placeholder for the path "prefix". Use QString::arg to replace that placeholder with required value when applying the stylesheet.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • MegamouseM Megamouse

              I just noticed that this might not be what I was looking for after all.

              Doesn't QDir::setCurrent set the working directory for the entire process?
              I don't really want that... I only want it for the stylesheet.
              And if I reset the working dir after setStylesheet it won't work anymore if I open a new Dialog afterwards for example.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Megamouse
              @SGaist has jogged my memory that that is what I ended up doing.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved