qcombobox

ComboBox function currentIndexChanged not working correctly

我的未来我决定 提交于 2019-12-01 23:17:50
I have taken two comboBoxes i.e., comboBox1 and comboBox_2 and two functions test and test1 and calling them using currentIndexChanged (self.comboBOx1.currentIndexChanged and self.comboBOx_2.currentIndexChanged). When a value is selected from comboBox1 its corresponding function(self.comboBOx1.currentIndexChanged) is called and same for comboBox_2. On selection of value from comboBox1 changes the values in comboBox_2 and its working fine. But the problem I have got here is that at first when I select a value from comboBox1 and comboBox_2 I'm getting the expected values from the called function

Remove QComboBox listView shadow effect

自闭症网瘾萝莉.ら 提交于 2019-12-01 19:19:36
By default, the QComboBox listview has shadow effect. Is there a way to remove it? Is the shadow controlled from QStyle or in some other way? The shadow effect is not a Qt specific thing, its a Desktop theme specific thing. The shadow depends on the style/theme your desktop environment is using. If your style/theme defines shadows for QComboBox then Qt will very promptly draw it. That said, you may search for a style that does not draw a shadow. I got the effect by doing so: cb = QComboBox() cb.addItems( [ '1', '2', '3', '4', '5', '6' ] ) cb.setStyle( QStyleFactory.create( "Polyester" ) ) cb

Remove QComboBox listView shadow effect

别来无恙 提交于 2019-12-01 17:29:20
问题 By default, the QComboBox listview has shadow effect. Is there a way to remove it? Is the shadow controlled from QStyle or in some other way? 回答1: The shadow effect is not a Qt specific thing, its a Desktop theme specific thing. The shadow depends on the style/theme your desktop environment is using. If your style/theme defines shadows for QComboBox then Qt will very promptly draw it. That said, you may search for a style that does not draw a shadow. I got the effect by doing so: cb =

QCombobox works very slow with QSqlQueryModel with large model

给你一囗甜甜゛ 提交于 2019-12-01 10:47:38
I have few comboboxes with very dig data sets within ~ 100K rows and more. I tried it with QStandardItemModel - works fast enough if model is preloaded, also model loading takes few seconds if performed in separate thread. Tried comboboxes with QSqlQueryModel without threading to improve performance but experienced it works much slower than QStandardItemModel (in our project QSqlQueryModel works very fast with such amount of data with QTreeView for example). What could be the problem here? Is there a way to speed-up combobox, some parameters? P.S. Suggested by Qt doc QComboBox:

PyQt5 ComboBox - how do I set the color of CurrentText without affecting the dropdown list?

落花浮王杯 提交于 2019-12-01 10:12:49
The following snippet correctly sets the colors of individual entries in the ComboBox dropdown list. However, when an item is selected and transferred to the CurrentText field, all of the entries in the dropdown change to the color of CurrentText. How do I transfer the color of an entry to be displayed as CurrentText without affecting the dropdown list? import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * class ComboDemo(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): def combo_changed(): for color in ('red', 'green',

How to center text in QComboBox?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 06:31:51
I've tried using QComboBox's model() with no apparent success. I wonder if it would be possible to align a text at the center of QCombobox. Aside from text alignment it seems the item's font is not effected by changing its PointSize.... combo=QtGui.QComboBox() comboModel=combo.model() for name in ['one','two','three']: item = QtGui.QStandardItem(name) itemFont = item.font() itemFont.setPointSize(8) item.setFont(itemFont) # item.setAlignment(QtCore.Qt.AlignCenter) comboModel.appendRow(item) You can use setAlignment method: from PyQt4 import QtGui, QtCore class Window(QtGui.QWidget): def __init_

How to center text in QComboBox?

怎甘沉沦 提交于 2019-12-01 05:15:33
问题 I've tried using QComboBox's model() with no apparent success. I wonder if it would be possible to align a text at the center of QCombobox. Aside from text alignment it seems the item's font is not effected by changing its PointSize.... combo=QtGui.QComboBox() comboModel=combo.model() for name in ['one','two','three']: item = QtGui.QStandardItem(name) itemFont = item.font() itemFont.setPointSize(8) item.setFont(itemFont) # item.setAlignment(QtCore.Qt.AlignCenter) comboModel.appendRow(item)

QComboBox drop-down list - set selected item style

狂风中的少年 提交于 2019-12-01 03:36:58
Is it possible to set selected item style (Qt style sheet) of the QComboBox drop-down list? Gabor Herman The solution is to create a ListView object set its stylesheet use it as the view of the ComboBox Here is how: int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow * mainWindow = new QMainWindow(); QComboBox * combo = new QComboBox(mainWindow); QListView * listView = new QListView(combo); combo->addItem("foo"); combo->addItem("bar"); combo->addItem("foobar"); combo->addItem("fooooo"); listView->setStyleSheet("QListView::item { \ border-bottom: 5px solid white; margin

PyQt - QComboBox connection confirmed but function is not being called

扶醉桌前 提交于 2019-12-01 01:05:42
I am having a bit of trouble with the signal/slot issues using PyQt. My code is below, but it probably deserves a bit of explanation. The first two QObject.connect() return True, so I know the connection is established. However, when changing the selection in the comboBox, the function getParameters is not called as expected. The 5 connects below that were for debugging and testing the other signals associated with ComboBox. Those do not print the the log as expected either. From what I've read else where there are newer ways to specify a connection, could this be the issue? And if so, can

PyQT5 QComboBox - get value of combobox

寵の児 提交于 2019-12-01 00:25:00
I am still very new to Qt but I am developing a type of calculator and want to use a combobox to select a coefficient. I have had success creating a combobox with a liststore in pyGT but it appears pyQT is quite different. I am having a hard time wrapping my head around the data models and list models. Essentially I want to have a name show up in the combobox and have the value of that name get passed to the calculator equation. Everything I have seen so far has been just for single entries and not 'associated' entries. Can anyone explain or point me to a tutorial to walk me through what I am