Questions tagged [qcombobox]

QComboBox is a Qt class that implements a standard combo-box, which is a list of elements that can contract to occupy less screen space, and expand to show all of the options.

In it's "closed" view, the QComboBox displays the current selection. It can also pop-up to show all of the choices, and can as well be user-editable.

QComboBox can be operated dynamically to insert (with insertItem() and insertItems() functions), remove (removeItem()), and clear (clear()) items.

One can also get the current item's index and text.

An example of creating a QComboBox and showing it will look like this:

//creating the combobox with no parent, so it appears in a new window.
QComboBox * b = new QComboBox();
//Inserting 3 elements into it. 
b->insertItems(0, QStringList() << "item1" << "item2" << "item3");
//Showing the ComboBox.
b->show();

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

727 questions
0
votes
0 answers

Selecting and filtering unique entries from a list using QComboBoxes

I have a shortlist (no more then ten or so items) that I want a user to match against another list. The order may be random and they may re-assign any value as they see fit. I want to indicate values already assigned but not necessarily prevent…
Carel
  • 3,289
  • 2
  • 27
  • 44
0
votes
1 answer

How to associate the selected item of Combobox to write into a file

Basically I have a line-edit box which take the user input such as comma separated values and on clicking the push-button it write all the values of line-edit box to a text file. But same feature I want to achieve through combobox. So whenever one…
Chinmoy
  • 493
  • 1
  • 5
  • 16
0
votes
1 answer

PyQt: display QPushButton that looks like the down-arrow button in QComboBox

In PyQt4, I want to present a QPushButton that looks like the down-arrow button in QComboBox. Feasible, and if so, how? I don't need help getting my new widget-combination acting like a QComboBox (see below). I only want the QPushButton…
Johnny Utahh
  • 2,389
  • 3
  • 25
  • 41
0
votes
1 answer

QCombobox of Checkboxes

I have a problem and I hope that you can help me. I want to create a Combobox of Checkboxes on Qt Creator. This is my code mod = new QStandardItemModel(1,0); QStandardItem *item; item = new…
TorneiTP
  • 1
  • 2
0
votes
1 answer

PyQt QComboBox addItems not repainted

I have GUI application that plots data from a dump file as various types of plots.A part of the code is given below which sets some dataset values for the type of plot chosen. Please look a the following code. def Plottype_menu_event(self) : …
0
votes
1 answer

how can I get current value to qcombobox in pyqt?

I need to get the selected value in my qcombobox. It was populated from database, the QCombobox is named cbUser This is my function that populate the qcombobox: for row in self.SELECT_USERS_ACCOUNTS(): …
GSandro_Strongs
  • 773
  • 3
  • 11
  • 24
0
votes
0 answers

QComboBox currentIndex() to hide other widgets

What it should do: When the QComboBox is on the first item (index 0) it should hide the QStackedWidget. Which causes the QComboBox to extend as much as possible. As soon as you change the item in the QComboBox to anything, the QComboxBox should…
0
votes
1 answer

PyQt4 QComboBox autocomplete without using setModel?

I have found several excellent examples of a PyQt4 QComboBox with autocomplete (e.g. How do I Filter the PyQt QCombobox Items based on the text input?), but they all use setModel and setSourceModel... etc. Is it possible to create an autocomplete…
panofish
  • 7,578
  • 13
  • 55
  • 96
0
votes
1 answer

select QString which is added to QcomboBox by setEditText(QString) method

how to select a text which I have add to my QComboBox by comboBox->setEditText(someString). I want my text to be appeared by "selecting all the text" in combobox.
NDestiny
  • 1,133
  • 1
  • 12
  • 28
0
votes
0 answers

QCombobox background text color not reflected in selected state

The following code works but doesn't do in full what exactly is needed: nameList = ('John','Tom','Henry','Michelle','Ashish','Jo-Huang', ...) colorNameList = ('Michelle','Jennifer','Claudia','JimSung',…
Rahul
  • 755
  • 4
  • 8
  • 16
0
votes
1 answer

PyQt combobox selective text formatting

Merry Christmas guys! I am new to PyQt4 programming and using Qt Designer for most of UI development. However I have a specific requirement to populate a QComboBox through Python code. More so I want to change text formatting (Bold, Red Background…
Rahul
  • 755
  • 4
  • 8
  • 16
0
votes
1 answer

Select item from one ComboBox and remove that item from other ComboBoxes

Im writing an QT application, where I have 3 QComboBoxes, with a list of values. I'm trying to do so, when I select one item in a QComboBox, I will remove it from the other QComboBoxes, and when I select another or nothing, it will reappear in the…
Thisen
  • 183
  • 1
  • 9
0
votes
1 answer

QComboBox and HeaderItem

I have a QComboBox with a QStandardItemModel, which contains a single item named One. I want the QComboBox to have an header (I’m not sure this is the correct technical term …) which will always be the same. The following image depicts exactly what…
jp_doyon1
  • 51
  • 4
0
votes
2 answers

Lock a choice in PyQt4 QComboBox using a QCheckBox

I am beginning to write a GUI using PyQt4. This is my first experience with GUIs (and also oo-programming is somewhat new to me). Part of that GUI will be like 4 to 5 instances of QComboBox. As many choices are to be made, I want the user to be able…
Nras
  • 4,251
  • 3
  • 25
  • 37
0
votes
1 answer

qcombobox: use non-first character for keyboard navigation

Let's say I have a list of items like: "01 Apple 1", "02 Apple 2", "03 Banana", "04 Orange 1", "05 Orange 2" Is there a way to make a QComboBox where the user can (for example) press "o" to select "04 Orange 1" and "b" to select "03 Banana"?
rmweiss
  • 716
  • 1
  • 6
  • 16