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


Python Qt.NoPen方法代码示例

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


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

示例1: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, event):
        QtWidgets.QFrame.paintEvent(self, event)
        painter = QtGui.QPainter()
        painter.begin(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        painter.setPen(Qt.NoPen)
        # Draw the Pie
        rwidth = int(min([self.width(), self.height()]) - 2)
        x = int((self.width() / 2) - (rwidth / 2))
        y = int((self.height() / 2) - (rwidth / 2))
        rect = QtCore.QRect(x, y, rwidth, rwidth)
        angle1 = 0
        for i in range(len(self.data)):
            angle2 = angle1 + (3.6 * self.data[i])
            painter.setBrush(QtGui.QBrush(self.colors[i % len(self.colors)]))
            painter.drawPie(rect, angle1*-16, (angle2-angle1)*-16)
            angle1 = angle2
        # Draw the remainer (background)
        angle2 = 360
        painter.setBrush(QtGui.QBrush(self.bgcolor))
        painter.drawPie(rect, angle1*-16, (angle2-angle1)*-16)
        painter.end() 
开发者ID:pkkid,项目名称:pkmeter,代码行数:24,代码来源:pkcharts.py

示例2: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, event):
        painter = QPainter()
        painter.begin(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.fillRect(event.rect(), QBrush(QColor(255, 255, 255, 200)))
        painter.setPen(QPen(Qt.NoPen))

        if self.lists is not None:
            path = os.path.abspath(os.path.dirname(__file__)) + '/static/'
            path += self.lists[self.list_index] + '.png'
            self.list_index += 1
            if self.list_index >= len(self.lists):
                self.list_index = 0
            image = QImage(path)
            rect_image = image.rect()
            rect_painter = event.rect()
            dx = (rect_painter.width() - rect_image.width()) / 2.0
            dy = (rect_painter.height() - rect_image.height()) / 2.0
            painter.drawImage(dx, dy, image)

        painter.end() 
开发者ID:canard0328,项目名称:malss,代码行数:23,代码来源:waiting_animation.py

示例3: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paint(self, painter, option, index):
        if option.state & QStyle.State_HasFocus:
            # 取消虚线框
            option.state = option.state ^ QStyle.State_HasFocus

        # 取出颜色
        item = index.model().itemFromIndex(index)
        color = item.data()

        # 绘制矩形区域
        rect = option.rect
        # 是否鼠标悬停
        _in = option.state & QStyle.State_MouseOver

        painter.save()
        painter.setPen(color.darker(150) if _in else Qt.NoPen)
        painter.setBrush(color)
        rect = rect if _in else rect.adjusted(1, 1, -1, -1)
        painter.drawRoundedRect(rect, 2, 2)
        painter.restore() 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:22,代码来源:CColorItems.py

示例4: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, event):
        ancho, altura = self.width(), self.height()
        icono = self.icono.scaled(ancho, altura, Qt.KeepAspectRatio, Qt.SmoothTransformation)

        pintor = QPainter()
        
        pintor.begin(self)
        pintor.setRenderHint(QPainter.Antialiasing, True)
        pintor.setPen(Qt.NoPen)
        pintor.drawPixmap(0, 0, icono, 0, 0, 0, 0)
        pintor.setPen(Qt.white)
        pintor.drawText(event.rect(), Qt.AlignCenter, self.etiqueta)
        pintor.setPen(Qt.NoPen)
        pintor.setBrush(self.opacidad)
        pintor.drawEllipse(0, 0, ancho, altura)
        pintor.end()

        self.setMask(icono.mask()) 
开发者ID:andresnino,项目名称:PyQt5,代码行数:20,代码来源:botonCircular.py

示例5: mark_poi

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def mark_poi(self, times=None):
        """Mark selected signal, from list of start and end times.
        
        Parameters
        ----------
        times : list of tuple of float
            start and end times, in sec form rec start
        """
        y_pos = BARS['quality']['pos0']
        height = 5
        
        for rect in self.idx_poi:
            self.scene.removeItem(rect)
        self.idx_poi = []
        
        if not times:
            return
        
        for beg, end in times:
            rect = QGraphicsRectItem(beg, y_pos, end - beg, height)
            rect.setPen(NoPen)
            rect.setBrush(Qt.darkRed)
            self.scene.addItem(rect)
            self.idx_poi.append(rect) 
开发者ID:wonambi-python,项目名称:wonambi,代码行数:26,代码来源:overview.py

