qlistwidgetitem

PySide: QListWIdget item disappearing when I remove and add item sometimes

依然范特西╮ 提交于 2020-05-24 07:29:13
问题 The bounty expires in 2 days . Answers to this question are eligible for a +50 reputation bounty. Shock-o-lot wants to draw more attention to this question. I have a QListWidget with custom widgets. I am seeing an issue where if I do the following: add two items Remove the second item Add another item then the first item's widget contents disappears until I either resize the window, or add a third item. import sys from PySide.QtGui import * from PySide.QtCore import * class StagingWidget

How to properly add strings to QListWidgets?

懵懂的女人 提交于 2019-12-24 05:16:13
问题 In the following code the method exec(const char *cmd) runs a bash script and returns the output as a vector of strings. The intent is to create a QListWidgetItem out of each of those strings and add them to a QListWidget on a little GUI that I have created, but the QListWidgetItem s are not created successfully. I always seem to be required to use a const char* to create either a QString or QListWidgetItem , it will not allow me to create one using a string variable. You can see what I am

How to display partially bold text in QListWidgetItem with QtCore.Qt.UserRole

℡╲_俬逩灬. 提交于 2019-12-11 03:33:57
问题 I want to display a single word in a QListWidgetItem in bold font. According to this related post, it should be possible to use QtCore.Qt.UserRole for this purpose. However, the sample code provided did not work for me. (Since I'm a beginner, I most likely forgot a definition, but I don't know which one.) This is what I have so far: main.ui <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Dialog</class> <widget class="QDialog" name="Dialog"> <property name="geometry"> <rect>

PyQt QListWidget custom items

痞子三分冷 提交于 2019-11-27 06:50:56
how can i create a QListWidgetItem that has 1 image and 2 labels/strings underneath, that have support for css? this is the last thing i have tried: class CustomListWidgetItem(QListWidgetItem, QLabel): def __init__(self, parent=None): QListWidgetItem.__init__(self, parent) QLabel.__init__(self, parent) i'm using PyQt btw Kitsune Meyoko how can i create a QListWidgetItem that has 1 image and 2 labels/strings underneath, that have support for css? In this case, you can't (it actually has an API for adding icons easily, but two labels/strings is impossible). But, you can create your own custom

PyQt QListWidget custom items

▼魔方 西西 提交于 2019-11-26 12:14:14
问题 how can i create a QListWidgetItem that has 1 image and 2 labels/strings underneath, that have support for css? this is the last thing i have tried: class CustomListWidgetItem(QListWidgetItem, QLabel): def __init__(self, parent=None): QListWidgetItem.__init__(self, parent) QLabel.__init__(self, parent) i\'m using PyQt btw 回答1: how can i create a QListWidgetItem that has 1 image and 2 labels/strings underneath, that have support for css? In this case, you can't (it actually has an API for