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


Python QtCore.QSize方法代码示例

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


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

示例1: sampleLatentAtPos

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def sampleLatentAtPos(self, pos):
		imgRect = self.getImageDims()
		gridDims = self.gridSize #self.latentSize *
		w = int(imgRect.width() / self.gridSize.width()) #self.latentSize * ( #self.getCurrentLatentWidth()
		h_l = self.latentSize // 2

		self.sampledLatentPos = self.getGridCoords(pos)

		posGrid = self.sampledLatentPos - QPoint(h_l, h_l)
		posGrid.setX(min(max(posGrid.x(), 0), gridDims.width() - h_l))
		posGrid.setY(min(max(posGrid.y(), 0), gridDims.height() - h_l))

		posImg = QPoint(int(imgRect.width() * posGrid.x() / gridDims.width()), int(imgRect.height() * posGrid.y() / gridDims.height()))

		fullImg = self._image.pixmap()
		imgRegion = fullImg.copy(QRect(posImg, QSize(w, w))).toImage()

		region_array = np.ndarray(shape=(imgRegion.height(), imgRegion.width(), 4), dtype=np.uint8, buffer=imgRegion.bits())
		self.sampledLatent = region_array[:, :, [2, 1, 0]] #BGR -> RGB 
开发者ID:afruehstueck,项目名称:tileGAN,代码行数:21,代码来源:tileGAN_client.py

示例2: test_level

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def test_level(level_info, qtbot):
    *level_info, transparent = level_info
    level_ref = LevelRef()
    level_ref.load_level(*level_info)

    Block._block_cache.clear()

    # monkeypatch level names, since the level name data is broken atm
    level_ref.level.name = current_test_name()

    level_view = LevelView(None, level_ref, ContextMenu(level_ref))
    level_view.transparency = transparent
    level_view.draw_jumps = False
    level_view.draw_grid = False
    level_view.draw_autoscroll = True

    rect = QRect(QPoint(0, 0), QSize(*level_ref.level.size) * 16)

    level_view.setGeometry(rect)

    _test_level_against_reference(level_view, qtbot) 
开发者ID:mchlnix,项目名称:SMB3-Foundry,代码行数:23,代码来源:test_level_drawing.py

示例3: __init__

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def __init__(self, parent, toolbar, icon, title):
        """
        * :param parent: Parent window
        * :param toolbar:dict
        * :param icon:str
        * :param title:str
        """
        super(JToolbar, self).__init__(parent)
        self.icon = icon
        self.setMovable(False)
        self.setContextMenuPolicy(Qt.PreventContextMenu)
        self.setIconSize(QSize(32, 32))
        self.about_title = "About"

        if toolbar:
            # If a dict is passed generate buttons from dict
            for btn in toolbar:
                try:
                    if btn["icon"]:
                        item = QAction(QIcon(btn["icon"]), btn["name"], self)
                except KeyError:
                    item = QAction(btn["name"], self)

                item.triggered.connect(self._on_click(btn["url"]))
                self.addAction(item) 
开发者ID:codesardine,项目名称:Jade-Application-Kit,代码行数:27,代码来源:Widgets.py

示例4: setupUi

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def setupUi(self, onionSkinObject_layout):
        onionSkinObject_layout.setObjectName("onionSkinObject_layout")
        onionSkinObject_layout.resize(204, 38)
        self.horizontalLayout = QtWidgets.QHBoxLayout(onionSkinObject_layout)
        self.horizontalLayout.setSpacing(3)
        self.horizontalLayout.setContentsMargins(4, 2, 4, 2)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.object_label = QtWidgets.QLabel(onionSkinObject_layout)
        self.object_label.setObjectName("object_label")
        self.horizontalLayout.addWidget(self.object_label)
        self.object_remove_btn = QtWidgets.QPushButton(onionSkinObject_layout)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Minimum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.object_remove_btn.sizePolicy().hasHeightForWidth())
        self.object_remove_btn.setSizePolicy(sizePolicy)
        self.object_remove_btn.setMinimumSize(QtCore.QSize(16, 16))
        self.object_remove_btn.setMaximumSize(QtCore.QSize(16, 16))
        self.object_remove_btn.setObjectName("object_remove_btn")
        self.horizontalLayout.addWidget(self.object_remove_btn)

        self.retranslateUi(onionSkinObject_layout)
        QtCore.QMetaObject.connectSlotsByName(onionSkinObject_layout) 
开发者ID:Viele,项目名称:onionSkinRenderer,代码行数:25,代码来源:onionSkinRendererObjectWidget.py

示例5: _init_widgets

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def _init_widgets(self):

        layout = QHBoxLayout()

        ast_label = QLabel(self)
        self._ast_label = ast_label

        if self._display_size:
            size_label = QLabel(self)
            size_label.setProperty('class', 'ast_viewer_size')
            size_label.setAlignment(Qt.AlignRight)
            size_label.setMaximumSize(QSize(24, 65536))
            self._size_label = size_label
            layout.addWidget(self._size_label)

        if self._ast is not None:
            self.reload()

        layout.addWidget(ast_label)
        layout.setContentsMargins(0, 0, 0, 0)

        self.setLayout(layout) 