示例6: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, event):
        super(CircleProgressBar, self).paintEvent(event)
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.translate(self.width() / 2, self.height() / 2)
        side = min(self.width(), self.height())
        painter.scale(side / 100.0, side / 100.0)
        painter.rotate(self.angle)
        painter.save()
        painter.setPen(Qt.NoPen)
        color = self.Color.toRgb()
        for i in range(11):
            color.setAlphaF(1.0 * i / 10)
            painter.setBrush(color)
            painter.drawEllipse(30, -10, 20, 20)
            painter.rotate(36)
        painter.restore()
        self.angle += self.Delta if self.Clockwise else -self.Delta
        self.angle %= 360 
开发者ID:PyQt5,项目名称:PyQt,代码行数:21,代码来源:RoundProgressBar.py

示例7: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, event):
        QtWidgets.QFrame.paintEvent(self, event)
        painter = QtGui.QPainter()
        painter.begin(self)
        painter.setRenderHint(QtGui.QPainter.Antialiasing)
        painter.setPen(Qt.NoPen)
        if self.enabled: self.paint_slider_on(painter)
        else: self.paint_slider_off(painter)
        painter.end() 
开发者ID:pkkid,项目名称:pkmeter,代码行数:11,代码来源:pkwidgets.py

示例8: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paint(self, p, w, h):
        p.setPen(Qt.NoPen)
        p.setBrush(QBrush(QColor(*self.color)))  # Use chosen color
        self.clip(p, w, h)
        p.drawRect(QRect(-1, -1, w + 2, h + 2))  # draw full field rectangle 
开发者ID:portugueslab,项目名称:stytra,代码行数:7,代码来源:visual.py

示例9: draw_block

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def draw_block(self, p, point, w, h):
        """ Function for drawing the gratings programmatically.
        """
        p.setPen(Qt.NoPen)
        p.setRenderHint(QPainter.Antialiasing)
        p.setBrush(QBrush(QColor(*self.color)))
        p.drawRect(
            point.x(),
            point.y(),
            int(
                self.grating_period
                / (2 * max(self._experiment.calibrator.mm_px, 0.0001))
            ),
            self.barheight,
        ) 
开发者ID:portugueslab,项目名称:stytra,代码行数:17,代码来源:visual.py

示例10: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paint(self, p, w, h):
        # draw background
        p.resetTransform()
        p.setPen(Qt.NoPen)
        p.setBrush(QBrush(QColor(*self.color_bg)))

        self.clip(p, w, h)
        p.drawRect(QRect(-1, -1, w + 2, h + 2))
        p.setTransform(self.get_rot_transform(w, h))

        self.paint_dots(p, w, h) 
开发者ID:portugueslab,项目名称:stytra,代码行数:13,代码来源:kinematograms.py

示例11: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, e):
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setPen(Qt.NoPen)
        painter.setBrush(self.palette().color(QPalette.Window))
        painter.drawRoundedRect(self.rect(), self._border_radius, self._border_radius)
        painter.save()
        painter.setPen(QColor('white'))
        option = QTextOption()
        option.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
        rect = QRect(self.mapToParent(self._size_grip.pos()), self._size_grip.size())
        painter.drawText(QRectF(rect), '●', option)
        painter.restore() 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:15,代码来源:lyric.py

示例12: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, e):
        """
        draw pixmap with border radius

        We found two way to draw pixmap with border radius,
        one is as follow, the other way is using bitmap mask,
        but in our practice, the mask way has poor render effects
        """
        if self._pixmap is None:
            return
        radius = 3
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setRenderHint(QPainter.SmoothPixmapTransform)
        scaled_pixmap = self._pixmap.scaledToWidth(
            self.width(),
            mode=Qt.SmoothTransformation
        )
        size = scaled_pixmap.size()
        brush = QBrush(scaled_pixmap)
        painter.setBrush(brush)
        painter.setPen(Qt.NoPen)
        y = (size.height() - self.height()) // 2
        painter.save()
        painter.translate(0, -y)
        rect = QRect(0, y, self.width(), self.height())
        painter.drawRoundedRect(rect, radius, radius)
        painter.restore()
        painter.end() 
开发者ID:feeluown,项目名称:FeelUOwn,代码行数:31,代码来源:meta.py

