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. how to hide the drop-arrow in the Combobox?

how to hide the drop-arrow in the Combobox?

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 3.7k 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.
  • O Offline
    O Offline
    opengpu
    wrote on last edited by SGaist
    #1

    how to hide the drop-arrow in the Combobox?

    1 Reply Last reply
    0
    • Pradeep P NP Offline
      Pradeep P NP Offline
      Pradeep P N
      wrote on last edited by Pradeep P N
      #2

      Hi @opengpu

      Customizing the Combobox is best solution.

      For QComboBox using setStyleSheet()

      Refer Qt : Qt Style Sheets Examples
      Refer QML : ComboBoxStyle QML Type

      Example : QComboBox

          QComboBox *_cb = new QComboBox(this);
          _cb->setStyleSheet("QComboBox::drop-down { "
                            "subcontrol-origin: padding; "
                            "subcontrol-position: top right; "
                            "width: 15px; "
                            "border-left-width: 1px; "
                            "border-left-color: darkgray; "
                            "border-left-style: solid; "/* just a single line */
                            "border-top-right-radius: 3px; "/* same radius as the QComboBox */
                            "border-bottom-right-radius: 3px; "
                           "}");
      

      Example: ComboBox

          ComboBox {
              width: 200
              model: // provide the model
      
              style: ComboBoxStyle {
                  renderType : Text.NativeRendering
      
                  background: Rectangle {
                      implicitWidth: 100
                      implicitHeight: 25
                      border.width: 1
                  }
      
                  label: Label {
                      anchors {
                          fill: parent
                          left: parent.left
                          leftMargin: 5
                      }
                      font.pixelSize: 12
                      text: control.currentText
                      verticalAlignment: Qt.AlignVCenter
                  }
              }
          }
      

      All the best.

      Pradeep Nimbalkar.
      Upvote the answer(s) that helped you to solve the issue...
      Keep code clean.

      1 Reply Last reply
      3
      • O Offline
        O Offline
        opengpu
        wrote on last edited by
        #3

        thank you

        1 Reply Last reply
        0
        • Pradeep P NP Offline
          Pradeep P NP Offline
          Pradeep P N
          wrote on last edited by Pradeep P N
          #4

          Hi @opengpu

          Was that helpful ?
          Can you make the ticket as SOLVED if you have got the solution ?

          Thank You.

          Pradeep Nimbalkar.
          Upvote the answer(s) that helped you to solve the issue...
          Keep code clean.

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

            @opengpu Use the "Topic Tools" button to mark a thread as solved.

            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