我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用PyQt4.QtCore.Qt.Horizontal()。
def __init__(self, parent=None): super(SeqDialog, self).__init__(parent) layout = QtGui.QVBoxLayout(self) self.table = QtGui.QTableWidget() self.table.setWindowTitle('Extension table') self.setWindowTitle('Extension table') self.resize(500, 285) self.table.setColumnCount(5) self.table.setHorizontalHeaderLabels(('Pos, Color, Preselection, Shortname, Sequence').split(', ')) self.table.horizontalHeader().setStretchLastSection(True) self.table.resizeColumnsToContents() layout.addWidget(self.table) self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def __init__(self, parent=None): super(PlateDialog, self).__init__(parent) layout = QtGui.QVBoxLayout(self) self.info = QtGui.QLabel('Please make selection: ') self.radio1 = QtGui.QRadioButton('Export only the sequences needed for this design. (176 staples in 2 plates)') self.radio2 = QtGui.QRadioButton('Export full 2 full plates for all sequences used (176 staples * number of unique sequences)') self.setWindowTitle('Plate export') layout.addWidget(self.info) layout.addWidget(self.radio1) layout.addWidget(self.radio2) self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def headerData(self, section, orientation, role=Qt.DisplayRole): if orientation == Qt.Vertical or role != Qt.DisplayRole: return QVariant() elif orientation == Qt.Horizontal: return self.headers[section]
def headerData(self, section, orientation, role): if role == Qt.DisplayRole and orientation==Qt.Horizontal: return keywordNameMap[self.seriesColumns[section]]
def headerData(self, section, orientation, role=Qt.DisplayRole): if role != Qt.DisplayRole: return QVariant() if orientation == Qt.Horizontal: try: return self.df.columns.tolist()[section] except (IndexError, ): return QVariant() elif orientation == Qt.Vertical: try: # return self.df.index.tolist() return self.df.index.tolist()[section] except (IndexError, ): return QVariant()
def __init__(self, parent=None): super(PipettingDialog, self).__init__(parent) layout = QtGui.QVBoxLayout(self) self.setWindowTitle('Pipetting dialog') self.loadButton = QtGui.QPushButton("Select folder") self.folderEdit = QtGui.QLabel('') self.csvCounter = QtGui.QLabel('') self.plateCounter = QtGui.QLabel('') self.uniqueCounter = QtGui.QLabel('') self.fulllist = [] self.loadButton.clicked.connect(self.loadFolder) layout.addWidget(self.loadButton) layout.addWidget(self.folderEdit) layout.addWidget(self.csvCounter) layout.addWidget(self.plateCounter) layout.addWidget(self.uniqueCounter) self.buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def __init__(self, parent=None): super(CalibrationDialog, self).__init__(parent) layout = QtGui.QVBoxLayout(self) self.table = QtGui.QTableWidget() tableitem = QtGui.QTableWidgetItem() self.table.setWindowTitle('Noise Model Calibration') self.setWindowTitle('Noise Model Calibration') self.resize(800, 400) layout.addWidget(self.table) # ADD BUTTONS: self.loadTifButton = QtGui.QPushButton("Load Tifs") layout.addWidget(self.loadTifButton) self.evalTifButton = QtGui.QPushButton("Evaluate Tifs") layout.addWidget(self.evalTifButton) self.pbar = QtGui.QProgressBar(self) layout.addWidget(self.pbar) self.loadTifButton.clicked.connect(self.loadTif) self.evalTifButton.clicked.connect(self.evalTif) self.buttons = QDialogButtonBox( QDialogButtonBox.ActionRole | QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def add_authentication(self): """Slot for when the add auth button is clicked.""" if qgis_version() >= 21200: from qgis.gui import QgsAuthConfigSelect dlg = QDialog(self) dlg.setWindowTitle(self.tr("Select Authentication")) layout = QVBoxLayout(dlg) acs = QgsAuthConfigSelect(dlg) if self.line_edit_auth_id.text(): acs.setConfigId(self.line_edit_auth_id.text()) layout.addWidget(acs) button_box = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, dlg) layout.addWidget(button_box) button_box.accepted.connect(dlg.accept) button_box.rejected.connect(dlg.close) dlg.setLayout(layout) dlg.setWindowModality(Qt.WindowModal) if dlg.exec_(): self.line_edit_auth_id.setText(acs.configId()) del dlg
def __init__(self, typeList, curType, curID, parent = None): super(modifyTypeID_Dialog, self).__init__(parent) self.select_type = typeList[0] self.select_ID = curID Vlayout = QtGui.QVBoxLayout(self) # widget for editing the date self.cb_label = QtGui.QLabel() self.cb_label.setText("LaneLine Type: ") self.sp_label = QtGui.QLabel() self.sp_label.setText("LaneLine ID: ") self.cb = QtGui.QComboBox() self.cb.addItems(typeList) self.cb.setCurrentIndex(typeList.index(curType)) self.cb.currentIndexChanged.connect(self.type_change) self.sp = QtGui.QSpinBox() self.sp.setRange(-128, 127) self.sp.setValue(curID) self.sp.valueChanged.connect(self.ID_change) # add widgets to layout Hlayout1 = QtGui.QHBoxLayout(self) Hlayout1.addWidget(self.cb_label) Hlayout1.addWidget(self.sp_label) Vlayout.addLayout(Hlayout1) Hlayout2 = QtGui.QHBoxLayout(self) Hlayout2.addWidget(self.cb) Hlayout2.addWidget(self.sp) Vlayout.addLayout(Hlayout2) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) Vlayout.addWidget(buttons)