def __init__(self): super().__init__() widget = QDial() widget.setRange(-10, 10) widget.setSingleStep(0.1) widget.valueChanged.connect(self.value_changed) widget.sliderMoved.connect(self.slider_moved) widget.sliderPressed.connect(self.slider_pressed) widget.sliderReleased.connect(self.slider_released) self.setCentralWidget(widget)
def __init__(self): super().__init__() self.setWindowTitle("My App") widget = QDial() widget.setRange(-10, 100) widget.setSingleStep(0.5) widget.valueChanged.connect(self.value_changed) widget.sliderMoved.connect(self.slider_position) widget.sliderPressed.connect(self.slider_pressed) widget.sliderReleased.connect(self.slider_released) self.setCentralWidget(widget)
def init_item_rotation_layout(item): current_rotation = item.rotation() label_layout = QHBoxLayout() label_layout.addWidget(QLabel("Rotation")) rotation_value_label = QLabel(str(current_rotation) + " \N{DEGREE SIGN}") label_layout.addWidget(rotation_value_label) rotation_layout = QVBoxLayout() rotation_layout.addLayout(label_layout) rotation_input = QDial() rotation_input.setMinimum(0) rotation_input.setMaximum(359) rotation_input.setSingleStep(1) rotation_input.setWrapping(True) rotation_input.setValue(int(current_rotation)) rotation_input.valueChanged.connect(lambda current_value: set_item_rotation( current_value, item, rotation_value_label)) rotation_layout.addWidget(rotation_input) return rotation_layout