我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用PyQt4.QtCore.Qt.AlignRight()。
def create_widgets(self, width, height): self.widthLabel = QLabel("&Width:") self.widthSpinBox = QSpinBox() self.widthLabel.setBuddy(self.widthSpinBox) self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter) self.widthSpinBox.setRange(4, width * 4) self.widthSpinBox.setValue(width) self.heightLabel = QLabel("&Height:") self.heightSpinBox = QSpinBox() self.heightLabel.setBuddy(self.heightSpinBox) self.heightSpinBox.setAlignment(Qt.AlignRight| Qt.AlignVCenter) self.heightSpinBox.setRange(4, height * 4) self.heightSpinBox.setValue(height) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok| QDialogButtonBox.Cancel)
def create_widgets(self, width, height): self.widthLabel = QLabel(self.tr("&Width:")) self.widthSpinBox = QSpinBox() self.widthLabel.setBuddy(self.widthSpinBox) self.widthSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter) self.widthSpinBox.setRange(4, width * 4) self.widthSpinBox.setValue(width) self.heightLabel = QLabel(self.tr("&Height:")) self.heightSpinBox = QSpinBox() self.heightLabel.setBuddy(self.heightSpinBox) self.heightSpinBox.setAlignment(Qt.AlignRight|Qt.AlignVCenter) self.heightSpinBox.setRange(4, height * 4) self.heightSpinBox.setValue(height) self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok| QDialogButtonBox.Cancel)
def initUI(self): font1 = QFont('Helvetica', large_text_size) font2 = QFont('Helvetica', small_text_size) self.vbox= QVBoxLayout() self.time1 = '' self.timeLbl = QLabel('') self.timeLbl.setAlignment(Qt.AlignRight) self.timeLbl.setFont(font1) self.day_of_week1 = '' self.dayOWLbl = QLabel('') self.dayOWLbl.setAlignment(Qt.AlignRight) self.date1 = '' self.dateLbl = QLabel('') self.dateLbl.setAlignment(Qt.AlignRight) self.vbox.addWidget(self.timeLbl) self.vbox.addWidget(self.dayOWLbl) self.vbox.addWidget(self.dateLbl) self.vbox.addStretch(2) self.vbox.setSpacing(0) self.setContentsMargins(0,0,0,0) self.setLayout(self.vbox) self.time_update()
def alignRight(self): self.text.setAlignment(Qt.AlignRight)