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


Python Qt.darkGray方法代码示例

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


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

示例1: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [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

示例2: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [as 别名]
def __init__(self, model_item: Participant, parent=None):
        super().__init__(parent)

        self.model_item = model_item

        self.text = QGraphicsTextItem(self)

        self.line = QGraphicsLineItem(self)
        self.line.setPen(QPen(Qt.darkGray, 1, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin))

        self.refresh() 
开发者ID:jopohl,项目名称:urh,代码行数:13,代码来源:ParticipantItem.py

示例3: refresh

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [as 别名]
def refresh(self):
        self.text.setPlainText("?" if not self.model_item else self.model_item.shortname)
        if hasattr(self.model_item, "simulate") and self.model_item.simulate:
            font = QFont()
            font.setBold(True)
            self.text.setFont(font)
            self.text.setDefaultTextColor(Qt.darkGreen)
            self.line.setPen(QPen(Qt.darkGreen, 2, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin))
        else:
            self.text.setFont(QFont())
            self.text.setDefaultTextColor(settings.LINECOLOR)
            self.line.setPen(QPen(Qt.darkGray, 1, Qt.DashLine, Qt.RoundCap, Qt.RoundJoin)) 
开发者ID:jopohl,项目名称:urh,代码行数:14,代码来源:ParticipantItem.py

示例4: set_paragraph

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [as 别名]
def set_paragraph(self, h2='', h3='', text='', img=None):
        if h2 != '':
            lbl_h2 = QLabel(h2, self.inner)
            fnt = lbl_h2.font()
            fnt.setPointSize(self.H2_FONT_SIZE)
            lbl_h2.setFont(fnt)
            lbl_h2.setFixedHeight(self.H2_HEIGHT)
            lbl_h2.setAlignment(Qt.AlignBottom)
            lbl_h2.setMargin(self.SIDE_MARGIN)
            self.vbox.addWidget(lbl_h2)

            frm = QFrame(self.inner)
            frm.setFrameShape(QFrame.HLine)
            frm.setContentsMargins(self.SIDE_MARGIN, 0, self.SIDE_MARGIN, 0)
            plt = frm.palette()
            plt.setColor(QPalette.WindowText, Qt.darkGray)
            frm.setPalette(plt)
            self.vbox.addWidget(frm)

        if text != '':
            lbl_txt = QLabel(text, self.inner)
            lbl_txt.setWordWrap(True)
            fnt = lbl_txt.font()
            fnt.setPointSize(self.TEXT_FONT_SIZE)
            lbl_txt.setFont(fnt)
            lbl_txt.setMargin(self.SIDE_MARGIN)
            self.vbox.addWidget(lbl_txt)

        if img is not None:
            if self.params.lang == 'en':
                img += '_en.png'
            else:
                img += '_jp.png'
            pixmap = QPixmap(img)
            if not pixmap.isNull():
                lbl_img = QLabel(self.inner)
                lbl_img.setPixmap(pixmap)
                self.lbl_img_list.append(lbl_img)
                self.pixmap_list.append(pixmap.scaledToWidth(pixmap.width()))
                self.vbox.addWidget(lbl_img)

        self.inner.setLayout(self.vbox) 
开发者ID:canard0328,项目名称:malss,代码行数:44,代码来源:content.py

示例5: createCharts

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [as 别名]
def createCharts(self):
        self.chart24 = QChart()
        self.chart24.setAcceptHoverEvents(True)
        titleFont = QFont()
        titleFont.setPixelSize(18)
        titleBrush = QBrush(QColor(0, 0, 255))
        self.chart24.setTitleFont(titleFont)
        self.chart24.setTitleBrush(titleBrush)
        self.chart24.setTitle('2.4 GHz')
        self.chart24.legend().hide()
        
        # Axis examples: https://doc.qt.io/qt-5/qtcharts-multiaxis-example.html
        self.chart24axisx = QValueAxis()
        self.chart24axisx.setMin(0)
        self.chart24axisx.setMax(16)
        self.chart24axisx.setTickCount(17) # Axis count +1 (at 0 crossing)
        self.chart24axisx.setLabelFormat("%d")
        self.chart24axisx.setTitleText("Channel")
        self.chart24.addAxis(self.chart24axisx, Qt.AlignBottom)
        
        self.chart24yAxis = QValueAxis()
        self.chart24yAxis.setMin(-100)
        self.chart24yAxis.setMax(-10)
        self.chart24yAxis.setTickCount(9)
        self.chart24yAxis.setLabelFormat("%d")
        self.chart24yAxis.setTitleText("dBm")
        self.chart24.addAxis(self.chart24yAxis, Qt.AlignLeft)
        
        chartBorder = Qt.darkGray
        self.Plot24 = QChartView(self.chart24, self)
        self.Plot24.setBackgroundBrush(chartBorder)
        self.Plot24.setRenderHint(QPainter.Antialiasing)

        self.chart5 = QChart()
        self.chart5.setAcceptHoverEvents(True)
        self.chart5.setTitleFont(titleFont)
        self.chart5.setTitleBrush(titleBrush)
        self.chart5.setTitle('5 GHz')
        self.chart5.createDefaultAxes()
        self.chart5.legend().hide()
        
        self.chart5axisx = QValueAxis()
        self.chart5axisx .setMin(30)
        self.chart5axisx .setMax(170)
        self.chart5axisx .setTickCount(15)
        self.chart5axisx .setLabelFormat("%d")
        self.chart5axisx .setTitleText("Channel")
        self.chart5.addAxis(self.chart5axisx , Qt.AlignBottom)
        
        newAxis = QValueAxis()
        newAxis.setMin(-100)
        newAxis.setMax(-10)
        newAxis.setTickCount(9)
        newAxis.setLabelFormat("%d")
        newAxis.setTitleText("dBm")
        self.chart5.addAxis(newAxis, Qt.AlignLeft)
        
        self.Plot5 = QChartView(self.chart5, self)
        self.Plot5.setBackgroundBrush(chartBorder)
        self.Plot5.setRenderHint(QPainter.Antialiasing)
        self.Plot5.setViewportUpdateMode(QGraphicsView.SmartViewportUpdate) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:63,代码来源:sparrow-wifi.py

示例6: createChart

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [as 别名]
def createChart(self):
        self.timeChart = QChart()
        titleFont = QFont()
        titleFont.setPixelSize(18)
        titleBrush = QBrush(QColor(0, 0, 255))
        self.timeChart.setTitleFont(titleFont)
        self.timeChart.setTitleBrush(titleBrush)
        self.timeChart.setTitle('Signal (Past ' + str(self.maxPoints) + ' Samples)')
        # self.timeChart.addSeries(testseries)
        # self.timeChart.createDefaultAxes()
        self.timeChart.legend().hide()
        
        # Axis examples: https://doc.qt.io/qt-5/qtcharts-multiaxis-example.html
        newAxis = QValueAxis()
        newAxis.setMin(0)
        newAxis.setMax(self.maxPoints)
        newAxis.setTickCount(11)
        newAxis.setLabelFormat("%d")
        newAxis.setTitleText("Sample")
        self.timeChart.addAxis(newAxis, Qt.AlignBottom)
        
        newAxis = QValueAxis()
        newAxis.setMin(-100)
        newAxis.setMax(-10)
        newAxis.setTickCount(9)
        newAxis.setLabelFormat("%d")
        newAxis.setTitleText("dBm")
        self.timeChart.addAxis(newAxis, Qt.AlignLeft)
        
        chartBorder = Qt.darkGray
        self.timePlot = QChartView(self.timeChart, self)
        self.timePlot.setBackgroundBrush(chartBorder)
        self.timePlot.setRenderHint(QPainter.Antialiasing)
        
        self.timeSeries = QLineSeries()
        pen = QPen(Qt.yellow)
            
        pen.setWidth(2)
        self.timeSeries.setPen(pen)
        self.timeChart.addSeries(self.timeSeries)
        self.timeSeries.attachAxis(self.timeChart.axisX())
        self.timeSeries.attachAxis(self.timeChart.axisY()) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:44,代码来源:telemetry.py

示例7: gradientPixmap

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [as 别名]
def gradientPixmap(self, types, color):
        """生成渐变图片
        """
        pixSize = 5
        if types == self.TypeAlpha:
            # 生成黑边相间的模拟透明背景
            if not self._imageAlphaTmp:
                self._imageAlphaTmp = QImage(
                    self.width(), self.height(), QImage.Format_ARGB32)
                painter = QPainter()
                painter.begin(self._imageAlphaTmp)
                painter.setRenderHint(QPainter.Antialiasing, True)
                painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
                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, _y, pixSize, pixSize,
                                         Qt.white if x % 2 != y % 2 else Qt.darkGray)
                painter.end()
            # 绘制透明渐变
            gradient = QLinearGradient(0, 0, self.width(), 0)
            gradient.setColorAt(0, QColor(0, 0, 0, 0))
            gradient.setColorAt(1, color)
            # 只画渐变颜色
            self._imageAlphaColor = QImage(
                self.width(), self.height(), QImage.Format_ARGB32)
            self._imageAlphaColor.fill(Qt.transparent)
            painter = QPainter()
            painter.begin(self._imageAlphaColor)
            painter.setRenderHint(QPainter.Antialiasing, True)
            painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
            painter.fillRect(0, 0, self.width(), self.height(), gradient)
            painter.end()
            # 合并方格图
            self._imageAlpha = self._imageAlphaColor.copy()
            painter = QPainter()
            painter.begin(self._imageAlpha)
            painter.setRenderHint(QPainter.Antialiasing, True)
            painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
            painter.drawImage(0, 0, self._imageAlphaTmp)
            painter.fillRect(0, 0, self.width(), self.height(), gradient)
            painter.end()
        else:
            gradient = QLinearGradient(0, 0, self.width(), 0)
            gradient.setColorAt(0, QColor('#ff0000'))
            gradient.setColorAt(0.17, QColor('#ffff00'))
            gradient.setColorAt(0.33, QColor('#00ff00'))
            gradient.setColorAt(0.5, QColor('#00ffff'))
            gradient.setColorAt(0.67, QColor('#0000ff'))
            gradient.setColorAt(0.83, QColor('#ff00ff'))
            gradient.setColorAt(1, QColor('#ff0000'))
            self._imageRainbow = QImage(
                self.width(), self.height(), QImage.Format_ARGB32)
            painter = QPainter()
            painter.begin(self._imageRainbow)
            painter.setRenderHint(QPainter.Antialiasing, True)
            painter.setRenderHint(QPainter.SmoothPixmapTransform, True)
            painter.fillRect(0, 0, self.width(), self.height(), gradient)
            painter.end() 
