當前位置: 首頁>>代碼示例>>Python>>正文


Python QFont.setUnderline方法代碼示例

本文整理匯總了Python中AnyQt.QtGui.QFont.setUnderline方法的典型用法代碼示例。如果您正苦於以下問題:Python QFont.setUnderline方法的具體用法?Python QFont.setUnderline怎麽用?Python QFont.setUnderline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AnyQt.QtGui.QFont的用法示例。


在下文中一共展示了QFont.setUnderline方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setColumnLinks

# 需要導入模塊: from AnyQt.QtGui import QFont [as 別名]
# 或者: from AnyQt.QtGui.QFont import setUnderline [as 別名]
    def setColumnLinks(self, column, links):
        font = QFont()
        font.setUnderline(True)

        for i, link in enumerate(links):
            self._roleData[gui.LinkRole][i][column] = link
            self._roleData[Qt.FontRole][i][column] = font
            self._roleData[Qt.ForegroundRole][i][column] = QColor(Qt.blue)
開發者ID:JakaKokosar,項目名稱:orange-bio,代碼行數:10,代碼來源:OWGeneInfo.py

示例2: update_font

# 需要導入模塊: from AnyQt.QtGui import QFont [as 別名]
# 或者: from AnyQt.QtGui.QFont import setUnderline [as 別名]
def update_font(basefont, weight=None, italic=None, underline=None,
                pixelSize=None, pointSize=None):
    """
    Return a copy of `basefont` :class:`QFont` with updated properties.
    """
    font = QFont(basefont)

    if weight is not None:
        font.setWeight(weight)

    if italic is not None:
        font.setItalic(italic)

    if underline is not None:
        font.setUnderline(underline)

    if pixelSize is not None:
        font.setPixelSize(pixelSize)

    if pointSize is not None:
        font.setPointSize(pointSize)

    return font
開發者ID:PrimozGodec,項目名稱:orange3,代碼行數:25,代碼來源:outputview.py

示例3: __on_enrichment_finished

