def __init__(self, backgroundColor, foregroundColor, value, height, fontSize): QHBoxLayout.__init__(self) self.backgroundColor = backgroundColor self.foregroundColor = foregroundColor self.labelLayout = QVBoxLayout() self.upLabel = LabelButtons(backgroundColor, foregroundColor, height/2, height/2) self.labelLayout.addWidget(self.upLabel) self.upLabel.setSpinBoxUpIcon() self.upLabel.clicked.connect(self.on_upLabel) self.downLabel = LabelButtons(backgroundColor, foregroundColor, height/2, height/2) self.labelLayout.addWidget(self.downLabel) self.downLabel.setSpinBoxDownIcon() self.downLabel.clicked.connect(self.on_downLabel) self.addLayout(self.labelLayout) self.spinBox = QSpinBox() self.spinBox.valueChanged.connect(self.spinBoxValueChanged) self.addWidget(self.spinBox) self.spinBox.setToolTip("Spinbox") self.spinBox.setButtonSymbols(QAbstractSpinBox.NoButtons) self.spinBox.setAlignment(Qt.AlignRight) self.spinBox.setMaximum(value) self.spinBox.setMaximumHeight(height) self.spinBox.setSuffix("/" + str(value)) font = self.spinBox.font() font.setPixelSize(fontSize) self.spinBox.setFont(font) rgb = foregroundColor.getRgb() rgba_string = "rgba("+str(rgb[0])+","+str(rgb[1])+","+str(rgb[2])+","+str(0.6*100)+"%)" self.spinBox.setStyleSheet("QSpinBox { color: " + rgba_string + "; font: bold; background-color: " + str(backgroundColor.name()) + "; border:0;}")
def __init__(self, parentView, backgroundColor, foregroundColor, value, height, fontSize): QHBoxLayout.__init__(self) self.backgroundColor = backgroundColor self.foregroundColor = foregroundColor self.labelLayout = QVBoxLayout() self.upLabel = LabelButtons('spin-up', parentView, backgroundColor, foregroundColor, height/2, height/2) self.labelLayout.addWidget(self.upLabel) self.upLabel.clicked.connect(self.on_upLabel) self.downLabel = LabelButtons('spin-down', parentView, backgroundColor, foregroundColor, height/2, height/2) self.labelLayout.addWidget(self.downLabel) self.downLabel.clicked.connect(self.on_downLabel) self.addLayout(self.labelLayout) self.spinBox = QSpinBox() self.spinBox.valueChanged.connect(self.spinBoxValueChanged) self.addWidget(self.spinBox) self.spinBox.setToolTip("Spinbox") self.spinBox.setButtonSymbols(QAbstractSpinBox.NoButtons) self.spinBox.setAlignment(Qt.AlignRight) self.spinBox.setMaximum(value) self.spinBox.setMaximumHeight(height) self.spinBox.setSuffix("/" + str(value)) font = self.spinBox.font() font.setPixelSize(fontSize) self.spinBox.setFont(font) self.do_draw()
def __init__(self, obj, prop, name, init, low, high): QHBoxLayout.__init__(self) self.addWidget(QLabel(name)) self.spinbox = SpinBox(obj, prop) self.spinbox.setRange(low, high) self.spinbox.setValue(init) self.spinbox.setSingleStep(100) self.addWidget(self.spinbox)
def __init__(self, parent=None): QHBoxLayout.__init__(self) self.lineedit = QLineEdit(parent) self.addWidget(self.lineedit) self.button = QPushButton(parent) self.button.setText('...') self.button.clicked.connect(self._on_click) self.addWidget(self.button)
def __init__(self, color, parent=None): QHBoxLayout.__init__(self) assert isinstance(color, QColor) self.lineedit = QLineEdit(color.name(), parent) self.connect(self.lineedit, SIGNAL("textChanged(QString)"), self.update_color) self.addWidget(self.lineedit) self.colorbtn = ColorButton(parent) self.colorbtn.color = color self.connect(self.colorbtn, SIGNAL("colorChanged(QColor)"), self.update_text) self.addWidget(self.colorbtn)
def __init__(self): QHBoxLayout.__init__(self) self.maximumPageNumber = 0 self.currentPageNumber = 0 pageLayout = QHBoxLayout() self.addLayout(pageLayout) pageLayout.setMargin(0) pageLayout.setSpacing(0) self.pageLabel = QLabel(self.tr("Page: ")) self.pageLabel.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) pageLayout.addWidget(self.pageLabel) self.currentNumberLineEdit = QLineEdit() self.pageLabel.setBuddy(self.currentNumberLineEdit) pageLayout.addWidget(self.currentNumberLineEdit) self.currentNumberLineEdit.setMaximumWidth(35) self.currentNumberLineEdit.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.currentNumberLineEdit.setStyleSheet("border-left-width: 2px;" "border-right-width: 0px;" "border-top-width: 2px;" "border-bottom-width: 2px;" "border-style: solid;" "border-color: gray;") self.maximumNumberLineEdit = QLineEdit() pageLayout.addWidget(self.maximumNumberLineEdit) self.maximumNumberLineEdit.setMaximumWidth(40) self.maximumNumberLineEdit.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.maximumNumberLineEdit.setStyleSheet("border-left-width: 0px;" "border-right-width: 2px;" "border-top-width: 2px;" "border-bottom-width: 2px;" "border-style: solid;" "border-color: gray;") self.maximumNumberLineEdit.setReadOnly(True) self.updateText() buttonLayout = QHBoxLayout() buttonLayout.setMargin(0) buttonLayout.setSpacing(0) self.connect(self.currentNumberLineEdit, SIGNAL("editingFinished()"), self.validateText) self.previousPageButton = QPushButton(QIcon(":top.png"), "") self.connect(self.previousPageButton, SIGNAL("clicked()"), self.previousPageButtonPressed) buttonLayout.addWidget(self.previousPageButton) self.nextPageButton = QPushButton(QIcon(":down.png"), "") self.connect(self.nextPageButton, SIGNAL("clicked()"), self.nextPageButtonPressed) buttonLayout.addWidget(self.nextPageButton) self.addLayout(buttonLayout)
def __init__(self, name, model, fun_to_call): QHBoxLayout.__init__(self) label = QtGui.QLabel(name) combo = QtGui.QComboBox() combo.setModel(model) button = QtGui.QPushButton(u"Wykreśl") button.clicked.connect(lambda: fun_to_call(combo.currentIndex())) self.addWidget(label) self.addWidget(combo) self.addWidget(button)
def __init__(self, value, parent=None): QHBoxLayout.__init__(self) font = tuple_to_qfont(value) assert font is not None # Font family self.family = QFontComboBox(parent) self.family.setCurrentFont(font) self.addWidget(self.family) # Font size self.size = QComboBox(parent) self.size.setEditable(True) sizelist = list(itertools.chain(range(6, 12), range(12, 30, 2), [36, 48, 72])) size = font.pointSize() if size not in sizelist: sizelist.append(size) sizelist.sort() self.size.addItems([str(s) for s in sizelist]) self.size.setCurrentIndex(sizelist.index(size)) self.addWidget(self.size)
def __init__(self, parent=None ): QHBoxLayout.__init__(self, parent) self.setContentsMargins(0,4,0,0) self.setSpacing(0)
def __init__(self, *args, **kwargs): QHBoxLayout.__init__(self, *args, **kwargs)