def _create_control(self): ctrl = QGraphicsView() ctrl.setRenderHints(QPainter.Antialiasing) scene = QGraphicsScene() ctrl.setScene(scene) scene.setBackgroundBrush(QBrush(QColor(237, 237, 237))) ctrl.setStyleSheet("border: 0px") w, h = 150, 150 ctrl.setMinimumHeight(h + 22) ctrl.setMinimumWidth(w + 22) cx, cy = w / 2, h / 2. ex, ey = cx, cy + 20 pen = QPen() pen.setStyle(Qt.NoPen) # pen.setColor(QColor(237, 237, 237)) bounding_rect = scene.addRect(0, 0, w, h, pen=pen) bounding_rect.setFlag(QGraphicsItem.ItemClipsChildrenToShape) self.animation = QSequentialAnimationGroup() self._add_laser_logo(scene, bounding_rect, ex, ey, cx, cy, w, h) self._add_bullet(scene, bounding_rect, ex, ey, cx, cy) self._add_fragments(scene, bounding_rect, ex, ey) self.animation.setLoopCount(-1) return ctrl
def _create_control(self): ctrl = QGraphicsView() scene = QGraphicsScene() ctrl.setScene(scene) scene.setBackgroundBrush(QBrush(QColor(237, 237, 237))) ctrl.setStyleSheet("border: 0px") md = self._dimension * 3 + self._spacing * 4 ctrl.setMaximumWidth(md) ctrl.setMaximumHeight(md) layout = QVBoxLayout() layout.addWidget(ctrl) self._scene = scene self.control = QWidget() self.control.setLayout(layout)