当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QGraphicsDropShadowEffect类代码示例

本文整理汇总了Python中PyQt4.QtGui.QGraphicsDropShadowEffect的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsDropShadowEffect类的具体用法?Python QGraphicsDropShadowEffect怎么用?Python QGraphicsDropShadowEffect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QGraphicsDropShadowEffect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: enableHoverEffect

 def enableHoverEffect(self):
     e = QGraphicsDropShadowEffect()
     e.setEnabled(False)
     e.setBlurRadius(2 * _trackWidth)
     e.setColor(_hoverColor)
     e.setOffset(0, 0)
     self.setGraphicsEffect(e)
     self.setAcceptHoverEvents(True)
开发者ID:Pesa,项目名称:forse,代码行数:8,代码来源:Track.py

示例2: select

 def select(self):
     if not self.__selected:
         self.set_selected(True)
         effect = QGraphicsDropShadowEffect()
         effect.setBlurRadius(20)
         effect.setXOffset(0)
         effect.setYOffset(0)
         effect.setColor(QColor(0, 0, 0, 180))
         self.setGraphicsEffect(effect)
         self.raise_()
开发者ID:Mandarancio,项目名称:OpenIris,代码行数:10,代码来源:Basics.py

示例3: __init__

    def __init__(self, parent, *args):
        GraphicsPathObject.__init__(self, parent, *args)
        self.setAcceptHoverEvents(True)
        self.setPen(QPen(Qt.NoPen))
        self.normalBrush = QBrush(QColor("#CDD5D9"))
        self.connectedBrush = QBrush(QColor("#9CACB4"))
        self.setBrush(self.normalBrush)

        self.shadow = QGraphicsDropShadowEffect(
            blurRadius=10,
            color=QColor(SHADOW_COLOR),
            offset=QPointF(0, 0)
        )

        self.setGraphicsEffect(self.shadow)
        self.shadow.setEnabled(False)

        # Does this item have any anchored links.
        self.anchored = False

        if isinstance(parent, NodeItem):
            self.__parentNodeItem = parent
        else:
            self.__parentNodeItem = None

        self.__anchorPath = QPainterPath()
        self.__points = []
        self.__pointPositions = []

        self.__fullStroke = None
        self.__dottedStroke = None
        self.__shape = None
开发者ID:pauloortins,项目名称:Computer-Vision-Classes---UFBA,代码行数:32,代码来源:nodeitem.py

示例4: __init__

    def __init__(self, parent=None, line=None, **kwargs):
        Annotation.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemIsMovable)
        self.setFlag(QGraphicsItem.ItemIsSelectable)

        self.setFocusPolicy(Qt.ClickFocus)

        if line is None:
            line = QLineF(0, 0, 20, 0)

        self.__line = line
        self.__color = QColor(Qt.red)
        self.__arrowItem = ArrowItem(self)
        self.__arrowItem.setLine(line)
        self.__arrowItem.setBrush(self.__color)
        self.__arrowItem.setPen(QPen(Qt.NoPen))
        self.__arrowItem.setArrowStyle(ArrowItem.Concave)
        self.__arrowItem.setLineWidth(5)

        self.__shadow = QGraphicsDropShadowEffect(
            blurRadius=5, offset=QPointF(1.0, 2.0),
        )

        self.__arrowItem.setGraphicsEffect(self.__shadow)
        self.__shadow.setEnabled(True)

        self.__autoAdjustGeometry = True
开发者ID:CHANAYA,项目名称:orange3,代码行数:27,代码来源:annotationitem.py

