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


Python QtGui.QFont方法代碼示例

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


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

示例1: confirmDialog

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def confirmDialog(tex_count):
    """
    displays a confirmation dialog (with info about amount of found textures) for starting texture conversion process
    """
    font = QtGui.QFont()
    font.setBold( True )

    dialog = QtWidgets.QMessageBox()
    if in_hou:
        dialog.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window)
        dialog.setProperty("houdiniStyle", True)
    dialog.setFont(font)

    dialog.setIcon(QtWidgets.QMessageBox.Information)
    dialog.setWindowTitle("Proceed?")
    dialog.setText("{} textures found, proceed?".format(tex_count))

    dialog.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
    dialog.setDefaultButton(QtWidgets.QMessageBox.Yes)
    ret = dialog.exec_()
    
    if ret == dialog.Ok:
        return True
    else:
        return False 
開發者ID:jtomori,項目名稱:batch_textures_convert,代碼行數:27,代碼來源:gui.py

示例2: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def __init__(self, name=None):

        pen = QtGui.QPen(QtCore.Qt.SolidLine)
        pen.setColor(QtGui.QColor(0, 0, 0, 255))
        pen.setWidthF(0.2)
        pen.setJoinStyle(QtCore.Qt.MiterJoin)
        self.pen = pen

        self.brush = QtGui.QBrush(QtGui.QColor(255, 255, 0, 255))
        self.font = QtGui.QFont('Decorative', 12)

        self.rect = QtCore.QRectF()
        self.shape = QtGui.QPainterPath()
        self.path = QtGui.QPainterPath()

        self.scale = (1, 1)
        self.tooltip = ''

        self.method = ''
        self.args = [] 
開發者ID:chiefenne,項目名稱:PyAero,代碼行數:22,代碼來源:GraphicsItemsCollection.py

示例3: data

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def data(self, index, role=Qt.DisplayRole):
        if role == Qt.CheckStateRole:
            return None

        if role == Qt.FontRole:
            return QFont(self.font_name, self.font_size)

        regs = self.view.session_data['emulator.registers']
        if len(regs) == 0 and index.row() == 0:
            return None

        if regs[index.row()][index.column()] is None:
            return None

        elif index.column() == 0:
            return regs[index.row()][0]
        else:
            return hex(regs[index.row()][1]) 
開發者ID:joshwatson,項目名稱:f-ing-around-with-binaryninja,代碼行數:20,代碼來源:registers.py

示例4: init_font_config

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def init_font_config(self):
        self.ui_default_font = QApplication.font("QMenu")
        self.tabular_view_font = QApplication.font("QMenu")

        self.disasm_font = QFont("DejaVu Sans Mono", 10)
        self.disasm_font_metrics = QFontMetricsF(self.disasm_font)
        self.disasm_font_height = self.disasm_font_metrics.height()
        self.disasm_font_width = self.disasm_font_metrics.width('A')
        self.disasm_font_ascent = self.disasm_font_metrics.ascent()

        self.symexec_font = QFont("DejaVu Sans Mono", 10)
        self.symexec_font_metrics = QFontMetricsF(self.symexec_font)
        self.symexec_font_height = self.symexec_font_metrics.height()
        self.symexec_font_width = self.symexec_font_metrics.width('A')
        self.symexec_font_ascent = self.symexec_font_metrics.ascent()

        self.code_font = QFont("Source Code Pro", 10)
        self.code_font_metrics = QFontMetricsF(self.code_font)
        self.code_font_height = self.code_font_metrics.height()
        self.code_font_width = self.code_font_metrics.width('A')
        self.code_font_ascent = self.code_font_metrics.ascent() 
開發者ID:angr,項目名稱:angr-management,代碼行數:23,代碼來源:config_manager.py

