Select an Entry or Add a New One ComboBox: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 17:42, 14 January 2015

How to select a specific text entry (or add it if does not exist) in a combo box

The following method acts on a combo box searching for a specified text string and:

  • if the string is present select it
  • if the string is not present add it to the combo box model

In the following piece of code myText is the QString searched for and combo is a reference to the combo box.

Categories: