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


Python QGraphicsDropShadowEffect.setXOffset方法代码示例

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


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

示例1: select

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setXOffset [as 别名]
 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,代码行数:12,代码来源:Basics.py

示例2: select

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setXOffset [as 别名]
 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,代码行数:15,代码来源:OIBlocks.py

示例3: __init__

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setXOffset [as 别名]
    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,代码行数:41,代码来源:display.py

示例4: CImprovedPanel

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setXOffset [as 别名]
class CImprovedPanel(QFrame):
    def __init__(self, parent=None):
        QFrame.__init__(self, parent)

        #FADING
        self.__opacity_effect = QGraphicsOpacityEffect()
        self.__fading_timer = QTimer(parent)
        self.__fading_timer.timeout.connect(self.__on_fading_timer)
        self.__FADE_TYPE = Enum("IN", "OUT")
        self.__fade_time = 20
        self.__opacity = 1.0
        self.__opacity_fading_coefficient = 0.02
        self.__selected_fade_type = self.__FADE_TYPE.IN
        self.resizeEvent = self.__onResize

        #MOVE
        self.__move_animation_type = QEasingCurve.Linear
        self.__move_time = 350
        self.__is_moving = False

        #RESIZE
        self.__resize_animation_type = QEasingCurve.Linear
        self.__resize_time = 700
        self.__is_resizing = False

        #PIXMAP & MASCHERA
        self.__pmap = QPixmap(self.size())
        self.__pmap_fname = ""
        self.__show_mask_preview = False

        #SHADOW
        self.__shadow_Xoffset = 3.0 #default value
        self.__shadow_Yoffset = 3.0 #default value
        self.__shadow_blur_radius = 8.0 #default value
        self.__shadow_color = QColor(38,38,38,150) #default value

        self.__shadow_effect = QGraphicsDropShadowEffect()
        self.__shadow_effect.setXOffset(self.__shadow_Xoffset)
        self.__shadow_effect.setYOffset(self.__shadow_Yoffset)
        self.__shadow_effect.setBlurRadius(self.__shadow_blur_radius)
        self.__shadow_effect.setColor(self.__shadow_color)
        self._shadow_visible = False


    ##FUNZIONI PER FADING
    def fadeIn(self):
        """
         Labels fades in from completely invisible to completely visible.
        """
        self.__opacity = 0.0
        self.__selected_fade_type = self.__FADE_TYPE.IN
        self.__fading_timer.start(self.__fade_time)

    def fadeOut(self):
        """
         Labels fades out from completely visible to completely invisible.
        """
        self.__selected_fade_type = self.__FADE_TYPE.OUT
        self.__fading_timer.start(self.__fade_time)

    def setFadeTime(self, value):
        """ Sets fading time. Everytime interval is reached, alpha is increased (or decreased) by __opacity_fading_coefficient.
        @param value: fade time (msec)
        @type value: int
        """
        self.__fade_time = value

    def getFadeTime(self):
        return self.__fade_time

    fadeInterval = QtCore.pyqtProperty("int", getFadeTime, setFadeTime)

    def setFadeCoefficient(self, value):
        """ Sets fading coefficient. Alpha is increased (or decreased) by this value.
        @param value: coefficient (min 0.0 - max 1.0)
        @type value: float
        """
        self.__opacity_fading_coefficient = value

    def getFadeCoefficient(self):
        return self.__opacity_fading_coefficient

    fadeCoefficient = QtCore.pyqtProperty("double", getFadeCoefficient, setFadeCoefficient)

    def __on_fading_timer(self):
        if self.__selected_fade_type == self.__FADE_TYPE.OUT:
            if self.__opacity > 0:
                self.__opacity -= self.__opacity_fading_coefficient
                self.__opacity_effect.setOpacity(self.__opacity)
                self.setGraphicsEffect(self.__opacity_effect)
            else:
                self.__fading_timer.stop()

        if self.__selected_fade_type == self.__FADE_TYPE.IN:
            if self.__opacity <= 1.0:
                self.__opacity += self.__opacity_fading_coefficient
                self.__opacity_effect.setOpacity(self.__opacity)
                self.setGraphicsEffect(self.__opacity_effect)
            else:
                self.__fading_timer.stop()
