QComboBox. Editable. Select all text and put cursor at the first Char of String



  • Maybe someone can help me with this. I need that my "QComboBox editable" is full selected and the cursor is positioned on the first character when it gets the focus.



  • Combination of:

    combBox->setEditable(true)
    combBox->lineEdit()->setCursorPosition(0);
    


  • Thanks michelson!!!
    Just I want to add:

    Don't forget to add this line, otherwise lineEdit() you can not use setCursorPosition(0):
    #include <QLineEdit>
    ......
    ......

    combBox->setEditable(true)
    combBox->lineEdit()->setCursorPosition(0);


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.