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


Python QtGui.QFont方法代码示例

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


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

示例1: __init__

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def __init__(self, font, textColor, parent=None):
        super(TextEditDialog, self).__init__(parent)
        self.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
        self.resize(QtCore.QSize(400, 300))
        self.layout = QVBoxLayout(self)
        self.layout.setContentsMargins(2, 2, 2, 2)
        self.te = TextEditingField()
        self.te.accepted.connect(self.onAccept)
        self._font = QtGui.QFont(font)
        self.te.setTextColor(textColor)
        self.layout.addWidget(self.te)
        self.buttons = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
        self.buttons.accepted.connect(self.onAccept)
        self.buttons.rejected.connect(self.onReject)
        self.layout.addWidget(self.buttons)
        self._result = None 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:19,代码来源:TextEditDialog.py

示例2: __init__

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def __init__(self, dataType, parent=None):
        super(_PinWidget, self).__init__(parent)
        self.dataType = dataType
        self.fakeOwningNode = _FakeNode()
        self._rawPin = _FakePin()
        self._pinColor = QtGui.QColor(*findPinClassByType(self.dataType).color())
        self.labelColor = QtCore.Qt.white
        self.hovered = False
        self.pinSize = _PIN_SIZE
        self._font = QtGui.QFont("Consolas")
        self._font.setPointSize(14)
        self.direction = PinDirection.Input
        self.name = self.dataType
        self.bLabelHidden = False
        self.pinCircleDrawOffset = QtCore.QPointF()

        self.setMouseTracking(True)
        self.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:20,代码来源:SelectPinDialog.py

示例3: __init__

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def __init__(self, parent=None):
        super(NodeName, self).__init__(parent)
        self.setAcceptHoverEvents(True)
        self.setFlag(QGraphicsWidget.ItemSendsGeometryChanges)
        self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
        self.labelItem = InputTextField(self.parentItem().getName(), parent, self, singleLine=True, validator=NodeNameValidator())
        self.labelItem.setDefaultTextColor(self.parentItem()._labelTextColor)
        self.labelItem.setAcceptHoverEvents(True)
        self.labelItem.document().contentsChanged.connect(self.parentItem().updateNodeShape)
        self.labelItem.editingFinished.connect(self.parentItem().finalizeRename)

        self.labelItem.hoverMoveEvent = self.hoverMoveEvent
        self._font = QtGui.QFont("Consolas")
        self._font.setPointSize(6)
        self.labelItem.setFont(self._font)
        self.setGraphicsItem(self.labelItem)
        self.hovered = False
        self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:20,代码来源:UINodeBase.py

示例4: __init__

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def __init__(self, text, parent=None):
        # Initialize UI
        super().__init__(parent)
        self.setupUi(self)

        monospace_font = QtGui.QFont('monospace')
        monospace_font.setStyleHint(QtGui.QFont.Monospace)
        self.helpTextEdit.setFont(monospace_font)
        self.helpTextEdit.setPlainText(text) 
开发者ID:xmikos,项目名称:qspectrumanalyzer,代码行数:11,代码来源:settings.py

示例5: __init__

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def __init__(self, state, icon=None):
        super(HistoryEntry, self).__init__(state.text)
        self.state = state
        if icon:
            self.setIcon(icon)
        self.bEnabled = True
        self.setFont(QtGui.QFont("Consolas")) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:9,代码来源:HistoryTool.py

示例6: __init__

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def __init__(self, labelText="", type="float", buttons=False, decimals=3, draggerSteps=FLOAT_SLIDER_DRAG_STEPS, *args, **kwargs):
        """
        :param type: Choose if create a float or int spinBox, defaults to "float"
        :type type: str, optional
        :param buttons: Show or hidden right up/Down Buttons, defaults to False
        :type buttons: bool, optional
        :param decimals: Number of decimals if type is "float", defaults to 3
        :type decimals: int, optional
        :param *args: [description]
        :type *args: [type]
        :param **kwargs: [description]
        :type **kwargs: [type]
        """
        super(valueBox, self).__init__(*args, **kwargs)
        self.labelFont = QtGui.QFont('Serif', 10, QtGui.QFont.Bold)
        self.labelText = labelText
        self.draggerSteps = copy(draggerSteps)
        self.isFloat = type == "float"
        if not self.isFloat:
            self.setDecimals(0)
        else:
            self.setDecimals(decimals)
        if not buttons:
            self.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.setStyleSheet(editableStyleSheet().getSliderStyleSheet("sliderStyleSheetA"))
        self.lineEdit().installEventFilter(self)
        self.installEventFilter(self)
        self.setFocusPolicy(QtCore.Qt.StrongFocus)
        self.draggers = None
        self.setRange(FLOAT_RANGE_MIN, FLOAT_RANGE_MAX) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:32,代码来源:QtSliders.py

示例7: setupEditor

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def setupEditor(self):
        font = QtGui.QFont()
        font.setFamily('Source Code Pro')
        font.setFixedPitch(True)
        font.setPointSize(10)

        self.code_edit_py.setFont(font)
        self.code_edit_mel.setFont(font)

        self.highlighter_py = cgtk_qt.syntax.PythonHighlighter(self.code_edit_py.document())
        self.highlighter_mel = cgtk_qt.syntax.MelHighlighter(self.code_edit_mel.document()) 