# 需要導入模塊: from AnyQt.QtGui import QFont [as 別名]
# 或者: from AnyQt.QtGui.QFont import setUnderline [as 別名]
    def __on_enrichment_finished(self, results):
        assert QThread.currentThread() is self.thread()
        self.__state &= ~OWSetEnrichment.RunningEnrichment

        query, reference, results = results

        if self.annotationsChartView.model():
            self.annotationsChartView.model().clear()

        nquery = len(query)
        nref = len(reference)
        maxcount = max((len(e.query_mapped) for _, e in results),
                       default=1)
        maxrefcount = max((len(e.reference_mapped) for _, e in results),
                          default=1)
        nspaces = int(math.ceil(math.log10(maxcount or 1)))
        refspaces = int(math.ceil(math.log(maxrefcount or 1)))
        query_fmt = "%" + str(nspaces) + "s  (%.2f%%)"
        ref_fmt = "%" + str(refspaces) + "s  (%.2f%%)"

        def fmt_count(fmt, count, total):
            return fmt % (count, 100.0 * count / (total or 1))

        fmt_query_count = partial(fmt_count, query_fmt)
        fmt_ref_count = partial(fmt_count, ref_fmt)

        linkFont = QFont(self.annotationsChartView.viewOptions().font)
        linkFont.setUnderline(True)

        def item(value=None, tooltip=None, user=None):
            si = QStandardItem()
            if value is not None:
                si.setData(value, Qt.DisplayRole)
            if tooltip is not None:
                si.setData(tooltip, Qt.ToolTipRole)
            if user is not None:
                si.setData(user, Qt.UserRole)
            else:
                si.setData(value, Qt.UserRole)
            return si

        model = QStandardItemModel()
        model.setSortRole(Qt.UserRole)
        model.setHorizontalHeaderLabels(
            ["Category", "Term", "Count", "Reference count", "p-value",
             "FDR", "Enrichment"])
        for i, (gset, enrich) in enumerate(results):
            if len(enrich.query_mapped) == 0:
                continue
            nquery_mapped = len(enrich.query_mapped)
            nref_mapped = len(enrich.reference_mapped)

            row = [
                item(", ".join(gset.hierarchy)),
                item(gsname(gset), tooltip=gset.link),
                item(fmt_query_count(nquery_mapped, nquery),
                     tooltip=nquery_mapped, user=nquery_mapped),
                item(fmt_ref_count(nref_mapped, nref),
                     tooltip=nref_mapped, user=nref_mapped),
                item(fmtp(enrich.p_value), user=enrich.p_value),
                item(),  # column 5, FDR, is computed in filterAnnotationsChartView
                item(enrich.enrichment_score,
                     tooltip="%.3f" % enrich.enrichment_score,
                     user=enrich.enrichment_score)
            ]
            row[0].geneset = gset
            row[0].enrichment = enrich
            row[1].setData(gset.link, gui.LinkRole)
            row[1].setFont(linkFont)
            row[1].setForeground(QColor(Qt.blue))

            model.appendRow(row)

        self.annotationsChartView.setModel(model)
        self.annotationsChartView.selectionModel().selectionChanged.connect(
            self.commit
        )

        if not model.rowCount():
            self.warning(0, "No enriched sets found.")
        else:
            self.warning(0)

        allnames = set(gsname(geneset)
                       for geneset, (count, _, _, _) in results if count)

        allnames |= reduce(operator.ior,
                           (set(word_split(name)) for name in allnames),
                           set())

        self.filterCompleter.setModel(None)
        self.completerModel = QStringListModel(sorted(allnames))
        self.filterCompleter.setModel(self.completerModel)

        if results:
            max_score = max((e.enrichment_score for _, e in results
                             if np.isfinite(e.enrichment_score)),
                            default=1)

            self.annotationsChartView.setItemDelegateForColumn(
#.........這裏部分代碼省略.........
開發者ID:markotoplak,項目名稱:orange-bio,代碼行數:103,代碼來源:OWSetEnrichment.py

示例4: __on_enrichment_finished

# 需要導入模塊: from AnyQt.QtGui import QFont [as 別名]
# 或者: from AnyQt.QtGui.QFont import setUnderline [as 別名]
    def __on_enrichment_finished(self, results):
        assert QThread.currentThread() is self.thread()
        self.__state &= ~OWSetEnrichment.RunningEnrichment

        query, reference, results = results
        results = results  # type: List[Tuple[geneset.GeneSet, enrichment_res]]

        nquery = len(query)
        nref = len(reference)
        maxcount = max((len(e.query_mapped) for _, e in results),
                       default=1)
        maxrefcount = max((len(e.reference_mapped) for _, e in results),
                          default=1)
        nspaces = int(math.ceil(math.log10(maxcount or 1)))
        refspaces = int(math.ceil(math.log(maxrefcount or 1)))
        query_fmt = "%" + str(nspaces) + "s  (%.2f%%)"
        ref_fmt = "%" + str(refspaces) + "s  (%.2f%%)"

        def fmt_count(fmt, count, total):
            return fmt % (count, 100.0 * count / (total or 1))

        fmt_query_count = partial(fmt_count, query_fmt, total=nquery)
        fmt_ref_count = partial(fmt_count, ref_fmt, total=nref)
        view = self.annotationsChartView

        delegate = view.itemDelegateForColumn(ResultsModel.Count)
        if delegate is not None:
            delegate.deleteLater()
        delegate = view.itemDelegateForColumn(ResultsModel.Reference)
        if delegate is not None:
            delegate.deleteLater()

        view.setItemDelegateForColumn(
            ResultsModel.Count, FormatItemDelegate(fmt_query_count, self)

        )
        view.setItemDelegateForColumn(
            ResultsModel.Reference, FormatItemDelegate(fmt_ref_count, self)
        )
        linkFont = QFont(self.annotationsChartView.viewOptions().font)
        linkFont.setUnderline(True)

        def item(value=None, tooltip=None, user=None):
            si = QStandardItem()
            if value is not None:
                si.setData(value, Qt.DisplayRole)
            if tooltip is not None:
                si.setData(tooltip, Qt.ToolTipRole)
            if user is not None:
                si.setData(user, Qt.UserRole)
            else:
                si.setData(value, Qt.UserRole)
            return si

        model = ResultsModel(parent=self)
        for i, (gset, enrich) in enumerate(results):
            if len(enrich.query_mapped) == 0:
                continue
            nquery_mapped = len(enrich.query_mapped)
            nref_mapped = len(enrich.reference_mapped)

            row = [
                item(", ".join(gset.hierarchy)),
                item(gsname(gset), tooltip=gset.link),
                item(nquery_mapped, tooltip=nquery_mapped, user=nquery_mapped),
                item(nref_mapped, tooltip=nref_mapped, user=nref_mapped),
                item(enrich.p_value, user=enrich.p_value),
                item(np.nan),  # column 5, FDR, is computed in _updateFDR
                item(enrich.enrichment_score,
                     tooltip="%.3f" % enrich.enrichment_score,
                     user=enrich.enrichment_score)
            ]
            row[0].geneset = gset
            row[0].enrichment = enrich
            if gset.link:
                row[1].setData(gset.link, gui.LinkRole)
                row[1].setFont(linkFont)
                row[1].setForeground(QColor(Qt.blue))

            model.appendRow(row)

        currmodel = self.proxy.sourceModel()
        currmodel.deleteLater()
        self.proxy.setSourceModel(model)
        if not model.rowCount():
            self.warning(0, "No enriched sets found.")
        else:
            self.warning(0)

        allnames = set(gsname(geneset)
                       for geneset, (count, _, _, _) in results if count)

        allnames |= reduce(operator.ior,
                           (set(word_split(name)) for name in allnames),
                           set())

        self.filterCompleter.setModel(None)
        self.completerModel = QStringListModel(sorted(allnames))
        self.filterCompleter.setModel(self.completerModel)

#.........這裏部分代碼省略.........
開發者ID:biolab,項目名稱:orange-bio,代碼行數:103,代碼來源:OWSetEnrichment.py


注:本文中的AnyQt.QtGui.QFont.setUnderline方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。