def __init__(self, parent=None): KVBox.__init__(self, parent) self.help = QLabel (i18n (helpText), self) self.layout ().setAlignment (self.help, Qt.AlignHCenter) self.setSpacing (10) hBox = KHBox (self) self.layout ().setAlignment (hBox, Qt.AlignHCenter) cBox = KVBox (hBox) hBox.layout ().setAlignment (cBox, Qt.AlignTop) hBox.setSpacing (25) hBox.setMargin (10) self.stdDirs = KStandardDirs () types = self.stdDirs.allTypes () comboLbl = QLabel ("Types", cBox) combo = KComboBox (cBox) combo.addItems (types) cBox.layout ().setAlignment (comboLbl, Qt.AlignTop) cBox.layout ().setAlignment (combo, Qt.AlignTop) self.connect (combo, SIGNAL ("currentIndexChanged (const QString&)"), self.slotIndexChanged) lBox = KVBox (hBox) listLbl = QLabel ("Directories", lBox) self.location = KListWidget (lBox) self.location.setMaximumSize (400, 200) lBox.layout ().setAlignment (listLbl, Qt.AlignTop) lBox.layout ().setAlignment (self.location, Qt.AlignTop) QLabel (self.stdDirs.installPath ("ui"), self) self.slotIndexChanged (combo.currentText ())
def __init__(self, parent=None): KVBox.__init__(self, parent) self.help = QLabel(i18n(helpText), self) self.layout().setAlignment(self.help, Qt.AlignHCenter) self.setSpacing(10) hBox = KHBox(self) self.layout().setAlignment(hBox, Qt.AlignHCenter) cBox = KVBox(hBox) hBox.layout().setAlignment(cBox, Qt.AlignTop) hBox.setSpacing(25) hBox.setMargin(10) self.stdDirs = KStandardDirs() types = self.stdDirs.allTypes() comboLbl = QLabel("Types", cBox) combo = KComboBox(cBox) combo.addItems(types) cBox.layout().setAlignment(comboLbl, Qt.AlignTop) cBox.layout().setAlignment(combo, Qt.AlignTop) self.connect(combo, SIGNAL("currentIndexChanged (const QString&)"), self.slotIndexChanged) lBox = KVBox(hBox) listLbl = QLabel("Directories", lBox) self.location = KListWidget(lBox) self.location.setMaximumSize(400, 200) lBox.layout().setAlignment(listLbl, Qt.AlignTop) lBox.layout().setAlignment(self.location, Qt.AlignTop) self.slotIndexChanged(combo.currentText())
def __init__(self, parent=None): KVBox.__init__(self, parent) self.help = QLabel(helpText, self) self.layout().setAlignment(self.help, Qt.AlignHCenter) hBox1 = KHBox(self) hBox1.setSpacing(10) hBox1.setMargin(40) colorButtonLabel = QLabel("KColorButton", hBox1) colorButton = KColorButton(hBox1) colorCellsLabel = QLabel("KColorCells", hBox1) colorCells = KColorCells(hBox1, 1, 8) colorCells.setMaximumSize(160, 20) colorCells.setColor(0, Qt.black) colorCells.setColor(1, Qt.red) colorCells.setColor(2, Qt.yellow) colorCells.setColor(3, Qt.blue) colorCells.setColor(4, Qt.darkGreen) colorCells.setColor(5, Qt.magenta) colorCells.setColor(6, Qt.gray) colorCells.setColor(7, Qt.white) colorComboLabel = QLabel("KColorCombo", hBox1) colorCombo = KColorCombo(hBox1) colorList = [ Qt.black, Qt.red, Qt.yellow, Qt.blue, Qt.darkGreen, Qt.magenta, Qt.gray, Qt.white ] colorCombo.setColors(colorList) colorCombo.setMaximumWidth(80) hBox2 = KHBox(self) hBox2.setSpacing(10) self.layout().setAlignment(hBox2, Qt.AlignHCenter | Qt.AlignTop) self.setStretchFactor(hBox2, 1) colorPatchLabel = QLabel("KColorPatch", hBox2) hBox2.layout().setAlignment(colorPatchLabel, Qt.AlignHCenter) self.colorPatch = KColorPatch(hBox2) self.colorPatch.setFixedSize(40, 40) hBox2.layout().setAlignment(self.colorPatch, Qt.AlignHCenter) self.colorPatch.setColor(Qt.red) self.colorPatch.show() self.connect(colorButton, SIGNAL("changed (const QColor&)"), self.colorPatch.setColor) self.connect(colorCells, SIGNAL("colorSelected (int, const QColor&)"), self.colorCellSelected) self.connect(colorCombo, SIGNAL("activated (const QColor&)"), self.colorPatch.setColor)
def __init__(self, parent=None): KVBox.__init__(self, parent) self.help = QLabel (helpText, self) self.layout ().setAlignment (self.help, Qt.AlignHCenter) hBox1 = KHBox (self) hBox1.setSpacing (10) hBox1.setMargin (40) colorButtonLabel = QLabel ("KColorButton", hBox1) colorButton = KColorButton (hBox1) colorCellsLabel = QLabel ("KColorCells", hBox1) colorCells = KColorCells (hBox1, 1, 8) colorCells.setMaximumSize (160, 20) colorCells.setColor (0, Qt.black) colorCells.setColor (1, Qt.red) colorCells.setColor (2, Qt.yellow) colorCells.setColor (3, Qt.blue) colorCells.setColor (4, Qt.darkGreen) colorCells.setColor (5, Qt.magenta) colorCells.setColor (6, Qt.gray) colorCells.setColor (7, Qt.white) colorComboLabel = QLabel ("KColorCombo", hBox1) colorCombo = KColorCombo (hBox1) colorList = [Qt.black, Qt.red, Qt.yellow, Qt.blue, Qt.darkGreen, Qt.magenta, Qt.gray, Qt.white] colorCombo.setColors (colorList) colorCombo.setMaximumWidth (80) hBox2 = KHBox (self) hBox2.setSpacing (10) self.layout ().setAlignment (hBox2, Qt.AlignHCenter | Qt.AlignTop) self.setStretchFactor (hBox2, 1) colorPatchLabel = QLabel ("KColorPatch", hBox2) hBox2.layout ().setAlignment (colorPatchLabel, Qt.AlignHCenter) self.colorPatch = KColorPatch (hBox2) self.colorPatch.setFixedSize (40, 40) hBox2.layout ().setAlignment (self.colorPatch, Qt.AlignHCenter) self.colorPatch.setColor (Qt.red) self.colorPatch.show () self.connect (colorButton, SIGNAL ("changed (const QColor&)"), self.colorPatch.setColor) self.connect (colorCells, SIGNAL ("colorSelected (int, const QColor&)"), self.colorCellSelected) self.connect (colorCombo, SIGNAL ("activated (const QColor&)"), self.colorPatch.setColor)
def __init__(self, parent=None): super(KVBox, self).__init__(parent) self.help = QLabel(i18n(helpText), self) self.layout().setAlignment(self.help, Qt.AlignHCenter) self.setSpacing(10) hBox = KHBox(self) self.layout().setAlignment(hBox, Qt.AlignHCenter) cBox = KVBox(hBox) hBox.layout().setAlignment(cBox, Qt.AlignTop) hBox.setSpacing(25) hBox.setMargin(10) self.stdDirs = KStandardDirs() types = self.stdDirs.allTypes() comboLbl = QLabel("Types", cBox) combo = KComboBox(cBox) combo.addItems(types) cBox.layout().setAlignment(comboLbl, Qt.AlignTop) cBox.layout().setAlignment(combo, Qt.AlignTop) # We're calling the QString version of the signal, as # currentIndexChanged can also be emitted with an int (the index that # changed) combo.currentIndexChanged[QString].connect(self.slotIndexChanged) lBox = KVBox(hBox) listLbl = QLabel("Directories", lBox) self.location = KListWidget(lBox) self.location.setMaximumSize(400, 200) lBox.layout().setAlignment(listLbl, Qt.AlignTop) lBox.layout().setAlignment(self.location, Qt.AlignTop) QLabel(self.stdDirs.installPath("ui"), self) self.slotIndexChanged(combo.currentText())