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. Using relative path for image:url in stylesheet
Forum Updated to NodeBB v4.3 + New Features

Using relative path for image:url in stylesheet

Scheduled Pinned Locked Moved Unsolved General and Desktop
23 Posts 4 Posters 7.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.
  • L lukutis222
    11 May 2023, 11:18

    @SGaist I am pretty sure it does. But it does not seem transparent when I use it as icon in QT.
    657c8c26-0d41-4d75-bf80-9fba3e947948-image.png

    I was expecting it to inherit whatever the background the QLabel is set to.

    C Offline
    C Offline
    CPPUIX
    wrote on 11 May 2023, 12:49 last edited by CPPUIX 5 Nov 2023, 12:52
    #21

    @lukutis222 Could you share green_circle.png file? and the style sheet you're applying to your label?

    I tested with a random green circle icon with a transparent background, and a yellow background for the label, and it works.

    Here's how it looks:

    greenyellow.png

    and here's the image I used, and its link:

    green.png

    L 1 Reply Last reply 12 May 2023, 04:48
    1
    • C CPPUIX
      11 May 2023, 12:49

      @lukutis222 Could you share green_circle.png file? and the style sheet you're applying to your label?

      I tested with a random green circle icon with a transparent background, and a yellow background for the label, and it works.

      Here's how it looks:

      greenyellow.png

      and here's the image I used, and its link:

      green.png

      L Offline
      L Offline
      lukutis222
      wrote on 12 May 2023, 04:48 last edited by lukutis222 5 Dec 2023, 04:58
      #22

      @Abderrahmene_Rayene
      Sure. The image is attached:
      green_circle.png

      You should be able save it as image.

      Regarrding the label:
      I have simply created a label, adjusted its size and added stylesheet background color:
      ded6475c-86ff-4a39-bf89-25c89585f0be-image.png

      af0a1a92-db2d-4b67-8c35-243a7ca9e69a-image.png

      In the code I do:

          QPixmap pixmap = QPixmap (":/icons/green_circle.png");
          ui->label_5->setPixmap(pixmap);
          ui->label_5->setScaledContents(true);
      

      Result

      20b8adac-59d1-4b54-95cc-28942c50e225-image.png

      I have then tried the same thing again just instead using my green_circle, I used your green_circle. That seems to work fine!
      9b4780e0-2afc-4f95-8fb0-01eb65b74100-image.png .

      I wonder what is exactly t=the problem with my image. It seems transparent but its not!

      It is also worth mentioning that this is not just one image that I have issues with. I use many transparent images that does not actually seem to be transparent. Another example is this icon:
      ping.png

      C 1 Reply Last reply 12 May 2023, 07:19
      0
      • L lukutis222
        12 May 2023, 04:48

        @Abderrahmene_Rayene
        Sure. The image is attached:
        green_circle.png

        You should be able save it as image.

        Regarrding the label:
        I have simply created a label, adjusted its size and added stylesheet background color:
        ded6475c-86ff-4a39-bf89-25c89585f0be-image.png

        af0a1a92-db2d-4b67-8c35-243a7ca9e69a-image.png

        In the code I do:

            QPixmap pixmap = QPixmap (":/icons/green_circle.png");
            ui->label_5->setPixmap(pixmap);
            ui->label_5->setScaledContents(true);
        

        Result

        20b8adac-59d1-4b54-95cc-28942c50e225-image.png

        I have then tried the same thing again just instead using my green_circle, I used your green_circle. That seems to work fine!
        9b4780e0-2afc-4f95-8fb0-01eb65b74100-image.png .

        I wonder what is exactly t=the problem with my image. It seems transparent but its not!

        It is also worth mentioning that this is not just one image that I have issues with. I use many transparent images that does not actually seem to be transparent. Another example is this icon:
        ping.png

        C Offline
        C Offline
        CPPUIX
        wrote on 12 May 2023, 07:19 last edited by
        #23

        @lukutis222 it seems this has nothing to do with Qt.

        How are you downloading these images? What's their source?

        1 Reply Last reply
        0

        21/23

        11 May 2023, 12:49

        • Login

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