def __init__(self, item) -> None: QGraphicsView.__init__(self) scene = QGraphicsScene(self) self.setScene(scene) item.setMinimumSize(QSize(150, 150)) item.setMaximum(36000) item.setSingleStep(100) item.setPageStep(100) item.setInvertedAppearance(True) item.setWrapping(True) item.setNotchTarget(.1) item.setNotchesVisible(True) graphics_item = scene.addWidget(item) graphics_item.setRotation(-90) # make the QGraphicsView invisible. self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setFixedHeight(item.height()) self.setFixedWidth(item.width()) self.setStyleSheet("border: 0px;")
def __init__(self, parent: QWidget): super(QRotatableView, self).__init__(parent) scene = QGraphicsScene(self) self.setScene(scene) self.dial = QDial() self.dial.setMinimumSize(QSize(150, 150)) self.dial.setSingleStep(100) self.dial.setPageStep(100) self.dial.setInvertedAppearance(True) self.dial.setWrapping(True) self.dial.setNotchTarget(0.1) self.dial.setNotchesVisible(True) self.dial.valueChanged.connect(self.__value_changed) self.set_maximum(360) graphics_item = scene.addWidget(self.dial) graphics_item.setRotation(-90) # make the QGraphicsView invisible. self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setFixedHeight(self.dial.height()) self.setFixedWidth(self.dial.width()) self.setStyleSheet("border: 0px;")