示例5: __init__

 def __init__(self, filename=None, width=None, height=None, x=0, y=0, pixmap=None, group=None, pos=None, size=None, padding=None):
     self.effects = {}
     self.animations = {}
     self.filename = filename if isinstance(filename, str) else None
     if pixmap :
         self.pixmap = pixmap
     elif isinstance(filename, QPixmap) :
         self.pixmap = filename
     elif isinstance(filename, str) :
         self.pixmap = QPixmap(os.path.dirname(__file__) + '/../buttons/' + filename)
     else :
         self.pixmap = None
     if (width != None or height != None) and self.pixmap != None :
         self.pixmap = self.pixmap.scaled(width if width != None else height,
                                  height if height != None else width, Qt.KeepAspectRatio)
     self.group = group
     self.pos = pos
     self.size = size
     self.padding = padding
     self.x = x
     self.y = y
     
     if isinstance(self.pixmap, QPixmap) :
         self.item = QGraphicsPixmapItem(self.pixmap)
         self.item.setOffset(QPointF(self.getX(), self.getY()))
         self.effect = QGraphicsDropShadowEffect()
         self.effect.setOffset(0, 0)
         self.effect.setBlurRadius(0)
         self.effect.setColor(Qt.green)
         self.addEffect('shadow', self.effect, True)
         self.addAnimation('glow', Glow(15, 300, self, maxRadius=80, minRadius=5))
开发者ID:derekisbusy,项目名称:AnyController,代码行数:31,代码来源:widget_sixaxis.py

示例6: __init__

 def __init__(self, *args):
     QGraphicsView.__init__(self, *args)
     self.move(20, 240)
     self.outerD = 125
     self.innerD = 35
     self.innerRange = 48
     self.inputRange = 256
     self.thresh = 3
     self.padding = 40
     self.marginTop = 10
     self.worker = QSixAxisThread()
     self.worker.valueUpdated.connect(self.moveJoysticks)
     self.worker.start()
     self.setContentsMargins(0, 0, 0, 0)
     self.setMaximumHeight(180)
     self.setMaximumWidth(420)
     self.setMinimumHeight(240)
     self.setMinimumWidth(300)
     self.adjustSize()
     self.scene = QGraphicsScene(self)
     self.outerCircle1 = QGraphicsEllipseItem(0, self.marginTop, self.outerD, self.outerD)
     self.outerCircle1.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
     self.outerCircle1.setBrush(Qt.gray)
     self.innerCircle1 = QGraphicsEllipseItem(self.outerD / 2 - self.innerD / 2, self.outerD / 2 - self.innerD / 2 + self.marginTop, self.innerD, self.innerD)
     self.innerCircle1.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
     self.innerCircle1.setBrush(Qt.lightGray)
     self.scene.addItem(self.outerCircle1)
     self.scene.addItem(self.innerCircle1)
     self.outerCircle2 = QGraphicsEllipseItem(self.outerD + self.padding, self.marginTop, self.outerD, self.outerD)
     self.outerCircle2.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
     self.outerCircle2.setBrush(Qt.gray)
     self.innerCircle2 = QGraphicsEllipseItem(self.outerD + self.padding + self.outerD / 2 - self.innerD / 2, self.outerD / 2 - self.innerD / 2 + self.marginTop, self.innerD, self.innerD)
     self.innerCircle2.setPen(QPen(QColor(Qt.darkGray), 1, Qt.SolidLine))
     self.innerCircle2.setBrush(Qt.lightGray)
     self.scene.addItem(self.outerCircle2)
     self.scene.addItem(self.innerCircle2)
     self.setScene(self.scene)
     self.setStyleSheet('background-color:transparent; border-width: 0px; border: 0px;')
     self.currentX = 0
     self.currentY = 0
     self.currentA = 0
     self.currentZ = 0
     self.psBtn = QPixmap(os.getcwd() + '/../icons/bt_PS.png')
     self.psBtn = self.psBtn.scaled(50, 50, Qt.KeepAspectRatio)
     self.psItem = QGraphicsPixmapItem(self.psBtn)
     self.psItem.setOffset(QPointF(self.outerD - 4, 0))
     self.effect = QGraphicsDropShadowEffect()
     self.effect.setOffset(0, 0)
     self.effect.setBlurRadius(20)
     self.effect.setColor(Qt.green)
     self.psItem.setGraphicsEffect(self.effect)
     self.scene.addItem(self.psItem)
     self.tl2 = QTimeLine(10000)
     self.tl2.setFrameRange(0, 10000)
     self.c = QGraphicsItemAnimation()
     self.c.setItem(self.psItem)
     self.c.setTimeLine(self.tl2)
     self.tl2.connect(self.tl2, SIGNAL('frameChanged(int)'), self.updateEffect)
     self.effectd = 3
     self.tl2.start()