开发者ID:PyQt5,项目名称:CustomWidgets,代码行数:61,代码来源:CColorSlider.py

示例8: _set_native_context

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import darkGray [as 别名]
def _set_native_context(self, ptr, context):
        if self.indexOf(self._nativectx_list) == -1:
            self.addTab(self._nativectx_list, 'Native')
            self.show_context_tab('Native')
        else:
            self.show_context_tab('Native')

        context_ptr = ptr
        sorted_regs = self.get_sort_order()

        for register in sorted(context, key=lambda x: sorted_regs[x] if x in sorted_regs else len(sorted_regs)):
            reg_name = QStandardItem()
            reg_name.setTextAlignment(Qt.AlignCenter)
            if context[register]['isValidPointer']:
                reg_name.setData(context_ptr, Qt.UserRole + 1)

            value_x = QStandardItem()
            if context[register]['isValidPointer']:
                value_x.setForeground(Qt.red)

            value_dec = QStandardItem()
            telescope = QStandardItem()

            reg_name.setText(register)

            if context[register] is not None:
                str_fmt = '0x{0:x}'
                if self._nativectx_list.uppercase_hex:
                    str_fmt = '0x{0:X}'

                value_x.setText(
                    str_fmt.format(int(context[register]['value'], 16)))

                value_dec.setText('{0:d}'.format(
                    int(context[register]['value'], 16)))

                if context[register]['isValidPointer']:
                    if 'telescope' in context[register] and context[register][
                            'telescope'] is not None:
                        telescope = QStandardItem()

                        telescope_value = str(context[register]['telescope'][1]).replace('\n', ' ')
                        if len(telescope_value) > 50:
                            telescope_value = telescope_value[:50] + '...'

                        telescope.setText(telescope_value)
                        if context[register]['telescope'][0] == 2:
                            telescope.setData(
                                context[register]['telescope'][1],
                                Qt.UserRole + 1)

                        if context[register]['telescope'][0] == 0:
                            telescope.setForeground(Qt.darkGreen)
                        elif context[register]['telescope'][0] == 2:
                            telescope.setForeground(Qt.white)
                        elif context[register]['telescope'][0] != 1:
                            telescope.setForeground(Qt.darkGray)

            self._nativectx_model.appendRow(
                [reg_name, value_x, value_dec, telescope])
            self._nativectx_list.resizeColumnToContents(0) 
开发者ID:iGio90,项目名称:Dwarf,代码行数:63,代码来源:context.py


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