示例5: _show_trace_func

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def _show_trace_func(self, show_func_tag):
        x = self.TRACE_FUNC_X
        y = self.TRACE_FUNC_Y
        prev_name = None
        for position in self.trace.trace_func:
            bbl_addr = position.bbl_addr
            func_name = position.func_name
            l.debug('Draw function %x, %s', bbl_addr, func_name)
            color = self.trace.get_func_color(func_name)
            self.trace_func.addToGroup(self.scene.addRect(x, y,
                                                          self.TRACE_FUNC_WIDTH, self.trace_func_unit_height,
                                                          QPen(color), QBrush(color)))
            if show_func_tag is True and func_name != prev_name:
                tag = self.scene.addText(func_name, QFont("Source Code Pro", 7))
                tag.setPos(x + self.TRACE_FUNC_WIDTH +
                           self.TAG_SPACING, y -
                           tag.boundingRect().height() // 2)
                self.trace_func.addToGroup(tag)
                anchor = self.scene.addLine(
                    self.TRACE_FUNC_X + self.TRACE_FUNC_WIDTH, y,
                    x + self.TRACE_FUNC_WIDTH + self.TAG_SPACING, y)
                self.trace_func.addToGroup(anchor)
                prev_name = func_name
            y += self.trace_func_unit_height 
開發者ID:angr,項目名稱:angr-management,代碼行數:26,代碼來源:qtrace_viewer.py

示例6: main

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def main():
    app = QApplication(sys.argv)

    app.setWindowIcon(QIcon(':/icons/app.svg'))

    fontDB = QFontDatabase()
    fontDB.addApplicationFont(':/fonts/Roboto-Regular.ttf')
    app.setFont(QFont('Roboto'))

    f = QFile(':/style.qss')
    f.open(QFile.ReadOnly | QFile.Text)
    app.setStyleSheet(QTextStream(f).readAll())
    f.close()

    translator = QTranslator()
    translator.load(':/translations/' + QLocale.system().name() + '.qm')
    app.installTranslator(translator)

    mw = MainWindow()
    mw.show()

    sys.exit(app.exec_()) 
開發者ID:gmarull,項目名稱:pyside2-boilerplate,代碼行數:24,代碼來源:__main__.py

示例7: __getFont

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def __getFont(self):
		weight = self.weight

		if self.weight == TextFormatWeight.NORMAL:
			weight = QtGui.QFont.Normal
		elif self.weight == TextFormatWeight.BOLD:
			weight = QtGui.QFont.Bold
		elif self.weight == TextFormatWeight.BOLDER:
			weight = QtGui.QFont.Black
		elif self.weight == TextFormatWeight.LIGHTER:
			weight = QtGui.QFont.Light

		font = QtGui.QFont()
		font.setFamily(self.font)
		font.setPixelSize(self.size)
		font.setWeight(weight)
		font.setItalic(self.italic)

		return font 
開發者ID:yuehaowang,項目名稱:pylash_engine,代碼行數:21,代碼來源:display.py

示例8: data

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def data(self, index, role=Qt.DisplayRole):
        if role == Qt.CheckStateRole:
            return None

        if role == Qt.FontRole:
            return QFont(self.font_name, self.font_size)

        size = len(self.stack)

        if 0 == size or size < index.row():
            return

        return hex(self.stack[index.row()][index.column()]) 
開發者ID:joshwatson,項目名稱:f-ing-around-with-binaryninja,代碼行數:15,代碼來源:stack.py

示例9: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def __init__(self, view, label, callback):
        super().__init__(label)
        self.callback = callback
        self.view = view

        font_name = Settings().get_string('ui.font.name')
        font_size = Settings().get_integer('ui.font.size')
        button_font = QFont(font_name, font_size)
        fm = QFontMetrics(button_font)
        self.setFont(button_font)
        self.setFixedWidth(fm.horizontalAdvance(label) + 10)

        QObject.connect(self, SIGNAL('clicked()'), self.callback) 
開發者ID:joshwatson,項目名稱:f-ing-around-with-binaryninja,代碼行數:15,代碼來源:buttons.py

示例10: data

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def data(self, index, role=Qt.DisplayRole):
        if role == Qt.CheckStateRole:
            return None

        if role == Qt.FontRole:
            return QFont(self.font_name, self.font_size)

        memory = self.view.session_data.get('emulator.memory')
        if memory is None:
            return

        row = memory[index.row()]

        if index.column() == 0:
            return hex(row.start)

        elif index.column() == 1:
            return hex(row.end)

        elif index.column() == 2:
            return hex(row.data_offset)

        elif index.column() == 3:
            return hex(row.data_length)

        elif index.column() == 4:
            return (
                f'{"r" if row.readable else "-"}'
                f'{"w" if row.writable else "-"}'
                f'{"x" if row.executable else "-"}'
            ) 
開發者ID:joshwatson,項目名稱:f-ing-around-with-binaryninja,代碼行數:33,代碼來源:memory.py

示例11: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def __init__(self, backgroundLayer = None):
		super(LineEdit, self).__init__()
		
		self.__font = "Arial"
		self.__size = 15
		self.__italic = False
		self.__weight = TextFormatWeight.NORMAL
		self.__preWidth = self.width
		self.__preHeight = self.height
		self.__preX = self.x
		self.__preY = self.y
		self.__preVisible = not self.visible
		self.__textColor = "black"
		self.__widgetFont = QtGui.QFont()
		self.__widgetPalette = QtGui.QPalette()
		self.lineEditWidget = QtWidgets.QLineEdit(stage.canvasWidget)
		self.backgroundLayer = backgroundLayer

		if not isinstance(self.backgroundLayer, DisplayObject):
			self.backgroundLayer = Sprite()
			self.backgroundLayer.graphics.beginFill("white")
			self.backgroundLayer.graphics.lineStyle(2, "gray")
			self.backgroundLayer.graphics.drawRect(0, 0, 200, 40)
			self.backgroundLayer.graphics.endFill()

		self.addChild(self.backgroundLayer)

		self.__initWidget()

		self.addEventListener(LoopEvent.ENTER_FRAME, self.__loop) 
開發者ID:yuehaowang,項目名稱:pylash_engine,代碼行數:32,代碼來源:ui.py

示例12: __getFontWeight

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def __getFontWeight(self, v):
		weight = v

		if v == TextFormatWeight.NORMAL:
			weight = QtGui.QFont.Normal
		elif v == TextFormatWeight.BOLD:
			weight = QtGui.QFont.Bold
		elif v == TextFormatWeight.BOLDER:
			weight = QtGui.QFont.Black
		elif v == TextFormatWeight.LIGHTER:
			weight = QtGui.QFont.Light

		return weight 
開發者ID:yuehaowang,項目名稱:pylash_engine,代碼行數:15,代碼來源:ui.py

示例13: draw_shape

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def draw_shape(painter, shape):
    options = shape.options
    content_rect = shape.content_rect()
    if shape.clicked:
        bordercolor = QtGui.QColor(options['bordercolor.clicked'])
        backgroundcolor = QtGui.QColor(options['bgcolor.clicked'])
        bordersize = options['borderwidth.clicked']
    elif shape.hovered:
        bordercolor = QtGui.QColor(options['bordercolor.hovered'])
        backgroundcolor = QtGui.QColor(options['bgcolor.hovered'])
        bordersize = options['borderwidth.hovered']
    else:
        bordercolor = QtGui.QColor(options['bordercolor.normal'])
        backgroundcolor = QtGui.QColor(options['bgcolor.normal'])
        bordersize = options['borderwidth.normal']
    textcolor = QtGui.QColor(options['text.color'])
    alpha = options['bordercolor.transparency'] if options['border'] else 255
    bordercolor.setAlpha(255 - alpha)
    backgroundcolor.setAlpha(255 - options['bgcolor.transparency'])

    pen = QtGui.QPen(bordercolor)
    pen.setStyle(QtCore.Qt.SolidLine)
    pen.setWidthF(bordersize)
    painter.setPen(pen)
    painter.setBrush(QtGui.QBrush(backgroundcolor))
    if options['shape'] == 'square':
        painter.drawRect(shape.rect)
    else:
        painter.drawEllipse(shape.rect)

    if shape.pixmap is not None:
        rect = shape.image_rect or content_rect
        painter.drawPixmap(rect, shape.pixmap)

    painter.setPen(QtGui.QPen(textcolor))
    painter.setBrush(QtGui.QBrush(textcolor))
    option = QtGui.QTextOption()
    flags = VALIGNS[options['text.valign']] | HALIGNS[options['text.halign']]
    option.setAlignment(flags)
    font = QtGui.QFont()
    font.setBold(options['text.bold'])
    font.setItalic(options['text.italic'])
    font.setPixelSize(options['text.size'])
    painter.setFont(font)
    text = options['text.content']
    painter.drawText(QtCore.QRectF(content_rect), flags, text) 
開發者ID:luckylyk,項目名稱:hotbox_designer,代碼行數:48,代碼來源:painting.py

示例14: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def __init__(self, parent=None, mode=0):
        QtWidgets.QMainWindow.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = '0.1'
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'
        self.hotkey = {}
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.name = self.__class__.__name__
        self.location = ''
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
            
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)
        
        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {} 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:45,代碼來源:universal_tool_template_1116.py

示例15: __init__

# 需要導入模塊: from PySide2 import QtGui [as 別名]
# 或者: from PySide2.QtGui import QFont [as 別名]
def __init__(self, parent=None, mode=0):
        QtWidgets.QMainWindow.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = '0.1'
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.name = self.__class__.__name__
        self.location = ''
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
            
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)
        
        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {} 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:45,代碼來源:universal_tool_template_1020.py


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