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


Python QFont.setWeight方法代碼示例

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


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

示例1: _create_layout

# 需要導入模塊: from AnyQt.QtGui import QFont [as 別名]
# 或者: from AnyQt.QtGui.QFont import setWeight [as 別名]
    def _create_layout(self):
        box = gui.widgetBox(self.mainArea, 'RMSE')
        BOLD_FONT = QFont()
        BOLD_FONT.setWeight(QFont.DemiBold)
        widget = self

        class HereTableWidget(QTableWidget):
            def __init__(self, parent):
                super().__init__(parent)
                parent.layout().addWidget(self)
                self.setHorizontalScrollMode(self.ScrollPerPixel)
                self.setVerticalScrollMode(self.ScrollPerPixel)

            def update_table(self, fusers, relations):
                self.clear()
                self.setRowCount(0)
                self.setColumnCount(len(fusers))
                self.setHorizontalHeaderLabels([fuser[0].name for fuser in fusers.values()])
                for id, relation in relations.items():
                    row = self.rowCount()
                    self.insertRow(row)
                    if not np.ma.is_masked(relation.data):
                        widget.warning(id, 'Relation "{}" has no missing values '
                                           '(mask)'.format(relation_str(relation)))
                    rmses = []
                    for fuser in fusers.values():
                        rep_rmse = []
                        for fuserfit in fuser:
                            if not fuserfit.can_complete(relation):
                                break
                            completion = fuserfit.complete(relation)
                            rep_rmse.append(RMSE(relation.data, completion))
                        rmses.append(np.mean(rep_rmse) if rep_rmse else None)
                    try: min_rmse = min(e for e in rmses if e is not None)
                    except ValueError: continue # No fuser could complete this relation
                    for col, rmse in enumerate(rmses):
                        if rmse is None: continue
                        item = QTableWidgetItem('{:.05f}'.format(rmse))
                        item.setFlags(Qt.ItemIsEnabled)
                        if rmse == min_rmse and len(rmses) > 1:
                            item.setFont(BOLD_FONT)
                        self.setItem(row, col, item)
                self.setVerticalHeaderLabels([relation_str(i) for i in relations.values()])
                self.resizeColumnsToContents()
                self.resizeRowsToContents()

        self.table = HereTableWidget(box)
開發者ID:biolab,項目名稱:orange3-datafusion,代碼行數:49,代碼來源:owcompletionscoring.py

示例2: update_font

# 需要導入模塊: from AnyQt.QtGui import QFont [as 別名]
# 或者: from AnyQt.QtGui.QFont import setWeight [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


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