开发者ID:cineuse,项目名称:CNCGToolKit,代码行数:13,代码来源:new_shelf_btn.py

示例8: _createStyle

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def _createStyle(self, config):
        """
        Read the node style from the configuration file.

        """
        self.setAcceptHoverEvents(True)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable)
        self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable)

        # Dimensions.
        self.baseWidth  = config['node_width']
        self.baseHeight = config['node_height']
        self.attrHeight = config['node_attr_height']
        self.border = config['node_border']
        self.radius = config['node_radius']

        self.nodeCenter = QtCore.QPointF()
        self.nodeCenter.setX(self.baseWidth / 2.0)
        self.nodeCenter.setY(self.height / 2.0)

        self._brush = QtGui.QBrush()
        self._brush.setStyle(QtCore.Qt.SolidPattern)
        self._brush.setColor(utils._convertDataToColor(config[self.nodePreset]['bg']))

        self._pen = QtGui.QPen()
        self._pen.setStyle(QtCore.Qt.SolidLine)
        self._pen.setWidth(self.border)
        self._pen.setColor(utils._convertDataToColor(config[self.nodePreset]['border']))

        self._penSel = QtGui.QPen()
        self._penSel.setStyle(QtCore.Qt.SolidLine)
        self._penSel.setWidth(self.border)
        self._penSel.setColor(utils._convertDataToColor(config[self.nodePreset]['border_sel']))

        self._textPen = QtGui.QPen()
        self._textPen.setStyle(QtCore.Qt.SolidLine)
        self._textPen.setColor(utils._convertDataToColor(config[self.nodePreset]['text']))

        self._nodeTextFont = QtGui.QFont(config['node_font'], config['node_font_size'], QtGui.QFont.Bold)
        self._attrTextFont = QtGui.QFont(config['attr_font'], config['attr_font_size'], QtGui.QFont.Normal)

        self._attrBrush = QtGui.QBrush()
        self._attrBrush.setStyle(QtCore.Qt.SolidPattern)

        self._attrBrushAlt = QtGui.QBrush()
        self._attrBrushAlt.setStyle(QtCore.Qt.SolidPattern)

        self._attrPen = QtGui.QPen()
        self._attrPen.setStyle(QtCore.Qt.SolidLine) 
开发者ID:LeGoffLoic,项目名称:Nodz,代码行数:51,代码来源:nodz_main.py

示例9: __init__

# 需要导入模块: from Qt import QtGui [as 别名]
# 或者: from Qt.QtGui import QFont [as 别名]
def __init__(self, parent=None):
        super(WizardDialogueBase, self).__init__(parent)
        self.setWindowTitle("Package wizard")
        self.setWindowIcon(QtGui.QIcon(":LogoBpApp.png"))
        self.resize(700, 500)
        self.mainLayout = QVBoxLayout(self)
        self.mainLayout.setObjectName("mainLayout")
        self.mainLayout.setSpacing(1)
        self.mainLayout.setContentsMargins(1, 1, 1, 1)
        self.progress = QProgressBar()
        self.progress.setTextVisible(False)
        self.progress.setObjectName("progress")
        self.progress.setRange(0, 100)
        self.mainLayout.addWidget(self.progress)
        self.stackWidget = QStackedWidget()
        self.stackWidget.currentChanged.connect(self.updateMessage)

        # message section
        self.messageLayout = QHBoxLayout()
        self.messageWidget = QLabel()
        self.messageWidget.setTextFormat(QtCore.Qt.RichText)
        self.messageWidget.setWordWrap(True)
        self.messageWidget.setAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont("Consolas", 20)
        self.messageWidget.setFont(font)
        wizardImage = QLabel("test")
        wizardImage.setPixmap(QtGui.QPixmap(":wizard-cat.png").scaled(250, 250))
        wizardImage.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        self.messageLayout.addWidget(wizardImage)
        self.messageLayout.addWidget(self.messageWidget)
        self.mainLayout.addLayout(self.messageLayout)

        # add user input section
        # ...
        self.messages = {}
        self.pageValidationHooks = {}
        self.errorMessages = {}
        self.pageEnterCallbacks = {}
        self.addGreetPage()
        self.populate()
        self.addFinalPage()

        self.mainLayout.addWidget(self.stackWidget)

        # add navigation buttons
        # ...
        self.navigationLayout = QHBoxLayout()
        self.navigationLayout.setObjectName("navigationLayout")
        self.navigationLayout.setContentsMargins(5, 1, 5, 5)
        self.goBackButton = QPushButton("Go back")
        self.goBackButton.clicked.connect(self.onGoBack)
        self.goForwardButton = QPushButton("Go forward")
        self.goForwardButton.clicked.connect(self.onGoForward)
        self.navigationLayout.addWidget(self.goBackButton)
        spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Maximum)
        self.navigationLayout.addItem(spacerItem)
        self.navigationLayout.addWidget(self.goForwardButton)
        self.mainLayout.addLayout(self.navigationLayout)

        self.updateNavigationVisibility()
        self.updateMessage(0) 
开发者ID:wonderworks-software,项目名称:PyFlow,代码行数:63,代码来源:WizardDialogueBase.py


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