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


Python QFont.setPixelSize方法代码示例

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


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

示例1: paintEvent

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
 def paintEvent(self, pe):
   painter = QPainter(self)
   painter.save()
   gradient = QLinearGradient()
   gradient.setStart(self._grad_start)
   gradient.setFinalStop(self._grad_end)
   gradient.setColorAt(0, QColor(230, 230, 230))
   gradient.setColorAt(1, QColor(247, 247, 247))
   brush = QBrush(gradient)
   painter.setBrush(brush)
   pen = QPen(Qt.black)
   pen.setWidth(1)
   painter.setPen(pen)
   painter.drawPath(self._painter_path)
   painter.restore()
   font = QFont()
   font.setFamily("Tahoma")
   font.setPixelSize(11)
   font.setBold(True)
   pen = QPen(Qt.darkGray)
   painter.setPen(pen)
   painter.setFont(font)
   self_rect = QRect(self.rect())
   self_rect.moveTo(self._hor_margin, self._ver_margin // 2)
   painter.drawText(self_rect, Qt.AlignLeft, self._text)
开发者ID:github-account-because-they-want-it,项目名称:VisualScrape,代码行数:27,代码来源:ui_common.py

示例2: __init__

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
    def __init__(self, parent=None, userData=None,inspector = True):
        QWebView.__init__(self, parent)  

        settings = QWebSettings.globalSettings()
        settings.setFontFamily(QWebSettings.StandardFont, 'Helvetica')
        settings.setFontSize(QWebSettings.DefaultFontSize, 12)

        self.webpage = page = PtWebPage(self)        
        self.setPage(page) 
        self.connect(self, SIGNAL('loadFinished(bool)'), self.onLoadFinished)
        self.settings().setAttribute(
                    QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        #path = os.getcwd()
        #self.settings().setUserStyleSheetUrl(QUrl.fromLocalFile(path + "/myCustom.css"))

        font = QFont("Helvetica")
        font.setPixelSize(12)
        self.setFont(font)
        # or globally:
        # QWebSettings.globalSettings().setAttribute(
        #     QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        if inspector:
            self.inspector = QWebInspector()
            self.inspector.setPage(self.page())
            self.inspector.hide()

        self.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.page().linkClicked.connect(self._on_page_link_clicked)
开发者ID:ptphp,项目名称:PtPy,代码行数:30,代码来源:ptwebview.py

示例3: optionsf

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
	def optionsf(self):
		self.opt = optdlg(self)
		self.opt.spinBox.setProperty("value", int(self.fontsize))
		font = QFont()
		font.setPixelSize(int(self.fontsize))
		self.opt.sampletxt.setFont(font)

		if str(self.clipauto) == "True":
			self.opt.checkclip.setChecked(True)
		elif str(self.clipauto) == "False":
			self.opt.checkclip.setChecked(False)

		if str(self.histdock) == "True":
			self.opt.checkshowhistdock.setChecked(True)
		elif str(self.histdock) == "False":
			self.opt.checkshowhistdock.setChecked(False)

		if str(self.bkmdock) == "True":
			self.opt.checkshowbkmdock.setChecked(True)
		elif str(self.bkmdock) == "False":
			self.opt.checkshowbkmdock.setChecked(False)

		self.opt.show()
		self.connect(self.opt.buttonBox, SIGNAL("accepted()"), self.optok)
		self.connect(self.opt.buttonBox.button(QDialogButtonBox.Apply), SIGNAL("clicked()"), self.optapply)
		self.connect(self.opt.checkdelhist, SIGNAL("stateChanged(int)"), self.deleteallhist)
		self.connect(self.opt.checkshowhistdock, SIGNAL("stateChanged(int)"), self.shownexttime)
		self.connect(self.opt.checkshowbkmdock, SIGNAL("stateChanged(int)"), self.shownexttime)
开发者ID:jnoortheen,项目名称:nigandu,代码行数:30,代码来源:mainwin.py

示例4: setfontsize

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
	def setfontsize(self, i):
		if i >= 8 or i <= 24:
			font = QFont()
			font.setPixelSize(i)
			self.comboBox.setFont(font)
			self.searchbtn.setFont(font)
			self.bkmli.setFont(font)
			self.histli.setFont(font)
			self.listview.setFont(font)
			self.tamtext.setFont(font)
开发者ID:jnoortheen,项目名称:nigandu,代码行数:12,代码来源:mainwin.py

示例5: __init__

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
    def __init__(self, view, uistack, widget):
        f = QFont('FreeMono')
        f.setWeight(QFont.Black)
        f.setPixelSize(16)

        self.grids = []
        self.colors = []

        self._view = view

        for p in providers:
            view.colors.addItem(p.name)
        view.colors.currentIndexChanged.connect(self.colorchange)

        self._detailview = view.detail
        self._detailview.scale(10, 10)

        self._lastdepth = -1
        self._detail = None
        self.add()

        view.layer.sliderMoved.connect(self.layer)
        view.detailLayer.sliderMoved.connect(self.detaillayer)

        self._view.add.pressed.connect(self.add)

        def detailevent(event):
            if (isinstance(event, QKeyEvent) and
                    event.text() == u'\t' and
                    event.type() == QEvent.ShortcutOverride):
                widget.keyPressEvent(QKeyEvent(
                    QEvent.KeyPress,
                    event.key(),
                    event.nativeModifiers(),
                    event.text(),
                    event.isAutoRepeat(),
                    event.count()))
                return True
            return QWidget.event(widget, event)

        widget.event = detailevent
        widget.keyPressEvent = self.key

        view.rotation.valueChanged.connect(self.rotate)

        view.layer.setValue(view.layer.maximum())

        self._view.showDetail.pressed.connect(self.showdetail)
        self._view.hideDetail.pressed.connect(self.hidedetail)
        self.hidedetail()

        self._view.pentagon.pressed.connect(self.pentagon)

        self._uistack = uistack
开发者ID:tps12,项目名称:hey-grid,代码行数:56,代码来源:screenpresenter.py

示例6: CreateFlatButton

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
def CreateFlatButton(action):
	"""
	Create a custom flat button and style
	it so that it will look good on all platforms.
	"""

	toolButton = QToolButton()
	toolButton.setIcon(action.icon())
	toolButton.setText(action.text())
	toolButton.setAutoRaise(True)
	toolButton.setIconSize(QSize(32, 32))
	toolButton.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
	if sys.platform.startswith('darwin'):
		# Bug for Mac: QToolButtons do not react to setAutoRaise so
		# can't be made flat when they are not used inside a toolbar.
		# Setting a custom style sheet with border to none fixes this.
		# But then it looses all its highlight and pressed visual cues
		# so some extra styling needs to be done to provide some nice
		# visual feedback on hover and pressed states.
		toolButton.setStyleSheet("QToolButton {"
			"border: none;"
			"} "
			"QToolButton:hover {"
			"background-color: qradialgradient(cx: 0.5, cy: 0.5,"
			"fx: 0.5, fy: 0.5,"
			"radius: 0.5, "
			"stop: 0 rgba(255, 255, 255, 100), "
			"stop: 1 rgba(0, 0, 0, 0));"
			"}"
			"QToolButton:pressed {"
			"background-color: qradialgradient(cx: 0.5, cy: 0.5,"
			"fx: 0.5, fy: 0.5,"
			"radius: 0.5, "
			"stop: 0 rgba(255, 255, 255, 200), "
			"stop: 1 rgba(0, 0, 0, 0));"
			"}")
	font = QFont()
	font.setPixelSize(10)
	toolButton.setFont(font)

	# Connect the clicked signal to the action trigger
	def pushed():
		toolButton.action.triggered.emit()
	setattr(toolButton, "pushed", pushed)
	toolButton.clicked.connect(toolButton.pushed)
	setattr(toolButton, "action", action)

	return toolButton
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:50,代码来源:ToolbarWidget.py

示例7: StatusWidget

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
class StatusWidget(QFrame):
    """
	StatusWidget
	"""

    def __init__(self):
        QFrame.__init__(self)

        self._color = [220, 220, 220]

        self._font = QFont()
        self._font.setPixelSize(10)

        self._pen = QPen(QColor(100, 100, 100, 255))

        self.label = QLabel()
        self.label.setWordWrap(True)
        self.label.setFont(self._font)
        self.label.setMaximumWidth(300)
        self.label.setMaximumHeight(36)
        self.label.setMinimumHeight(36)

        layout = QGridLayout()
        layout.setSpacing(0)
        layout.addWidget(self.label)
        self.setLayout(layout)

        self.setMinimumWidth(360)
        self.setMaximumWidth(360)

    def setText(self, text):
        self.label.setText(text)

    def paintEvent(self, ev):
        size = self.size()
        height = size.height() - 5
        width = size.width() - 5

        offset = 0.5
        rect = QRectF(2.0 + offset, 2.0 + offset, width, height)
        painter = QPainter(self)

        painter.setPen(self._pen)
        painter.setBrush(QColor(self._color[0], self._color[1], self._color[2]))
        painter.setRenderHint(QPainter.Antialiasing)
        painter.setRenderHint(QPainter.HighQualityAntialiasing)
        painter.drawRoundedRect(rect, 4, 4)
开发者ID:rcockbur,项目名称:3DMedicalVisualizationTool,代码行数:49,代码来源:StatusWidget.py

示例8: buildLabels

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
  def buildLabels(self, label):
    self.label = QLabel(label)
    self.data = QLabel(constants.DEFAULT_LABEL)

    # Center the text in the labels
    self.label.setAlignment(Qt.AlignCenter)
    self.data.setAlignment(Qt.AlignCenter)

    # Bold the label label
    labelFont = QFont()
    labelFont.setBold(True)

    # Make the data label font obnoxiously large
    dataFont = QFont()
    dataFont.setPixelSize(20)

    self.label.setFont(labelFont)
    self.data.setFont(dataFont)
开发者ID:shanet,项目名称:Osprey,代码行数:20,代码来源:qBigDataDisplay.py

示例9: tag_image

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
def tag_image(source, dest, tag, font, fontsize, x, y, width, height, aspectx, aspecty, red, green, blue, bold=False, italic=False):
    """docstring for tag_image"""

    app = QApplication.instance()
    
    pixmap = QPixmap(source)

    color = QColor(red,green,blue)
    font = QFont(font)
    font.setPixelSize(int(fontsize*pixmap.height()))
    font.setItalic(italic)
    font.setBold(bold)

    painter = QPainter(pixmap)
    painter.setPen(color)
    painter.setFont(font);
    painter.drawText(x*pixmap.width(),y*pixmap.height(), tag)
    painter.end()

    # Resize and save
    return pixmap.toImage().scaled(width*aspectx, height*aspecty, Qt.KeepAspectRatioByExpanding, Qt.SmoothTransformation).scaled(width, height, Qt.IgnoreAspectRatio, Qt.SmoothTransformation).save(dest)
开发者ID:eyeonSoftware,项目名称:epp,代码行数:23,代码来源:epp_addshot.py

示例10: PlainText

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
 def PlainText(painter,widget):
     painter.setPen(widget.textColor())
     
     font = QFont()
     font.setPixelSize(widget.fontSize())
     
     font.setOverline(widget.overline())
     font.setUnderline(widget.underlined())
     font.setItalic(widget.italic())
     font.setStrikeOut(widget.strikeOut())
     
     font.setWeight(widget.fontWeight())
     font.setFamily(widget.fontFamily())
     font.setCapitalization( QFont.Capitalization(widget.textTransform()) )
     
     font.setStretch(widget.fontStretch())
     font.setLetterSpacing(QFont.SpacingType(widget.letterSpacingType()), widget.letterSpacing())
     font.setWordSpacing(widget.wordSpacing())
     
     painter.setFont(font)
     
     painter.drawText(0,0,100,100,widget.textAlignment(),widget.text())
开发者ID:kaijfox,项目名称:Oxide-Gui,代码行数:24,代码来源:style.py

示例11: setsampletxt

# 需要导入模块: from PySide.QtGui import QFont [as 别名]
# 或者: from PySide.QtGui.QFont import setPixelSize [as 别名]
	def setsampletxt(self, i):
		font = QFont()
		font.setPixelSize(i)
		self.sampletxt.setFont(font)
开发者ID:jnoortheen,项目名称:nigandu,代码行数:6,代码来源:options.py


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