Combo Box should be like Editable Combo Box but the Items should not be edited - how to change like this?



  • How can i change the look of my Combobox to be like a Editable Combo Box, but the Items in it should not be edited...??

    Any Help...

    ![IMG]http://i.imgur.com/1IS5iOZ.png[/IMG](Combo Box)!



  • Did u tried using stylesheet???

    @ComboBox->setStyleSheet("QComboBox { background-color: white; }");@



  • What's the reason you want to confuse your users in thinking that they can edit the value when they can't?



  • You could do something like in PySide , so you have to translate it into Qt -C++

    I had the same situation and i overcome with the following code.
    @
    alphabets=["A","B","C","D","E","F","G"] #list of items to show
    alphbets_cmbbx=QtGui.QComboBox(self)
    alphbets_cmbbx.setEditable(True)
    alphbets_cmbbx.addItems(alphabets) # add items list here
    alphbets_cmbbx.setInsertPolicy(QtGui.QComboBox.NoInsert)
    alphbets_cmbbx.setCurrentIndex(-1)
    @
    #add your custom Validator using QRegExpValidator to it for accepting only letters
    #add your signals

    With this one can enter different letters which will not be saved and they can also pick one from the list.


Log in to reply
 

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