开发者ID:angr,项目名称:angr-management,代码行数:24,代码来源:qast_viewer.py

示例6: setupUi

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def setupUi(self, ExcelSelectionDialog):
        ExcelSelectionDialog.setObjectName("ExcelSelectionDialog")
        ExcelSelectionDialog.resize(272, 229)
        ExcelSelectionDialog.setMaximumSize(QtCore.QSize(272, 229))
        ExcelSelectionDialog.setModal(True)
        self.verticalLayout = QtWidgets.QVBoxLayout(ExcelSelectionDialog)
        self.verticalLayout.setObjectName("verticalLayout")
        self.sheets_list = QtWidgets.QListWidget(ExcelSelectionDialog)
        self.sheets_list.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.sheets_list.setObjectName("sheets_list")
        self.verticalLayout.addWidget(self.sheets_list)
        self.buttonBox = QtWidgets.QDialogButtonBox(ExcelSelectionDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(ExcelSelectionDialog)
        self.buttonBox.accepted.connect(ExcelSelectionDialog.accept)
        self.buttonBox.rejected.connect(ExcelSelectionDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(ExcelSelectionDialog) 
开发者ID:SanPen,项目名称:GridCal,代码行数:23,代码来源:excel_sheet_selection.py

示例7: sizeHint

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def sizeHint(self):
		return QSize(300, 100) 
开发者ID:Vector35,项目名称:debugger,代码行数:4,代码来源:ConsoleWidget.py

示例8: sizeHint

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def sizeHint(self, option, idx):
		width = self.expected_char_widths[idx.column()]
		data = idx.data()
		if data is not None:
			width = max(width, len(data))
		return QSize(self.char_width * width + 4, self.char_height) 
开发者ID:Vector35,项目名称:debugger,代码行数:8,代码来源:ModulesWidget.py

示例9: sizeHint

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def sizeHint(self, option, idx):
		return QSize(self.char_width * self.expected_char_widths[idx.column()] + 4, self.char_height) 
开发者ID:Vector35,项目名称:debugger,代码行数:4,代码来源:ThreadsWidget.py

示例10: minimumSizeHint

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def minimumSizeHint(self):
        return QtCore.QSize(640, 480) 
开发者ID:coin3d,项目名称:pivy,代码行数:4,代码来源:mdi.py

示例11: __init__

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def __init__(self, parent=None):
        super(HotboxManagerToolbar, self).__init__(parent)
        self.setIconSize(QtCore.QSize(16, 16))
        self.new = QtWidgets.QAction(icon('manager-new.png'), '', self)
        self.new.setToolTip('Create new hotbox')
        self.new.triggered.connect(self.newRequested.emit)
        self.edit = QtWidgets.QAction(icon('manager-edit.png'), '', self)
        self.edit.setToolTip('Edit hotbox')
        self.edit.triggered.connect(self.editRequested.emit)
        self.delete = QtWidgets.QAction(icon('manager-delete.png'), '', self)
        self.delete.setToolTip('Delete hotbox')
        self.delete.triggered.connect(self.deleteRequested.emit)
        self.link = QtWidgets.QAction(icon('link.png'), '', self)
        self.link.setToolTip('Link to external hotbox file')
        self.link.triggered.connect(self.linkRequested.emit)
        self.unlink = QtWidgets.QAction(icon('unlink.png'), '', self)
        self.unlink.setToolTip('Remove hotbox file link')
        self.unlink.triggered.connect(self.unlinkRequested.emit)
        self.import_ = QtWidgets.QAction(icon('manager-import.png'), '', self)
        self.import_.setToolTip('Import hotbox')
        self.import_.triggered.connect(self.importRequested.emit)
        self.export = QtWidgets.QAction(icon('manager-export.png'), '', self)
        self.export.setToolTip('Export hotbox')
        self.export.triggered.connect(self.exportRequested.emit)
        self.hotkeyset = QtWidgets.QAction(icon('touch.png'), '', self)
        self.hotkeyset.setToolTip('Set hotkey')
        self.hotkeyset.triggered.connect(self.setHotkeyRequested.emit)

        self.addAction(self.new)
        self.addAction(self.edit)
        self.addAction(self.delete)
        self.addSeparator()
        self.addAction(self.link)
        self.addAction(self.unlink)
        self.addSeparator()
        self.addAction(self.import_)
        self.addAction(self.export)
        self.addSeparator()
        self.addAction(self.hotkeyset) 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:41,代码来源:manager.py

示例12: get_size

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def get_size(self):
        width = int(self.hbwidth.text()) if self.hbwidth.text() else 1
        height = int(self.hbheight.text()) if self.hbheight.text() else 1
        return QtCore.QSize(width, height) 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:6,代码来源:menu.py

示例13: _addAccountToWindow

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def _addAccountToWindow(self, account, balance, resize_parent=False):
        wrapper_layout = QVBoxLayout()
        account_layout = QHBoxLayout()
        rows_layout = QVBoxLayout()
        address_layout = QHBoxLayout()
        account_label = QLabel(account)
        account_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        copy_button = QPushButton()
        copy_button.setAutoFillBackground(True)
        copy_button.setIcon(QIcon('icons/copy.svg'))
        self.connect(copy_button, SIGNAL('clicked()'), lambda: self.copyAddress(account))
        address_layout.addWidget(account_label)
        address_layout.addWidget(copy_button)
        balance_label = QLabel('Balance: %.5f ethers' % balance)
        balance_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        self.balance_widgets[account] = balance_label
        rows_layout.addLayout(address_layout)
        rows_layout.addWidget(balance_label)
        avatar = QLabel()
        img_filename = render_avatar(account)
        pixmap = QPixmap(img_filename)
        avatar.setPixmap(pixmap)
        account_layout.addWidget(avatar)
        account_layout.addLayout(rows_layout)
        wrapper_layout.addLayout(account_layout)
        wrapper_layout.addSpacing(20)
        self.accounts_layout.addLayout(wrapper_layout)

        if resize_parent:
            sizeHint = self.sizeHint()
            self.parentWidget().parentWidget().resize(QSize(sizeHint.width(), sizeHint.height() + 40)) 
开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:33,代码来源:account_widget.py

示例14: _addTokenToWindow

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def _addTokenToWindow(self, token_information, resize_parent=False):
        wrapper_layout = QVBoxLayout()
        token_layout = QHBoxLayout()
        rows_layout = QVBoxLayout()
        token_label = QLabel(token_information.name)
        token_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        symbol_label = QLabel(token_information.symbol)
        symbol_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        total_supply_label = QLabel('Total Supply: %d coins' % token_information.totalSupply)
        total_supply_label.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum)
        rows_layout.addWidget(token_label)
        rows_layout.addWidget(symbol_label)
        rows_layout.addWidget(total_supply_label)
        avatar = QLabel()
        img_filename = render_avatar(token_information.address)
        pixmap = QPixmap(img_filename)
        avatar.setPixmap(pixmap)
        token_layout.addWidget(avatar)
        token_layout.addLayout(rows_layout)
        wrapper_layout.addLayout(token_layout)
        wrapper_layout.addSpacing(20)
        self.tokens_layout.addLayout(wrapper_layout)

        if resize_parent:
            sizeHint = self.size()
            self.parentWidget().parentWidget().resize(QSize(sizeHint.width(), sizeHint.height() + 100)) 
开发者ID:PacktPublishing,项目名称:Hands-On-Blockchain-for-Python-Developers,代码行数:28,代码来源:token_widget.py

示例15: updateIndicatorSize

# 需要导入模块: from PySide2 import QtCore [as 别名]
# 或者: from PySide2.QtCore import QSize [as 别名]
def updateIndicatorSize(self, stroke=3, offset=2, crossSize=10):
		"""
		draw a box and crosshair under mouse cursor as rectangle of size latentSize
		"""
		multiplier = 1 #TODO optional: scale indicator with zoom level

		stroke *= multiplier
		offset *= multiplier
		crossSize *= multiplier

		halfStroke = stroke / 2
		rect = self.getImageDims()
		latentSize = self.latentSize * rect.width() / self.gridSize.width()
		halfSize = latentSize / 2
		crossSize = min(crossSize, int(halfSize - 3))

		pixmap = QPixmap(QSize(int(latentSize + stroke + offset), int(latentSize + stroke + offset)))
		#fill rectangle with transparent color
		pixmap.fill(QColor(0,0,0,0)) #transparent

		painter = QPainter(pixmap)
		r = QRectF(QPoint(), QSizeF(latentSize, latentSize))
		r.adjust(offset+halfStroke, offset+halfStroke, -halfStroke, -halfStroke)
		#draw shadow under rectangle
		pen = QPen(QColor(50, 50, 50, 100), stroke) #shadow
		painter.setPen(pen)
		painter.drawRect(r)
		if crossSize > 4:
			painter.drawLine(QPointF(offset+halfSize, offset+halfSize-crossSize), QPointF(offset+halfSize, offset+halfSize+crossSize))
			painter.drawLine(QPointF(offset+halfSize-crossSize, offset+halfSize), QPointF(offset+halfSize+crossSize, offset+halfSize))
		r.adjust(-offset, -offset, -offset, -offset)
		pen = QPen(QColor(styleColor[0], styleColor[1], styleColor[2], 200), stroke)
		painter.setPen(pen)
		painter.drawRect(r)
		if crossSize > 4:
			painter.drawLine(QPointF(halfSize, halfSize - crossSize), QPointF(halfSize, halfSize + crossSize))
			painter.drawLine(QPointF(halfSize - crossSize, halfSize), QPointF(halfSize + crossSize, halfSize))
		painter.end()

		self._latentIndicator.setPixmap(pixmap) 
开发者ID:afruehstueck,项目名称:tileGAN,代码行数:42,代码来源:tileGAN_client.py


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