Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to hide the drop-arrow in the Combobox?



  • how to hide the drop-arrow in the Combobox?



  • 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.



  • thank you



  • Hi @opengpu

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

    Thank You.


  • Lifetime Qt Champion

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


Log in to reply