开发者ID:derekisbusy,项目名称:AnyController,代码行数:60,代码来源:custom_widgets.py

示例7: select

 def select(self, val: bool):
     if val:
         effect = QGraphicsDropShadowEffect()
         effect.setBlurRadius(20)
         effect.setXOffset(0)
         effect.setYOffset(0)
         effect.setColor(QColor(0, 0, 0, 180))
         self.setGraphicsEffect(effect)
         self.raise_()
     else:
         eff = self.graphicsEffect()
         del eff
         self.setGraphicsEffect(None)
开发者ID:Mandarancio,项目名称:OpenIris,代码行数:13,代码来源:OIBlocks.py

示例8: must_glow

 def must_glow(widget_list):
     ' apply an glow effect to the widget '
     for glow, each_widget in enumerate(widget_list):
         try:
             if each_widget.graphicsEffect() is None:
                 glow = QGraphicsDropShadowEffect(self)
                 glow.setOffset(0)
                 glow.setBlurRadius(99)
                 glow.setColor(QColor(99, 255, 255))
                 each_widget.setGraphicsEffect(glow)
                 glow.setEnabled(True)
         except:
             pass
开发者ID:Zekom,项目名称:webutil,代码行数:13,代码来源:main.py

示例9: draw

 def draw(self, painter):
     src_pixmap, offset = self.sourcePixmap()
     painter.save()
     painter.setOpacity(self.transparency)
     painter.drawPixmap(offset, src_pixmap)
     painter.restore()
     
     #now find the clipping region:
     src_r = QRegion(self.sourceBoundingRect().toRect())
     effect_r = QRegion(self.boundingRect().toRect())
     
     clip_region = effect_r.subtracted(src_r)
     
     painter.save()
     painter.setClipRegion(clip_region)
     QGraphicsDropShadowEffect.draw(self, painter)
     painter.restore()
开发者ID:mnunberg,项目名称:yobot,代码行数:17,代码来源:gui_util.py

示例10: must_glow

 def must_glow(widget_list):
     " apply an glow effect to the widget "
     for glow, each_widget in enumerate(widget_list):
         try:
             if each_widget.graphicsEffect() is None:
                 glow = QGraphicsDropShadowEffect(self)
                 glow.setOffset(0)
                 glow.setBlurRadius(99)
                 glow.setColor(QColor(99, 255, 255))
                 each_widget.setGraphicsEffect(glow)
                 # glow.setEnabled(False)
                 try:
                     each_widget.clicked.connect(
                         lambda: each_widget.graphicsEffect().setEnabled(True)
                         if each_widget.graphicsEffect().isEnabled() is False
                         else each_widget.graphicsEffect().setEnabled(False)
                     )
                 except:
                     each_widget.sliderPressed.connect(
                         lambda: each_widget.graphicsEffect().setEnabled(True)
                         if each_widget.graphicsEffect().isEnabled() is False
                         else each_widget.graphicsEffect().setEnabled(False)
                     )
         except:
             pass
开发者ID:juancarlospaco,项目名称:pyqt_app_template,代码行数:25,代码来源:pyqt_app_template.py

示例11: HighlightEdit

