qcombobox

Dropping an item on a QComboBox?

ぃ、小莉子 提交于 2019-12-11 11:45:42
问题 Perhaps I am looking in the wrong place, or maybe I don't quite understand the concept fully; but I'm trying to find a working example where I can drop a text file on a QComboBox , and it will trigger a drop event that I can handle. I looking through the documentation, but there isn't a whole lot of information on the subject. I have also searched around, but I haven't really found anything either. If I'm just not looking in the right place, please feel free to point me in the right direction

Not able to hide Choice-Indicator of the QComboBox

╄→гoц情女王★ 提交于 2019-12-11 10:24:18
问题 programmer When I set the background-color of the list view belonging to the QComboBox (per QSS), then this QComboBox will no more use the built-in-opticel-look-and feel. Instaed I have to specify all optical settings also per QSS-Stylesheet: QComboBox QListView { background-color:white; border:1px solid black; } The list view, which shows the chosable item, displays a checkbox on the left now. This box is checked for those item, chosen on last usage. How can i hide the column with the

QIcon inside combobox

一世执手 提交于 2019-12-11 10:09:10
问题 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 回答1: I've written code a bit like this, where I wanted to put a tree view inside a combo box and I needed to take an action when the check box on the tree was clicked. What I ended up doing was installing an event

How-to override KeyPressEvent for an editable QComboBox?

谁都会走 提交于 2019-12-11 08:53:38
问题 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 . However, it seems that it never gets called when I type something into the combobox. Is there a way to achieve this ? What could possibly be wrong with what I have

Choose databits from combobox

佐手、 提交于 2019-12-11 07:33:13
问题 I have a simple GUI for serial communication with an Arduino UNO. First I list all databit in an OrderedDict , then I put them in a combobox: self.databits = OrderedDict([ ('5', QtSerialPort.QSerialPort.Data5), ('6', QtSerialPort.QSerialPort.Data6), ('7', QtSerialPort.QSerialPort.Data7), ('8', QtSerialPort.QSerialPort.Data8) ]) self.databit_comboBox.addItems(list(self.databits)) Then I run the code, I select an option from databits combobox (this is how I get data from combobox) self.serial

Inserting a child Item into a row of QTreeWidgetItems

孤人 提交于 2019-12-11 06:05:59
问题 I have setup my QTreeWidget such that each cell is filled with comboboxes, however I would like to create a text edit widget next to the selected combobox (or overwrite the existing combobox), depending on which combobox item the user has selected. I figured I could do this by adding the comboboxes parent as a property when its initially setup and then upon interaction with the combobox simply use setItemWidget to put a text edit Item in column after the selected combobox (using the same

Dynamic QComboBox fill dependent on user input PyQt5

*爱你&永不变心* 提交于 2019-12-11 01:57:57
问题 I created QTableWidget and in first two columns inserted comboboxes. The first column contains unique records (first elements from list of lists). My aim is to make these combo boxes fully dynamic, i.e. if the user selects 'Butterfly' within the first combobox, the second combobox will offer 'PP' and 'BR' for selection. Refining the search should work even from other side, i.e. if user selects 'KL' in the second combobox, then the first one will automaticaly fill in 'Toy'. I tried (using

Mouse press slot for QComboBox - fill the items dynamically if user clicks the combobox

守給你的承諾、 提交于 2019-12-11 01:33:21
问题 In Qt QComboBox, there is no clicked signal to get the slot to override. But I need to fill the combo box items dynamically. That is, I need to check the items and renew the combo box all items list (when user changes other items should have impact on the list). 回答1: For this complicated issue, we can use event filter method in qt. Try to return false for all action to make the further process taken place. bool QtMyWindow::eventFilter(QObject *f_object, QEvent *f_event){ if(f_object == ui-

How to make QCombobox expandable for hierarchical items?

不羁岁月 提交于 2019-12-11 00:58:15
问题 i have a some dictionary variables such as : {"Courses" : ["Math" , "Science" , "English"]} , {"Cars" : ["Ford" , "BMW" , "Mercedes"]} , etc. i want to select values from qcombobox but firstly, i need to keep the cursor at keys from qcombobox then select the value from the highlighted key. Courses Cars-->Ford -->BMW -->Mercedes How can i do something like that? Thanks for reply. 回答1: You can use a QPushButton with a QMenu as I show below: PyQt4: from PyQt4 import QtCore, QtGui data =[{

QComboBox - How to set hint text on combo box

↘锁芯ラ 提交于 2019-12-10 21:38:12
问题 The application GUI I working requires a combo box for user to select item. When the application starts, the combo box will show a hint text something like "Please select" instead of showing the first item of the combo box. I cannot find any method for setting the hint text in http://doc.qt.io/qt-5/qcombobox.html#currentText-prop. Thank in advance! 回答1: There is an elegant solution if the QComboBox is editable : myQComboBox->lineEdit()->setPlaceHolderText("Please select"); QComboBox es that