#.........这里部分代码省略.........
开发者ID:Nerkyator,项目名称:pyQt_components,代码行数:103,代码来源:ImprovedPanel.py

示例5: setCurrentAction

# 需要导入模块: from PyQt4.QtGui import QGraphicsDropShadowEffect [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsDropShadowEffect import setXOffset [as 别名]
 def setCurrentAction(self, action):
     """
     Sets the current action for this widget that highlights the size
     for this toolbar.
     
     :param      action | <QAction>
     """
     if action == self._currentAction:
         return
     
     self._currentAction = action
     self.currentActionChanged.emit(action)
     
     labels   = self.actionLabels()
     anim_grp = QParallelAnimationGroup(self)
     max_size = self.maximumPixmapSize()
     min_size = self.minimumPixmapSize()
     
     if action:
         label = self.labelForAction(action)
         index = labels.index(label)
         
         # create the highlight effect
         palette = self.palette()
         effect = QGraphicsDropShadowEffect(label)
         effect.setXOffset(0)
         effect.setYOffset(0)
         effect.setBlurRadius(20)
         effect.setColor(QColor(40, 40, 40))
         label.setGraphicsEffect(effect)
         
         offset = self.padding()
         if self.position() in (XDockToolbar.Position.East,
                                XDockToolbar.Position.West):
             self.resize(max_size.width() + offset, self.height())
         
         elif self.position() in (XDockToolbar.Position.North,
                                  XDockToolbar.Position.South):
             self.resize(self.width(), max_size.height() + offset)
         
         w  = max_size.width()
         h  = max_size.height()
         dw = (max_size.width() - min_size.width()) / 3
         dh = (max_size.height() - min_size.height()) / 3
         
         for i in range(4):
             before = index - i
             after  = index + i
             
             if 0 <= before and before < len(labels):
                 anim = XObjectAnimation(labels[before],
                                         'setPixmapSize',
                                         anim_grp)
                 
                 anim.setEasingCurve(self.easingCurve())
                 anim.setStartValue(labels[before].pixmapSize())
                 anim.setEndValue(QSize(w, h))
                 anim.setDuration(self.duration())
                 anim_grp.addAnimation(anim)
                 
                 if i:
                     labels[before].setGraphicsEffect(None)
             
             if after != before and 0 <= after and after < len(labels):
                 anim = XObjectAnimation(labels[after],
                                         'setPixmapSize',
                                         anim_grp)
                 
                 anim.setEasingCurve(self.easingCurve())
                 anim.setStartValue(labels[after].pixmapSize())
                 anim.setEndValue(QSize(w, h))
                 anim.setDuration(self.duration())
                 anim_grp.addAnimation(anim)
                 
                 if i:
                     labels[after].setGraphicsEffect(None)
         
             w -= dw
             h -= dh
     else:
         offset = self.padding()
         for label in self.actionLabels():
             # clear the graphics effect 
             label.setGraphicsEffect(None)
             
             # create the animation
             anim = XObjectAnimation(label, 'setPixmapSize', self)
             anim.setEasingCurve(self.easingCurve())
             anim.setStartValue(label.pixmapSize())
             anim.setEndValue(min_size)
             anim.setDuration(self.duration())
             anim_grp.addAnimation(anim)
         
         anim_grp.finished.connect(self.resizeToMinimum)
     
     anim_grp.start()
     self._animating = True
     anim_grp.finished.connect(anim_grp.deleteLater)
     anim_grp.finished.connect(self.__markAnimatingFinished)
     
#.........这里部分代码省略.........
开发者ID:satishgoda,项目名称:DPS_PIPELINE,代码行数:103,代码来源:xdocktoolbar.py


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