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

Adding multiple icons in QComboBox with QAbstractItemDelegate pyqt

I wanted to set multiple icons in a single item in my QcomboBox. I think this can be implemented using the QAbstractItemDelegate, but I need some PyQt examples. The following link does give me an idea but I couldn't get in running with Python : How…
floyd1510
  • 391
  • 1
  • 6
  • 14
0
votes
1 answer

pyqt images in combobox items

I'm using pyqt and wanted to display different images with each item of a combobox. It doesn't have to be a qcombobox, any form of a drop down menu will do. Appretiate any answers/ links to examples. Thank you
floyd1510
  • 391
  • 1
  • 6
  • 14
0
votes
1 answer

QComboBox::showPopup() with no animation

Is there a simple way to use QComboBox::showPopup() without the animation making it instant?
Jared Price
  • 5,217
  • 7
  • 44
  • 74
0
votes
1 answer

Display a QAbstractTableModel in a QComboBox

Good evening StackOverflow. This is my first question, so I hope it will not be too dumb. I have a model sublassing QAbstractTableModel that stores items inheriting QObject. I want to display the list of the items in a QComboBox, which is updated…
0
votes
1 answer

Qt: How to animate highlight of non-editable QComboBox?

I want some of window controls being highlighted somehow on each change (generated internally by application) to indicate user. I found a nice method: manipulate background color via palette and QVariantAnimation. The only widget which caused huge…
Artem Pisarenko
  • 123
  • 1
  • 2
  • 13
0
votes
1 answer

Qt5 Is it possible to retrieve an item's checkstate from a combobox without having a pointer to the model?

I know you can do it when you have access to the QStandardItemModel but using combobox->model() returns a QAbstractItemModel which doesn't have the item(int row, int col) accessor. I've tried working with QAbstractItemModel::itemData(QModelIndex)…
Jarrod Cabalzar
  • 408
  • 1
  • 5
  • 24
0
votes
1 answer

how to send data as hidden to QComboBOX in pyqt

I need to send name and id to QComboBox, But i want to show name and because id is id in dB table, i want to keep as hidden id, but i don’t know how to keep as hidden id. I can name such as: self.comboBox_2.addItems(list1) Bu i don't have any idea…
PersianGulf
  • 2,845
  • 6
  • 47
  • 67
0
votes
1 answer

Qt QTreeWidget how to get the row a QComboBox is on

I have a QTreeWidget with several QComboBoxes as QTreeWidgetItems. I am trying to find a way to get the current QTreeWidget row of the selected QComboBox. ui->sensorTree is the QTreeWidget. My tree looks something like this: parent0 child0 …
Jared Price
  • 5,217
  • 7
  • 44
  • 74
0
votes
1 answer

Qt get QComboBox->currentText within QTreeWidget

I have a QTreeWidget that contains several QComboBoxes. How can I get the current text of a QComboBox that is in the QTreeWidget? My QTreeWidget looks something like this: ui->sensorTree parent0 child0 QComboBox child1 …
Jared Price
  • 5,217
  • 7
  • 44
  • 74
0
votes
3 answers

QComboBox doesn't connect

I'm programming in QT 4.8.4 with C++. I want to have a drop-down menu, where I can select an option, and then it will run an exe with the selected item on the menu as the option for the exe. Here's my code: #ifndef GUI_H #define GUI_H #include…
Steve The Squid
  • 63
  • 1
  • 1
  • 5
0
votes
1 answer

QCombobox doesn't select when changing currentIndex

In my constructor I connect to a Sqlite Database and read "Categories" (QStrings) from it. I store them in a QList. I checked via debugger if they're empty, but everything is fine. The int currCategoryIndex is set to 0 in my initializer list. And…
Davlog
  • 2,162
  • 8
  • 36
  • 60
0
votes
1 answer

How to make a ListBox in Qt?

I want to make a listbox, similar to the Combobox, but with out a drop down, just show the whole list with a scrollbar? Looking also to be able to click on and hightlight a row to delete that item if need be. QComboBox *lv = new…
jdl
  • 6,151
  • 19
  • 83
  • 132
0
votes
0 answers

Qt QCombobox currentIndexChanged signal

How get ItemIndex from one ComboBox and send to another ComboBox? Both Comb's created in QTableWidget QComboBox *comboA = static_cast(ui->tableWidget->cellWidget(0,0)); QComboBox *comboB =…
jenkye
  • 1
  • 1
  • 1
0
votes
1 answer

How to store an Id beside text and icon in a QComboBox?

is it possible to store some additional data in a QComboBox? I would like to store the Id of a data set beside its caption/name in a combobox, but it shouldnt show up (Ids can be some how cryptic and might confuse the user) Any ideas? Thanks in…
Ben A.
  • 1,511
  • 2
  • 11
  • 8
0
votes
0 answers

Why does ::TableView.model return nilClass when Nokogiri is used?

EDIT The problem was with something else so the trouble wasn't really Qt, still I don't know why this happened. The thing was that in the method display_filesize @yt.get_filesize(row_id, format) I used Nokogiri to parse the XML. I don't know if the…
k_ly
  • 1
  • 1