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
1 answer

When closing QItemdelegate editor shifts item to right

I have a QTableview and QItem delegate set to it, the editor is a QCombobox which I reimplemented, because I wanted to modify its keyPressEvent. because if I press down key when the qcombobox editor is open it selects the next row in the editor, but…
JoeMicro
  • 183
  • 1
  • 2
  • 13
0
votes
1 answer

QComboBox.currentText() -- PySide vs PyQt4

I've got a python script using PySide and it works fine. But then I thought to check if it gonna work with PyQt4. And after changing the import strings to PyQt4, things went wrong. The error points to the subject, as follows: File "./my_file.py",…
python_head
  • 105
  • 1
  • 4
0
votes
1 answer

how to pass #defined VALUE from QComboBox

taking into account that I have a static VALUE which is already defined in a header file (that contains other defined static values) as follow: #defined VALUE 2 I would like to update the VALUE by passing the text taken from a QComboBox to the…
hashDefine
  • 1,491
  • 6
  • 23
  • 33
0
votes
2 answers

Python PyQT4 - Adding an unknown number of QComboBox widgets to QGridLayout

I want to retrieve a list of people's names from a queue and, for each person, place a checkbox with their name to a QGridLayout using the addWidget() function. I can successfully place the items in a QListView, but they just write over the top of…
ZZ
0
votes
1 answer

How to prevent user to input illegal text in QComboBox's lineedit?

I need a widget from QComboBox, user can select item from popup or input directly in the linedit, but how to prevent the inputs out of range of the items in QComboBox? or can the text input in the lineedit always be legal? Thanks
zhangailin
  • 926
  • 2
  • 10
  • 20
0
votes
1 answer

How to customize QCompleter Completion Rules with QSortFilterProxyModel?

eg i have these three items in my QComboBox dropdown list chicken soup chilli peppers grilled chicken entering "ch" would match "chicken soup" and "chilli peppers" but not "grilled chicken". What I want is to be able to enter "ch" and match all of…
Shuman
  • 3,914
  • 8
  • 42
  • 65
0
votes
2 answers

Check if text from ComboBox is the same has other ComboBox

I have 8 ComboBoxes with the tag as channel_1 ... channel_8. I want to check if the user chooses the same option in 2 of them, except the first option which is 'none'. I've created this slot but the final_a and final_b variables created are not…
SamuelNLP
  • 4,038
  • 9
  • 59
  • 102
0
votes
1 answer

Quick find item with QComboBox in Qt

I'm using the QComboBox to let the user select a very large quantity of choices. For the moment the user can type a character and the QComboBox selects the first row with this character, but I feel that it's just not enough. Is there any thing…
nam
  • 3,542
  • 9
  • 46
  • 68
0
votes
1 answer

Connect a combox with a slider

I'm trying to connect a qcombobox with a qwtslider, and I have two options on the combox, mm and pixel. I want to make the scale change to pixels or mms when I choose that option. I've created some functions to work as slots and those are: void…
SamuelNLP
  • 4,038
  • 9
  • 59
  • 102
0
votes
3 answers

Qt Multi language QCombobox

I have got a problem with multi language qt (change language on the fly). My form have a combobox which should be translated when language changed. When languageChanged, the app call method retranslateUi() to translate item in the combobox. The…
PhiVH
  • 447
  • 1
  • 5
  • 10
0
votes
1 answer

How create a qcombobox in a tableview in Java?

I have a tableview (model) with 5 columns. In one of them, I want to show 2 options in a combobox. The options are predetermined, so I think that the use of delegate is not necessary. Am I wrong? for (int state=0; state <3; state++) { …
0
votes
2 answers

How to customize QCombobox with multiple comlumns

I am using QCombobox, i want to every item in QCombobox displays three icons. But currently, every item in QCombobox only displays one icon! Every icon should be changed dynamically.
Anglejoy
  • 63
  • 1
  • 8
0
votes
3 answers

QComboBox EventFilter to popup

I have a little problem, I need to set my event filter to QComboBox popup. I need to catch events when left and right keys are pressed. How can I do this? Thank you!
evghin
  • 47
  • 5
-1
votes
1 answer

QComboBox getting wrong index

I have this combobox. klients = qtw.QComboBox(self) klients.insertItem(5, "x") klients.insertItem(19, "y") when I later write this code in button clicked event: print(klients.currentIndex()) It prints 0 or 1 instead of 5 or 19. How can I…
xralf
  • 3,312
  • 45
  • 129
  • 200
-1
votes
1 answer

QCombobox Going up and down knob change

I use physical Knob for control menu than included QCombobox. When press knob then call click function of ComboBoxObject. When knob rotate then rotate function call with value {-1,1}. I need change highlighted item when QComboBox is popup in rotate…
ahad
  • 1
  • 1