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


Python Qt.DotLine方法代码示例

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


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

示例1: display_grid

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DotLine [as 别名]
def display_grid(self):
        """Display grid on x-axis and y-axis."""
        window_start = self.parent.value('window_start')
        window_length = self.parent.value('window_length')
        window_end = window_start + window_length

        if self.parent.value('grid_x'):
            x_tick = self.parent.value('grid_xtick')
            x_ticks = arange(window_start, window_end + x_tick, x_tick)
            for x in x_ticks:
                x_pos = [x, x]
                y_pos = [0,
                         self.parent.value('y_distance') * len(self.idx_label)]
                path = self.scene.addPath(Path(x_pos, y_pos))
                path.setPen(QPen(QColor(LINE_COLOR), LINE_WIDTH,
                                 Qt.DotLine))

        if self.parent.value('grid_y'):
            y_tick = (self.parent.value('grid_ytick') *
                      self.parent.value('y_scale'))
            for one_label_item in self.idx_label:
                x_pos = [window_start, window_end]
                y = one_label_item.y()

                y_pos_0 = [y, y]
                path_0 = self.scene.addPath(Path(x_pos, y_pos_0))
                path_0.setPen(QPen(QColor(LINE_COLOR), LINE_WIDTH,
                                   Qt.DotLine))

                y_up = one_label_item.y() + y_tick
                y_pos_up = [y_up, y_up]
                path_up = self.scene.addPath(Path(x_pos, y_pos_up))
                path_up.setPen(QPen(QColor(LINE_COLOR), LINE_WIDTH,
                                    Qt.DotLine))

                y_down = one_label_item.y() - y_tick
                y_pos_down = [y_down, y_down]
                path_down = self.scene.addPath(Path(x_pos, y_pos_down))
                path_down.setPen(QPen(QColor(LINE_COLOR), LINE_WIDTH,
                                      Qt.DotLine)) 
开发者ID:wonambi-python,项目名称:wonambi,代码行数:42,代码来源:traces.py

示例2: paintEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DotLine [as 别名]
def paintEvent(self, event):
        painter = QPainter(self)
        painter.setRenderHint(QPainter.Antialiasing)
        # 背景白色
        painter.fillRect(event.rect(), QBrush(Qt.white))
        # 绘制边缘虚线框
        painter.setPen(Qt.DashLine)
        painter.setBrush(Qt.NoBrush)
        painter.drawRect(self.rect())
        # 随机画条线
        for _ in range(3):
            painter.setPen(QPen(QTCOLORLIST[qrand() % 5], 1, Qt.SolidLine))
            painter.setBrush(Qt.NoBrush)
            painter.drawLine(QPoint(0, qrand() % self.height()),
                             QPoint(self.width(), qrand() % self.height()))
            painter.drawLine(QPoint(qrand() % self.width(), 0),
                             QPoint(qrand() % self.width(), self.height()))
        # 绘制噪点
        painter.setPen(Qt.DotLine)
        painter.setBrush(Qt.NoBrush)
        for _ in range(self.width()):  # 绘制噪点
            painter.drawPoint(QPointF(qrand() % self.width(), qrand() % self.height()))
        # super(WidgetCode, self).paintEvent(event)  # 绘制文字
        # 绘制跳动文字
        metrics = QFontMetrics(self.font())
        x = (self.width() - metrics.width(self.text())) / 2
        y = (self.height() + metrics.ascent() - metrics.descent()) / 2
        for i, ch in enumerate(self.text()):
            index = (self.step + i) % 16
            painter.setPen(TCOLORLIST[qrand() % 6])
            painter.drawText(x, y - ((SINETABLE[index] * metrics.height()) / 400), ch)
            x += metrics.width(ch) 
开发者ID:PyQt5,项目名称:PyQt,代码行数:34,代码来源:VerificationCode.py

示例3: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import DotLine [as 别名]
def paint(self, painter: QPainter, option, widget):
        style = Qt.DotLine if self.model_item.has_live_input else Qt.SolidLine
        pen = QPen(settings.LINECOLOR, 1, style)
        painter.setPen(pen)
        painter.setBrush(settings.LABEL_COLORS[self.model_item.color_index])
        painter.drawRect(self.boundingRect())

        if self.scene().mode == 1:
            super().paint(painter, option, widget) 
开发者ID:jopohl,项目名称:urh,代码行数:11,代码来源:LabelItem.py

示例4: __init__

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

        # grid layout for main window
        layout_main = QGridLayout(self)
        layout_main.setContentsMargins(5, 19, 5, 3)
        layout_main.setHorizontalSpacing(0)
        layout_main.setVerticalSpacing(8)

        self.tabWidget = TabWidget(self)

        layout_v = QVBoxLayout(self.tabWidget.tab_audio)
        layout_v.setContentsMargins(5, 5, 5, 2)
        layout_v.setSpacing(5)

        self.label_filtering = QLabel(self.tabWidget.tab_audio)
        self._set_label_filtering()
        layout_v.addWidget(self.label_filtering)

        self.frame_attributes = AudioAttFrame()
        layout_v.addWidget(self.frame_attributes)

        self.lineEdit_filter = QLineEdit(self.tabWidget.tab_audio)
        self._set_line_edit_filter()
        layout_v.addWidget(self.lineEdit_filter)
        
        self.tableView_results = TableViewResults(self.tabWidget.tab_audio)
        layout_v.addWidget(self.tableView_results)

        self.recording_model = RecordingModel()

        self.proxy_model = SortFilterProxyModel()
        self.proxy_model.setSourceModel(self.recording_model)
        self.proxy_model.setFilterKeyColumn(-1)

        self.tableView_results.setModel(self.proxy_model)

        layout_main.addWidget(self.tabWidget, 1, 0, 1, 1)

        self._retranslate_ui()
        self.tabWidget.setCurrentIndex(1)

        QMetaObject.connectSlotsByName(self)

        self.lineEdit_filter.setDisabled(True)
        self.tableView_results.setGridStyle(Qt.DotLine)
        self.tableView_results.setDisabled(True) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:49,代码来源:queryframe.py


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