本文整理汇总了Python中PySide.QtGui.QPixmap.size方法的典型用法代码示例。如果您正苦于以下问题:Python QPixmap.size方法的具体用法?Python QPixmap.size怎么用?Python QPixmap.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QPixmap
的用法示例。
在下文中一共展示了QPixmap.size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import size [as 别名]
def __init__(self, parent=None):
super(SearchEdit, self).__init__(parent)
clr_pixmap = QPixmap(':/icons/clear.png')
self._btn_clear = QToolButton(self)
self._btn_clear.setIcon(clr_pixmap)
self._btn_clear.setIconSize(clr_pixmap.size())
self._btn_clear.setCursor(Qt.ArrowCursor)
self._btn_clear.setStyleSheet('QToolButton { border: none; padding: 0px; }');
self._btn_clear.clicked.connect(self.clear)
fw = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
#TODO: Make a Search glyph show up properly
self.setStyleSheet('QLineEdit { padding-right: %dpx; }' % (self._btn_clear.sizeHint().width() + fw + 1))
msz = self.minimumSizeHint()
self.setMinimumSize(max([msz.width(), self._btn_clear.sizeHint().height() + fw * 2 + 2]),
max([msz.height(), self._btn_clear.sizeHint().height() + fw * 2 + 2]))
self.setPlaceholderText('Search')
示例2: print
# 需要导入模块: from PySide.QtGui import QPixmap [as 别名]
# 或者: from PySide.QtGui.QPixmap import size [as 别名]
if 'coords' in self.flags:
print('x: {:.2f} {}'.format(x*scale, units))
print('y: {:.2f} {}'.format(y*scale, units))
print('angle: {:.2f} degrees'.format(angle))
def draw_line(self, linef):
line = QGraphicsLineItem(linef)
line.setPen(QPen(QBrush(QColor(0, 0, 0)), 1))
self.addItem(line)
if __name__ == '__main__':
app = QApplication(sys.argv)
loader = QUiLoader()
ui = loader.load('line_gui.ui')
ui.show()
pixmap = QPixmap(u'Top.jpg')
pixmap = pixmap.scaled(2*pixmap.size())
scene = GraphicsScene('tricavity', ['axis', 'coords'], scale_triplet=(.55,3.04,3.08))
pix_item = scene.addPixmap(pixmap)
pix_item.setCursor(Qt.CrossCursor)
layout = ui.findChild(QGridLayout, 'gridLayout')
view = QGraphicsView(scene)
layout.addWidget(view)
app.exec_()