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

Qt QSignalMapper is emitting a signal for every item in the map

I have a function that receives a QList of a class I created. Let's call this hypothetical class "Stuff". So, this function receives a QList of Stuff I iterate through the QList, and depending on the properties of the "Stuff" object, I will…
user751612
  • 163
  • 3
  • 8
0
votes
1 answer

How to always open QComboBox popup downwards?

I'm using a stylesheet for my GUI elements such as the QComboBox and I need the popup to drop downwards which is not working at all. I'm working on a Linux based system. My Qt version is 5.4.2. I already tried to set the style of the whole…
MichaW.
  • 21
  • 4
0
votes
1 answer

Get Data from qcombo box in stringlist data

Im using Qt creator 3.5.1 and creating a simple gui. Im wondering how to get data from combobox that is in qstringlist here's my code: #include "mainwindow.h" #include "ui_mainwindow.h" MainWindow::MainWindow(QWidget *parent) : …
Its_Me
  • 55
  • 3
  • 7
0
votes
1 answer

QCombobox bigger in size for the first time only

class RangeSelection(QWidget): def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QGridLayout(self) self.setLayout(layout) self._create_widgets() layout.addWidget(self.select_combo,…
crisron
  • 363
  • 2
  • 5
  • 21
0
votes
1 answer

PyQt : get a value from combobox when a button pressed

I use qt designer and convert it from *.ui to *.py, I want to make application for send and receive serial data,, i use combobox to alow user for setting serial comةunication self.ui.comboBox_2.addItems(['2400','4800','9600','19200']) my…
Lukis triya
  • 1
  • 1
  • 4
0
votes
1 answer

How to style Scrollview for QCombobox?

I need to apply style sheet for the QCombobox. Can anyone please give me an example? I thought using the QScrollView will affect the QCombobox but it didn't. And how to limit the number of items shown in a combo box?
jxgn
  • 741
  • 2
  • 15
  • 36
0
votes
1 answer

QCombobox - hide first item on drop-down

Hello fellow developers! I want to realize a "Action" QCombobox where the different options trigger an action instead of choosing an option. The combobox says something like "Add Property" and when the user clicks it, he gets the different…
CppChris
  • 1,226
  • 9
  • 14
0
votes
2 answers

QComboBox::setModel emits editTextChanged, how to block this?

I am setting a model to QComboBox on editTextChanged. While setting a model it again emits an editTextChanged signal on editTextChanged. I am using an SQL like query for filtering combobox items. pls help me
Nishad
  • 23
  • 8
0
votes
1 answer

PyQt4 editable combobox current text

I'm using an editable QComboBox. What I want to achieve is to be able to type a query into the field and run that query after pressing enter. But not matter how I try to get the typed query, combobox's value is always the first item in the list, not…
0
votes
0 answers

QComboBox different Item value when selected and in dropDown

how to easily make duo QAbstractListModel × QComboBox (not reimplementing QComboBox) so that item representation on selection differs from one on DropDownList Background: I have model (inherited from QAbstractListModel) which flattens other model…
0
votes
2 answers

QComboBox become ugly when changing main windows background

Before changing: After changing parent widget styleSheet property to this: background-color: rgb(5, 34, 78); I see this: QComboBox become really different. What happens? How to use regular QComboBox on dark background? I am using Qt 5.5 without…
k06a
  • 17,755
  • 10
  • 70
  • 110
0
votes
2 answers

connect QPushButton and QComboBox

How can I connect a QPushButton and a QComboBox? I created a SLOT that accepts 2 parameters, a pointer to the QComboBox and the index of the selected item: void modificaExp::eliminaExp(QComboBox *combo,int value) { ...... …
ale666
  • 17
  • 1
0
votes
1 answer

Load values from INI file to combo box

I have a GUI (created with PyQt5 & Python3.4). I have a pair of combobox : the first is brand of cars and the second one is models of the brand selected. I have an INI file to save the last values entered in the GUI, so when I re open the GUI, the…
guy16
  • 233
  • 2
  • 3
  • 16
0
votes
0 answers

Qt Combobox Model Using SQLite

With Sq-lite, how can I set a model for the combo-box that has two table columns added together (ie surName +' '+ firstName)...with MS SQL Server I simply use a view. When I tried with Sq Lite...nope! all other widgets (ie.QLineEdit and QDateEdits)…
Kyef
  • 69
  • 7
0
votes
0 answers

QComboBox, PyQt5 - Numbers in Item strings are reordered

I'm encountering the following (weird) behaviour when adding items to a QComboBox using PyQt5: The items are all added from a list of strings, but they are displayed correctly only when selected. When appearing in the drop-down list, the order of…
btitze
  • 61
  • 2