class HighlightEdit(QLineEdit):
    clicked = pyqtSignal(name="clicked")

    def __init__(self, parent):
        QLineEdit.__init__(self, parent)
        self._highlight_effect = QGraphicsDropShadowEffect(self)
        self._highlight_effect.setOffset(0.0)
        self._highlight_effect.setBlurRadius(5.0)
        self._highlight_effect.setColor(QColor(50, 50, 200))
        self.setGraphicsEffect(self._highlight_effect)
        self._highlight_effect.setEnabled(False)

        self.clear_button = QToolButton(self)
        self.clear_button.setIcon(QIcon.fromTheme("edit-clear", QIcon("icons/delete_icon.png")))
        self.clear_button.setCursor(Qt.ArrowCursor)
        self.clear_button.setStyleSheet("QToolButton { border: none; padding: 1.5px; }")
        icon_size = int(self.sizeHint().height() * 0.65)
        self.clear_button.setIconSize(QSize(icon_size, icon_size))
        self.clear_button.clicked.connect(self.clear)
        # self.clear_button.hide()

        # some padding stuff
        frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
        self.setStyleSheet(
            "QLineEdit {{ padding-right: {}px; }} ".format(self.clear_button.sizeHint().width() + frameWidth)
        )

    # create a signal on doubleclick events
    def mouseDoubleClickEvent(self, ev):
        ev.accept()
        self.clicked.emit()

    # fix up the clear button positioning
    def resizeEvent(self, ev):
        sz = self.clear_button.sizeHint()

        frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
        self.clear_button.move(
            self.rect().right() - frameWidth - sz.width(), (self.rect().bottom() + 1 - sz.height()) / 2
        )

    # a slot for turning the graphics effect on and off
    @pyqtSlot(bool)
    def highlight(self, val):
        self._highlight_effect.setEnabled(val)
开发者ID:gwillz,项目名称:EagleEye,代码行数:45,代码来源:highlight_edit.py

示例12: Meterbar

class Meterbar(Button):
    def __init__(self, max=255, filename=None, width=None, height=None, x=0, y=0, pixmap=None, group=None, pos=None, size=None, padding=None):
        Button.__init__(self, filename, width, height, x, y, pixmap, group, pos, size, padding)
        self.max = max
        self.outer = QGraphicsRectItem(x,y,width,max + 2)
        self.outer.setPen(QPen(QColor(Qt.black), 1, Qt.SolidLine))
        self.outer.setBrush(Qt.green)
#         self.outer.hide()
        self.inner = QGraphicsRectItem(x + 1,y + 1,width - 2,max)
        self.inner.setPen(QPen(QColor(Qt.green), 1, Qt.SolidLine))
        self.inner.setBrush(Qt.blue)
        self.items = [self.outer, self.inner]
        self.current = 255
        self.effect = QGraphicsDropShadowEffect()
        self.effect.setOffset(0, 0)
        self.effect.setBlurRadius(0)
        self.effect.setColor(Qt.green)
        self.item = self.outer
        self.addEffect('shadow', self.effect, True)
        self.addAnimation('glow', Glow(15, 300, self, maxRadius=80, minRadius=5))
#         self.test(10)
    
    def test(self, x):
        self.tl = QTimeLine(10000)
        self.tl.setFrameRange(0, 10000)
        self.a = QGraphicsItemAnimation()
        self.a.setItem(self.inner)
        self.a.setTimeLine(self.tl)
#         self.a.setPosAt(0, QPointF(self.getX(), self.current))
#         self.a.setTranslationAt(1, self.getX(), self.getY() + self.max - x + 1)
        self.a.setScaleAt(0, 1, 1)
        self.a.setScaleAt(1, 1, 0.1)
        self.current = x
        self.tl.start()
        
    def update(self, x):
        x2 = 1 - (float(x) * 1.0 / float(self.max))
#         print x
#         return
        self.tl = QTimeLine(10)
        self.tl.setFrameRange(0, 10)
        self.a = QGraphicsItemAnimation()
        self.a.setItem(self.inner)
        self.a.setTimeLine(self.tl)
