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. Refer to standard Qt images from QStyleSheet
Forum Updated to NodeBB v4.3 + New Features

Refer to standard Qt images from QStyleSheet

Scheduled Pinned Locked Moved Unsolved Qt for Python
4 Posts 2 Posters 817 Views 1 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.
  • T Offline
    T Offline
    TRIAEIOU
    wrote on last edited by
    #1

    Hi,

    I am trying to style a QComboBox (for something as mundane as adding a focus border). Ideally I would not like to change anything but adding a border highlighting the widget when it is in focus. However since since styling it the slightest seems to wipe the entire default styling I have to recreate it. Is there a way in the style sheet to refer to the "built in" Qt down arrow? I am doing a plugin for a Qt/Python application so I have no control over the main app and the resources included but since an unstyled QComboBox in fact renders an arrow it is indeed there somewhere.

    Cheers!

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

      Hi and welcome to devnet,

      This stack overflow answer might be a starting point.

      Hope it helps

      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
      0
      • T Offline
        T Offline
        TRIAEIOU
        wrote on last edited by
        #3

        Thanks,
        Yes at least I managed to piece together an URL that I actually get an image from: QComboBox:down-arrow {image: url(:/qt-project.org/styles/commonstyle/images/down-16.png);}
        However in that directory the QComboBox arrow is inexistent and I can't seem to find it anywhere in the source, let alone piece together which URL would be correct to reach "other folders in the source tree" (the source path in 6.2 to the above button is 6.2.2\Src\qtbase\src\widgets\styles\images). Additionally, I am unable to get all of the icons in the above images folders to display, for instance QComboBox:down-arrow {image: url(:/qt-project.org/styles/commonstyle/images/titlebar-unshade-16.png);} renders nothing even though that icon exists in the same directory as down-16.png.

        Does anyone have any ideas on where the default icon might be located? Or should I be going down the older QStyle path rather than QStyleSheet?

        Thanks

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

          Did you try to use QDir to go through the resource file structure ?

          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
          0

          • Login

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