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. Combo Box should be like Editable Combo Box but the Items should not be edited - how to change like this?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.5k 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.
  • J Offline
    J Offline
    JoyRider
    wrote on last edited by
    #1

    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)!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Macro
      wrote on last edited by
      #2

      Did u tried using stylesheet???

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          ManasQt
          wrote on last edited by
          #4

          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.

          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