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. combobox should just show down-arrow but not drop-down button
QtWS25 Last Chance

combobox should just show down-arrow but not drop-down button

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 8.2k 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    Hello everyone,
    I have a QComboBox for which i should just show the down-arrow icon& hide the drop-down button, i mean border sorrounding the down-arrow icon.
    I tried with the following style sheet,

    QComboBox::drop-down:!editable {border: 0px; subcontrol-origin: padding; subcontrol-position: center right; } ");

    this hides the down-arrow button too. but i want to show the down-arrow button but not border which surrounds it. Any idea how i can achieve this.?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      combo box in the following image is what i want to achieve
      https://www.google.ca/search?q=combo+box+images&espv=2&biw=1366&bih=599&source=lnms&tbm=isch&sa=X&ved=0CAYQ_AUoAWoVChMIgZiz2t7_yAIVghUeCh0nZwva#imgrc=e8dbdN9cVRyr8M%3A

      Any ideas would be greatly appreciated & Thanks in advance..

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

        Hi,

        Take a look at the QComboBox styling example as a base, Set border-left-width to 0 and you should have something work on.

        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
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          the code in here, QComboBox styling example din't work for me.
          Also if i set the border-width or border-left-width to 0, the whole button is invisible.
          What i want is the down arrow but not the drop down button.
          Does anybody know how exactly Qcombobox laid out on it's subcontrols, coz that would give me a solution for this problem

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

            The arrow was missing ? If so it's because you don't have the file where the style sheet expects it. It's easy to fix by using e.g. /path/to/qt5/qtbase/examples/widgets/widgets/stylesheet/images/down_arrow.png

            It it's something else, what was not working ? On what platform ?

            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
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              how can i use this arrow image @SGaist , can i use this directly in stylesheet.?

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

                Yes, you can put that icon in a .qrc file and use it with the :/ prefix

                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
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #8

                  Thanks @SGaist that was exactly what i was missing. After setting background color of drop-down button to transparent, all i needed to do was to use an image in style sheet for down-arrow.
                  Thanks for the prompt & quick reply @SGaist ..

                  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