本文整理汇总了Python中PySide.QtGui.QSlider.setPageStep方法的典型用法代码示例。如果您正苦于以下问题:Python QSlider.setPageStep方法的具体用法?Python QSlider.setPageStep怎么用?Python QSlider.setPageStep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QSlider
的用法示例。
在下文中一共展示了QSlider.setPageStep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from PySide.QtGui import QSlider [as 别名]
# 或者: from PySide.QtGui.QSlider import setPageStep [as 别名]
class MainWindow(QWidget):
# noinspection PyUnresolvedReferences
def __init__(self, clipboard):
super().__init__()
self.clipboard = clipboard
self.setWindowIcon(QIcon('Logo_rendered_edited.png'))
self.layout = QBoxLayout(QBoxLayout.TopToBottom, self)
self.generator = CtSesam()
self.iterations = 4096
# Master password
self.master_password_label = QLabel("&Master-Passwort:")
self.maser_password_edit = QLineEdit()
self.maser_password_edit.setEchoMode(QLineEdit.EchoMode.Password)
self.maser_password_edit.textChanged.connect(self.reset_iterations)
self.maser_password_edit.returnPressed.connect(self.move_focus)
self.maser_password_edit.setMaximumHeight(28)
self.master_password_label.setBuddy(self.maser_password_edit)
self.layout.addWidget(self.master_password_label)
self.layout.addWidget(self.maser_password_edit)
# Domain
self.domain_label = QLabel("&Domain:")
self.domain_edit = QLineEdit()
self.domain_edit.textChanged.connect(self.reset_iterations)
self.domain_edit.returnPressed.connect(self.move_focus)
self.domain_edit.setMaximumHeight(28)
self.domain_label.setBuddy(self.domain_edit)
self.layout.addWidget(self.domain_label)
self.layout.addWidget(self.domain_edit)
# Username
self.username_label = QLabel("&Username:")
self.username_edit = QLineEdit()
self.username_edit.textChanged.connect(self.reset_iterations)
self.username_edit.returnPressed.connect(self.move_focus)
self.username_edit.setMaximumHeight(28)
self.username_label.setBuddy(self.username_edit)
self.layout.addWidget(self.username_label)
self.layout.addWidget(self.username_edit)
# Checkboxes
self.special_characters_checkbox = QCheckBox("Sonderzeichen")
self.special_characters_checkbox.setChecked(True)
self.special_characters_checkbox.stateChanged.connect(self.reset_iterations)
self.layout.addWidget(self.special_characters_checkbox)
self.letters_checkbox = QCheckBox("Buchstaben")
self.letters_checkbox.setChecked(True)
self.letters_checkbox.stateChanged.connect(self.reset_iterations)
self.layout.addWidget(self.letters_checkbox)
self.digits_checkbox = QCheckBox("Zahlen")
self.digits_checkbox.setChecked(True)
self.digits_checkbox.stateChanged.connect(self.reset_iterations)
self.layout.addWidget(self.digits_checkbox)
# Length slider
self.length_label = QLabel("&Länge:")
self.length_display = QLabel()
self.length_label_layout = QBoxLayout(QBoxLayout.LeftToRight)
self.length_label_layout.addWidget(self.length_label)
self.length_label_layout.addWidget(self.length_display)
self.length_label_layout.addStretch()
self.length_slider = QSlider(Qt.Horizontal)
self.length_slider.setMinimum(4)
self.length_slider.setMaximum(20)
self.length_slider.setPageStep(1)
self.length_slider.setValue(10)
self.length_display.setText(str(self.length_slider.sliderPosition()))
self.length_slider.valueChanged.connect(self.length_slider_changed)
self.length_label.setBuddy(self.length_slider)
self.layout.addLayout(self.length_label_layout)
self.layout.addWidget(self.length_slider)
# Button
self.generate_button = QPushButton("Erzeugen")
self.generate_button.clicked.connect(self.generate_password)
self.generate_button.setAutoDefault(True)
self.layout.addWidget(self.generate_button)
# Password
self.password_label = QLabel("&Passwort:")
self.password = QLabel()
self.password.setTextFormat(Qt.PlainText)
self.password.setAlignment(Qt.AlignCenter)
self.password.setFont(QFont("Helvetica", 18, QFont.Bold))
self.password_label.setBuddy(self.password)
self.layout.addWidget(self.password_label)
self.layout.addWidget(self.password)
# Iteration display
self.message_label = QLabel()
self.message_label.setTextFormat(Qt.RichText)
self.message_label.setVisible(False)
self.layout.addWidget(self.message_label)
# Window layout
self.layout.addStretch()
self.setGeometry(0, 30, 300, 400)
self.setWindowTitle("c't SESAM")
self.maser_password_edit.setFocus()
self.show()
def length_slider_changed(self):
self.length_display.setText(str(self.length_slider.sliderPosition()))
self.reset_iterations()
def reset_iterations(self):
self.iterations = 4096
self.message_label.setVisible(False)
#.........这里部分代码省略.........