def fill_list(self): for i in range(1, 9): item = QListWidgetItem('%02d' % i, self.list) item.setSizeHint(QSize(200, 30)) item._coltab_index = i #item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled) lab = QLabel(parent=None) lab.setPixmap(ct.get_pixmap(i, size=(200, 30))) self.list.setItemWidget(item, lab) item = QListWidgetItem('cancel', self.list) self.list.setItemWidget(item, self.but_cancel)
def __init__V0(self, parent=None): QDialog.__init__(self, parent) self.ctab_selected = None #self.list = QListWidget(parent) #self.fill_list(lst) #self.fill_list_icons(lst_icons) # Confirmation buttons self.but_cancel = QPushButton('&Cancel') #self.but_apply = QPushButton('&Apply') #self.but_create = QPushButton('&Create') #cp.setIcons() #self.but_cancel.setIcon(cp.icon_button_cancel) #self.but_apply .setIcon(cp.icon_button_ok) #self.connect(self.but_cancel, QtCore.SIGNAL('clicked()'), self.onCancel) #self.connect(self.but_apply, QtCore.SIGNAL('clicked()'), self.onApply) #self.hbox = QVBoxLayout() #self.hbox.addWidget(self.but_cancel) #self.hbox.addWidget(self.but_apply) ##self.hbox.addStretch(1) vbox = QVBoxLayout() for i in range(1, 9): lab = QLabel(parent=None) lab.setPixmap(ct.get_pixmap(i, size=(200, 30))) #lab.setText('%02d'%i) # set text !!!OR!!! pixmam #lab.setContentsMargins(QMargins(-5,-5,-5,-5)) #lab.setFixedSize(200,10) lab._coltab_index = i vbox.addWidget(lab) vbox.addStretch() vbox.addWidget(self.but_cancel) self.setLayout(vbox) self.connect(self.but_cancel, QtCore.SIGNAL('clicked()'), self.onCancel) self.showToolTips() self.setStyle()