qcombobox

How to make QCombobox painting item delegate for it's current Item? (Qt 4)

QCombobox set Item delegate not painting for current Item.. I am trying to create a combo box showing different line types (Solid, Dotted, Dash etc). Currently i am setting item delegate for its content so as to draw/paint line type instead of displaying names. All line types are drawing currectly but as soon as i am selecting any line ...

Using PyQT, how do you filter mousePressEvent for a QComboBox with custom list

I've got a QComboBox with a custom list object. Please see Screen shot The custom list object has a custom mousePressEvent so that when the user click on one of the circles with a +/- (a twisty), the list is expanded/collapsed. When I use the list with the combo box, when the user clicks on a twisty, the list is expanded/collapsed, ...

PyQT combobox only react on user interaction

I have a listbox that you can select users in. To the left of that is a combobox listing the available groups the user can be put it. If the user is in a group, the combobox will automatically be set to that group. I want to make it so when you change the group selection, it will move the user to that group. I added this connection: QtC...

Autocompletion with qcompleter for fragments in the middle of a word

Is there an example available of a QCompleter subclass that will provide autocompletions for fragments that appear in the middle of words? eg: Suppose you have the wordlist { "apple", "pear", "banana" }. When the user types 'p', the suggested autocompletions should be apple and pear, but not banana (because apple and pear both contai...

Add QObject in the combo box of Qt

I have a custom class I created, say MyClass. Now how to add a reference to MyClass's reference as second parameter in the combo box below: this->ui->comboBox->addItem("item-1", ); Purpose is to when item changed even is fired, i want to get that specific class instance of MyClass and process accordingly. ...

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

Hi all, 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 each other rather than creating a new row. Does anyone have any thoughts on how I ...

Set a QComboBox or QSpinBox to a value not allowed

I am maintaining an application which tries to help the user get his parameters to work together, as there are many interdependencies. Now there is a default value of x for a variable Y. When the user changes some other variable Z, there might be a new minimum value for Y which is greater than x. This is set as a minimum for the spinbo...

How can I get the selected VALUE out of a QCombobox?

In Qt, I can get the selected text of a QComboBox by using the combobox->currentText() method. How can I get the selected value? I checked over http://qt.nokia.com/doc/4.6/qcombobox.html for help but I couldn't find a method currentData() which I expected to find. I could only find combobox->currentIndex() Is there a smarter way to do...

QCompleter forces double enter

Hello, I have a QCompleter that is forcing my users to hit enter twice when the popup is visible but is not used to select an item. The model for the QComboBox associated to the completed is used as the model for the completer. QCompleter *completer = new QCompleter(this); completer->setCaseSensitivity(Qt::CaseInsensitive); comple...

QIcon inside combobox

Hello, I want to include a "remove" icon on entries in my QComboBox, but I am having trouble catching the mouse press event. I've tried to catch it on the combobox, and I've tried reimplemting the QIcon class to catch the mousepress there. No dice. Does anybody know how to do this? -D ...

'C++ object destroyed' in QComboBox descendant editor in delegate

Hi, all! I have modified combobox to hold colors, using QtColorCombo (http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtcolorcombobox) as howto for the 'more...' button implementation details. It works fine in C++ and in PyQt on linux, but I get 'underlying C++ object was destroyed' when use this control in PyQt on ...

Qt - How to use rich text in a QComboBox?

I am trying to use rich text in a QComboBox but it does not support it. Perhaps I should write a subclass? But I am unsure on what I would need to override as I have never done anything like this before. Please help. Thanks! ...

Qt QComboBox popup position

Hi, I'm working on an application which contains an editable QComboBox. I observe the following behavior when I enter some text in the edit field and press the dropdown arrow in the combobox: My edit line ends up hidden behind the item "[email protected]". I would like to have the combobox list popup below the edit field, like in the below sc...

Key/Value pyqt QComboBox

I want to use a QComboBox with the "keys" and "values" from a tuple similar to the ones used in a django models. For example I have the following structure for a person's sex. SEX_CHOICES = (('M', 'Male'), ('F', 'Female')) The first item of the tuple contains the code of the sex that is stored in the database, and the second one the t...

How to get the row number of the QComboBox in QTableWidget

Here is the code, but it dos not work. Who can create the code. Thanks very much! void add() { QComboBox *ziduan = new QComboBox; ziduan->addItem("年度","nd"); int row =0; int col =1; QSignalMapper* signalMapper = new QSignalMapper(this); connect(ziduan, SIGNAL(currentIndexChanged(int)), signalMapper, SLOT(map())); signalMapper->...

Qt, How do I change the text color of one item of a QComboBox? (C++)

Hi, I cannot figure out how to change the text color of one particular item of a QComboBox. I was able to change the Background color of an item: comboBox->setItemData(i, Qt::green, Qt::BackgroundRole); (Qt::ForegroundRole had no effect at all, Qt 4.6, Ubuntu 10.04) and I was able to change the text color of all items with a styleshee...

QStandardItem + QComboBox

I am trying to put a QComboBox into a QStandardItem to be used in a QStandardItemModel. I have been looking around and I cannot find an answer, any ideas? ...

Qt: How do I set the QComboBox width to fit the largest item?

Hi, I have a QComboBox that I fill with QStrings using: comboBox->addItem(someString); When I start my GUI application the width of the comboBox is always 70, even if the smallest item is much larger. How can I dynamically set the width of a QComboBox, for instance, to the largest QString within the comboBox? Thanks! Edit: After so...

Qt How to disable mouse scrolling of QComboBox?

I have some embedded QComboBox in a QTableView. To make them show by default I made those indexes "persistent editor". But now every time I do a mouse scroll on top them they break my current table selection. So basically how can I disable mouse scrolling of QComboBox? ...

How-to override KeyPressEvent for an editable QComboBox ?

Hi, I have a class named ValidableComboBox that derives directly from QComboBox. Every instance of ValidableComboBox has setEditable() set to true. My goal is to add some signal that will be emitted whenever someone presses return key in the QComboBox. To do so, I reimplemented void KeyPressEvent(QKeyEvent* e) in ValidableComboBox. Ho...