示例13: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, event):
        if not (self._imageRainbow or self._imageAlpha):
            return super(CColorSlider, self).paintEvent(event)

        option = QStyleOptionSlider()
        self.initStyleOption(option)
        # 背景Rect
        groove = self.style().subControlRect(
            QStyle.CC_Slider, option, QStyle.SC_SliderGroove, self)
        groove.adjust(3, 5, -3, -5)
        # 滑块Rect
        handle = self.style().subControlRect(
            QStyle.CC_Slider, option, QStyle.SC_SliderHandle, self)
        handle.setX(max(min(handle.x(), self.width() - self.height()), 0))
        handle.setWidth(self.height())
        handle.setHeight(self.height())
        radius = self.height() / 2
        painter = QPainter(self)
        painter.setPen(Qt.NoPen)
        painter.drawImage(
            groove, self._imageRainbow if self._imageRainbow else self._imageAlpha)

        if not self._imageCircle or not self._imageCircleHover:
            painter.setBrush(QColor(245, 245, 245) if option.state &
                             QStyle.State_MouseOver else QColor(254, 254, 254))
            painter.drawRoundedRect(handle, radius, radius)
        else:
            painter.drawImage(handle, self._imageCircleHover if option.state &
                              QStyle.State_MouseOver else self._imageCircle) 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:31,代码来源:CColorSlider.py

示例14: gradientCirclePixmap

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def gradientCirclePixmap(self):
        """白色带阴影
        """
        xy = self.height() / 2
        radius = self.height() * 0.8

        # 绘制普通状态下圆形的滑块
        circleColor = QRadialGradient(xy, xy, radius, xy, xy)
        circleColor.setColorAt(0.5, QColor(254, 254, 254))
        circleColor.setColorAt(0.7, QColor(0, 0, 0, 60))
        circleColor.setColorAt(0.7, QColor(0, 0, 0, 30))
        circleColor.setColorAt(0.9, QColor(0, 0, 0, 0))
        self._imageCircle = QImage(
            self.height(), self.height(), QImage.Format_ARGB32)
        self._imageCircle.fill(Qt.transparent)
        painter = QPainter()
        painter.begin(self._imageCircle)
        painter.setRenderHint(QPainter.Antialiasing, True)
        painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
        painter.setPen(Qt.NoPen)
        painter.setBrush(circleColor)
        painter.drawRoundedRect(0, 0, self.height(), self.height(), xy, xy)
        painter.end()

        # 绘制悬停状态下圆形的滑块
        circleColorHover = QRadialGradient(xy, xy, radius, xy, xy)
        circleColorHover.setColorAt(0.5, QColor(245, 245, 245))
        circleColorHover.setColorAt(0.7, QColor(0, 0, 0, 30))
        circleColorHover.setColorAt(0.9, QColor(0, 0, 0, 0))
        self._imageCircleHover = QImage(
            self.height(), self.height(), QImage.Format_ARGB32)
        self._imageCircleHover.fill(Qt.transparent)
        painter = QPainter()
        painter.begin(self._imageCircleHover)
        painter.setRenderHint(QPainter.Antialiasing, True)
        painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
        painter.setPen(Qt.NoPen)
        painter.setBrush(circleColorHover)
        painter.drawRoundedRect(0, 0, self.height(), self.height(), xy, xy)
        painter.end() 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:42,代码来源:CColorSlider.py

示例15: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoPen [as 别名]
def paintEvent(self, event):
        super(CColorControl, self).paintEvent(event)
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing, True)
        painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
        painter.setPen(Qt.NoPen)

        # 变换圆心
        painter.translate(self.rect().center())

        # 画背景方格图
        painter.save()
        # 保证方格在前景圆内部
        diameter = min(self.width(), self.height()) - 8
        radius = diameter / 2
        path = QPainterPath()
        path.addRoundedRect(-radius, -radius, diameter,
                            diameter, radius, radius)
        painter.setClipPath(path)

        pixSize = 5
        for x in range(int(self.width() / pixSize)):
            for y in range(int(self.height() / pixSize)):
                _x, _y = x * pixSize, y * pixSize
                painter.fillRect(_x - radius, _y - radius, pixSize, pixSize,
                                 Qt.white if x % 2 != y % 2 else Qt.darkGray)
        painter.restore()

        # 画前景颜色
        diameter = min(self.width(), self.height()) - 4
        radius = diameter / 2
        path = QPainterPath()
        path.addRoundedRect(-radius, -radius, diameter,
                            diameter, radius, radius)
        painter.setClipPath(path)

        painter.setBrush(self._color)
        painter.drawRoundedRect(-radius, -radius,
                                diameter, diameter, radius, radius) 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:41,代码来源:CColorControl.py


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