qcombobox

Catch mouse button pressed signal from qComboBox popup menu

浪子不回头ぞ 提交于 2019-12-17 16:59:09
问题 I have made multi-select QComboBox . Items are checkable (every item have check box and text value). CheckBox is checked only when user click on it. What I want is to catch signal when user click on text value so I can set check box next to it checked. How to do that? This is how I set model to combo box: areas = ["Area one", "Area two", "Area three", "Area four"] model = QtGui.QStandardItemModel(5, 1)# 5 rows, 1 col firstItem = QtGui.QStandardItem("---- Select area(s) ----") firstItem

Catch mouse button pressed signal from qComboBox popup menu

狂风中的少年 提交于 2019-12-17 16:59:03
问题 I have made multi-select QComboBox . Items are checkable (every item have check box and text value). CheckBox is checked only when user click on it. What I want is to catch signal when user click on text value so I can set check box next to it checked. How to do that? This is how I set model to combo box: areas = ["Area one", "Area two", "Area three", "Area four"] model = QtGui.QStandardItemModel(5, 1)# 5 rows, 1 col firstItem = QtGui.QStandardItem("---- Select area(s) ----") firstItem

PyQT4 Combobox changes the list of another combobox [closed]

我是研究僧i 提交于 2019-12-13 04:48:25
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I just started using pyqt4 and am stuck on how to change a combobox list from another combobox. Is there a example of sometype that shows how to work this method. Do I use a if, else statement to change the

How to use QComboBox to choose how to save the format of a QImage

眉间皱痕 提交于 2019-12-13 00:07:30
问题 Sorry if this question is trivial but I have the following problem: I have N.1 QGraphicsView N.1 QComboBox I am trying to save the images uploaded on the QGraphicsView into a folder on my Desktop choosing the format of the image through a QComboBox . The loop I wrote it works for a .png file but I am stuck with other different formats as I am not sure how to correctly handle the QComboBox choice. See below the snipped of code I am using: mainwindow.h public: explicit MainWindow(QWidget

How to get the current value of a QComboBox with a model with two columns?

左心房为你撑大大i 提交于 2019-12-12 12:04:54
问题 I have a QComboBox with a QSqlQueryModel as its model. The model is constructed from a database with SELECT type_id, type FROM types where type_id is int and type is a varchar . I set the QComboBox visible column with the setModelColumn(1) function, to see the actual types, instead of the indexes, but when a value is selected, I need to retrieve the type_id and I don't know how to achieve that. I can't use here the currentIndex() function, because the current index of the QComboBox is useless

How to customize QCombobox with multiple comlumns

杀马特。学长 韩版系。学妹 提交于 2019-12-12 02:56:46
问题 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. 回答1: You should create new custom QAbstractItemDelegate and set it to QComboBox using void QComboBox::setItemDelegate ( QAbstractItemDelegate * delegate ) api. In delegate, you need to implement virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const = 0 as

Qt QCombobox currentIndexChanged signal

人走茶凉 提交于 2019-12-12 02:09:54
问题 How get ItemIndex from one ComboBox and send to another ComboBox? Both Comb's created in QTableWidget QComboBox *comboA = static_cast<QComboBox*>(ui->tableWidget->cellWidget(0,0)); QComboBox *comboB = static_cast<QComboBox*>(ui->tableWidget->cellWidget(0,1)); QObject::connect(comboA, SIGNAL(currentIndexChanged(int)),comboB, SLOT(setCurrentIndex(int))); But this code does not work. Rather, it is necessary to define new methods for pointers. 来源: https://stackoverflow.com/questions/17748109/qt

QCombobox of Checkboxes

那年仲夏 提交于 2019-12-12 01:24:55
问题 I have a problem and I hope that you can help me. I want to create a Combobox of Checkboxes on Qt Creator. This is my code mod = new QStandardItemModel(1,0); QStandardItem *item; item = new QStandardItem("First"); item->setCheckable(true); mod->setItem(0,item); item = new QStandardItem("Second"); item->setCheckable(true); mod->setItem(1,item); ui->comboBox->setModel(mod); I built this code but in combobox are no checkboxees. Someone on the web told me that I have to use the event. Can you

Qt:Unable to set Background color for qComboBox properly

时光毁灭记忆、已成空白 提交于 2019-12-11 16:55:38
问题 I have a QCombobox and I want to set a white background color.This is my code. QComboBox *cBox = new QComboBox; cBox->addItem("Text1"); cBox->setStyleSheet("background-color:white"); This combobox has a parent widget whose background is an image and is set as given below: ui->centralWidget->setStyleSheet("border-image:url(./image.png)"); When I set the parent Widget[centralWidget] background as some other color,then the white BG works properly for the combobox.But when I set an image as the

PyQt - QCombobox in QTableview

自作多情 提交于 2019-12-11 15:16:23
问题 I am displaying data from an SQLite database in a QTableView using a QSqlTableModel. Letting the user edit this data works fine. However, for some columns I want to use QComboboxes instead of free text cells, to restrict the list of possible answers. I have found this SO answer and am trying to implement it on my model/view setting, but I'm running into problems (so this is a follow-up). Here's a full mini-example: #!/usr/bin/python3 # -*- coding: utf-8 -*- from PyQt5 import QtSql from PyQt5