#         self.a.setPosAt(0, QPointF(self.getX(), self.current))
#         self.a.setTranslationAt(1, self.getX(), self.getY() + self.max - x + 1)
        self.a.setScaleAt(0, 1, self.current)
        self.a.setScaleAt(1, 1, x2)
        self.current = x
        self.tl.start()
        if x > 3 :
            self.play('glow')
        
    def setScene(self, scene):
        self.scene = scene
        for item in self.items :
            self.scene.addItem(item)
开发者ID:derekisbusy,项目名称:AnyController,代码行数:57,代码来源:widget_sixaxis.py

示例13: __init__

 def __init__(self, parent=None):
     """ Init Custom Switch Widget, set Animation and Glow effects """
     QSlider.__init__(self, parent)
     self.setOrientation(Qt.Horizontal)
     self.animationType = QEasingCurve.OutExpo
     self.animation = QPropertyAnimation(self, "value")
     self.animation.setDuration(1000)
     self.animation.finished.connect(self.animationDone)
     self.clicked.connect(self.changeValue)
     self.setStyleSheet(self.style_knob + self.style_off)
     self.glow = QGraphicsDropShadowEffect(self)
     self.glow.setOffset(0)
     self.glow.setBlurRadius(99)
     self.glow.setColor(QColor(99, 255, 255))
     self.setGraphicsEffect(self.glow)
     self.glow.setEnabled(False)
开发者ID:juancarlospaco,项目名称:qslider,代码行数:16,代码来源:qslider.py

示例14: __init__

    def __init__(self, parent=None, workdir=None, fontsize=42):
        super(BillboardDisplay, self).__init__(parent)
        self.workdir = workdir
        self.logger = logging.getLogger('display')
        self.logger.info('Working directory: {}'.format(self.workdir))
        self.current_display = os.path.join(self.workdir, 'current.jpg')
        desktop = QDesktopWidget()
        self.display = QWidget(self)
        size  = desktop.availableGeometry(desktop.primaryScreen());
        self.display.resize(size.width(), size.height())
        self.display.setWindowTitle("Billboard")

        self.image_label = QLabel(self.display)
        self.image_label.resize(size.width(), size.height())

        self.text_label = QLabel(self.display)
        self.text_label.resize(size.width(), size.height())
        self.text_label.setMargin(100)
        self.text_label.setStyleSheet('''
            QLabel {{
                        font-size: {}pt;
                        font-weight: bold;
                        color: #eeeeee;
                        text-align: center;
                    }}
        '''.format(fontsize))
        self.text_label.setWordWrap(True)
        self.text_label.setAlignment(Qt.AlignCenter)

        dse = QGraphicsDropShadowEffect()
        dse.setBlurRadius(0)
        dse.setXOffset(5)
        dse.setYOffset(5)
        dse.setColor(QColor(0, 0, 0, 255))
        self.text_label.setGraphicsEffect(dse)
        QObject.connect(self, SIGNAL("updateimage"),
                        self.display_image)
        QObject.connect(self, SIGNAL("updatecurrent"),
                        self.take_screenshot)
开发者ID:setrofim,项目名称:billboard,代码行数:39,代码来源:display.py

示例15: __init__

    def __init__(self, parent=None, channel=None, rect=None, **kwargs):
        QGraphicsRectItem.__init__(self, **kwargs)
        self.setAcceptHoverEvents(True)
        self.setAcceptedMouseButtons(Qt.NoButton)
        self.__channel = None

        if rect is None:
            rect = QRectF(0, 0, 20, 20)

        self.setRect(rect)

        if channel:
            self.setChannel(channel)

        self.__shadow = QGraphicsDropShadowEffect(blurRadius=5, offset=QPointF(0, 0))
        self.setGraphicsEffect(self.__shadow)
        self.__shadow.setEnabled(False)
开发者ID:Zekom,项目名称:orange3,代码行数:17,代码来源:editlinksdialog.py


注:本文中的PyQt4.QtGui.QGraphicsDropShadowEffect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。