Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Add text and photo to Qlabel
Forum Updated to NodeBB v4.3 + New Features

Add text and photo to Qlabel

Scheduled Pinned Locked Moved Solved Qt for Python
5 Posts 2 Posters 2.8k Views
  • 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.
  • Samuel BachorikS Offline
    Samuel BachorikS Offline
    Samuel Bachorik
    wrote on last edited by
    #1

    Hello i want to ask if is possible add to label text and photo together. I cant find any working solution on internet. Should i use another widget when i want to use this ?

    Thank you.

    JonBJ 1 Reply Last reply
    0
    • Samuel BachorikS Samuel Bachorik

      Hello i want to ask if is possible add to label text and photo together. I cant find any working solution on internet. Should i use another widget when i want to use this ?

      Thank you.

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

      @Samuel-Bachorik
      Yes. You can either use two adjacent labels one with https://doc.qt.io/qt-5/qlabel.html#text-prop, the other with https://doc.qt.io/qt-5/qlabel.html#setPicture. Or do you mean you really want to have the photo as the background image of the label with the text on top of it?

      Samuel BachorikS 1 Reply Last reply
      3
      • JonBJ JonB

        @Samuel-Bachorik
        Yes. You can either use two adjacent labels one with https://doc.qt.io/qt-5/qlabel.html#text-prop, the other with https://doc.qt.io/qt-5/qlabel.html#setPicture. Or do you mean you really want to have the photo as the background image of the label with the text on top of it?

        Samuel BachorikS Offline
        Samuel BachorikS Offline
        Samuel Bachorik
        wrote on last edited by
        #3

        @JonB yes exactly i need label with backround and text at top of it.

        JonBJ 1 Reply Last reply
        0
        • Samuel BachorikS Samuel Bachorik

          @JonB yes exactly i need label with backround and text at top of it.

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

          @Samuel-Bachorik
          Normally it's easier to do them as separate labels, I think that's what is recommended.

          If you really want them in one, I think you have to look at using HTML <img src=...>

          Have a read through:
          https://stackoverflow.com/questions/53913695/set-image-as-background-and-text-on-top-of-it-in-qlabel
          https://forum.qt.io/topic/64020/settext-and-setpixmap-using

          I notice a comment there

          Somehow if you set border-image: url(:\path\to\picture); in QSS, that makes the picture a background for most of widgets. Dirty hack that may do the trick. – MasterAler Dec 26 '18 at 18:15

          That might do it, I don't know.

          1 Reply Last reply
          3
          • Samuel BachorikS Offline
            Samuel BachorikS Offline
            Samuel Bachorik
            wrote on last edited by
            #5

            Thank you a lot !

            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