本文整理汇总了Python中Qt.QtCore.QSize方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QSize方法的具体用法?Python QtCore.QSize怎么用?Python QtCore.QSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Qt.QtCore
的用法示例。
在下文中一共展示了QtCore.QSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createPointerBoundingBox
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def _createPointerBoundingBox(pointerPos, bbSize):
"""
generate a bounding box around the pointer.
:param pointerPos: Pointer position.
:type pointerPos: QPoint.
:param bbSize: Width and Height of the bounding box.
:type bbSize: Int.
"""
# Create pointer's bounding box.
point = pointerPos
mbbPos = point
point.setX(point.x() - bbSize / 2)
point.setY(point.y() - bbSize / 2)
size = QtCore.QSize(bbSize, bbSize)
bb = QtCore.QRect(mbbPos, size)
bb = QtCore.QRectF(bb)
return bb
示例2: __init__
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def __init__(self):
super(HistoryTool, self).__init__()
self.setMinimumSize(QtCore.QSize(200, 50))
self.content = QWidget()
self.content.setObjectName("historyToolContent")
self.verticalLayout = QVBoxLayout(self.content)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.undoStackWidget = HistoryWidget(self)
self.undoStackWidget.setObjectName("undoStackWidget")
self.verticalLayout.addWidget(self.undoStackWidget)
self.pbClearHistory = QPushButton("Clear history")
self.pbClearHistory.clicked.connect(self.onClear)
self.verticalLayout.addWidget(self.pbClearHistory)
self.setWidget(self.content)
示例3: __init__
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [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
示例4: setupUi
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(228, 30)
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
self.horizontalLayout.setSpacing(1)
self.horizontalLayout.setContentsMargins(1, 1, 1, 1)
self.horizontalLayout.setObjectName("horizontalLayout")
self.widget = QtWidgets.QWidget(Form)
self.widget.setObjectName("widget")
self.horizontalLayout.addWidget(self.widget)
self.labelName = QtWidgets.QLabel(Form)
self.labelName.setObjectName("labelName")
self.horizontalLayout.addWidget(self.labelName)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.pbKill = QtWidgets.QPushButton(Form)
self.pbKill.setMaximumSize(QtCore.QSize(40, 16777215))
self.pbKill.setText("")
self.pbKill.setObjectName("pbKill")
self.horizontalLayout.addWidget(self.pbKill)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例5: setupUi
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def setupUi(self, QSpectrumAnalyzerBaseline):
QSpectrumAnalyzerBaseline.setObjectName("QSpectrumAnalyzerBaseline")
QSpectrumAnalyzerBaseline.resize(500, 100)
self.verticalLayout = QtWidgets.QVBoxLayout(QSpectrumAnalyzerBaseline)
self.verticalLayout.setObjectName("verticalLayout")
self.formLayout = QtWidgets.QFormLayout()
self.formLayout.setObjectName("formLayout")
self.label = QtWidgets.QLabel(QSpectrumAnalyzerBaseline)
self.label.setObjectName("label")
self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.baselineFileEdit = QtWidgets.QLineEdit(QSpectrumAnalyzerBaseline)
self.baselineFileEdit.setObjectName("baselineFileEdit")
self.horizontalLayout.addWidget(self.baselineFileEdit)
self.baselineFileButton = QtWidgets.QToolButton(QSpectrumAnalyzerBaseline)
self.baselineFileButton.setMinimumSize(QtCore.QSize(50, 0))
self.baselineFileButton.setObjectName("baselineFileButton")
self.horizontalLayout.addWidget(self.baselineFileButton)
self.formLayout.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout)
self.verticalLayout.addLayout(self.formLayout)
spacerItem = QtWidgets.QSpacerItem(20, 1, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.buttonBox = QtWidgets.QDialogButtonBox(QSpectrumAnalyzerBaseline)
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.label.setBuddy(self.baselineFileEdit)
self.retranslateUi(QSpectrumAnalyzerBaseline)
self.buttonBox.accepted.connect(QSpectrumAnalyzerBaseline.accept)
self.buttonBox.rejected.connect(QSpectrumAnalyzerBaseline.reject)
QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerBaseline)
QSpectrumAnalyzerBaseline.setTabOrder(self.baselineFileEdit, self.baselineFileButton)
示例6: sizeHint
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def sizeHint(self, option, index):
return QtCore.QSize(option.decorationSize.width(), 50)
示例7: _initRubberband
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def _initRubberband(self, position):
"""
Initialize the rubber band at the given position.
"""
self.rubberBandStart = position
self.origin = position
self.rubberband.setGeometry(QtCore.QRect(self.origin, QtCore.QSize()))
self.rubberband.show()
示例8: __init__
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def __init__(self):
super(VariablesTool, self).__init__()
self.setMinimumSize(QtCore.QSize(200, 50))
self.varsWidget = None
self.content = QWidget()
self.content.setObjectName("VariablesToolContent")
self.verticalLayout = QVBoxLayout(self.content)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.setWidget(self.content)
示例9: onShow
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def onShow(self):
super(NodeBoxTool, self).onShow()
self.setMinimumSize(QtCore.QSize(200, 50))
self.content = NodesBox(self, self.pyFlowInstance.getCanvas(), False, False, bUseDragAndDrop=True)
self.content.setObjectName("NodeBoxToolContent")
self.setWidget(self.content)
示例10: sizeHint
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def sizeHint(self):
textWidth = QtGui.QFontMetrics(self._font).width(self.dataType) + _PIN_SIZE
textHeight = max(QtGui.QFontMetrics(self._font).height(), _PIN_SIZE + 6)
return QtCore.QSize(textWidth, textHeight)
示例11: sizeHint
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def sizeHint(self):
return QtCore.QSize(13, 13)
示例12: createVariableWrapperAndAddToList
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def createVariableWrapperAndAddToList(self, rawVariable):
uiVariable = UIVariable(rawVariable, self)
item = QListWidgetItem(self.listWidget)
item.setSizeHint(QtCore.QSize(60, 20))
self.listWidget.setItemWidget(item, uiVariable)
return uiVariable
示例13: setupUi
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(341, 363)
self.verticalLayout = QtWidgets.QVBoxLayout(Form)
self.verticalLayout.setSpacing(1)
self.verticalLayout.setContentsMargins(1, 1, 1, 1)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(Form)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.pbNewVar = QtWidgets.QPushButton(Form)
self.pbNewVar.setMaximumSize(QtCore.QSize(50, 16777215))
self.pbNewVar.setObjectName("pbNewVar")
self.horizontalLayout.addWidget(self.pbNewVar)
self.verticalLayout.addLayout(self.horizontalLayout)
self.wListWidget = QtWidgets.QWidget(Form)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.wListWidget.sizePolicy().hasHeightForWidth())
self.wListWidget.setSizePolicy(sizePolicy)
self.wListWidget.setObjectName("wListWidget")
self.gridLayout = QtWidgets.QGridLayout(self.wListWidget)
self.gridLayout.setContentsMargins(1, 1, 1, 1)
self.gridLayout.setObjectName("gridLayout")
self.lytListWidget = QtWidgets.QVBoxLayout()
self.lytListWidget.setContentsMargins(0, 0, 0, 0)
self.lytListWidget.setObjectName("lytListWidget")
self.gridLayout.addLayout(self.lytListWidget, 0, 0, 1, 1)
self.verticalLayout.addWidget(self.wListWidget)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例14: on_icon_dropped_in
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def on_icon_dropped_in(self, icon_file):
ext = os.path.splitext(icon_file[0])[-1]
if ext.lower() in [".jpg", ".jpeg", ".png", ".gif"]:
icon_pix = QtGui.QPixmap(icon_file[0])
icon_pix = icon_pix.scaled(QtCore.QSize(32, 32), QtCore.Qt.KeepAspectRatio)
# show in ui
self.icon_label.setPixmap(icon_pix)
示例15: __init__
# 需要导入模块: from Qt import QtCore [as 别名]
# 或者: from Qt.QtCore import QSize [as 别名]
def __init__(self, dockWidget, renamable=False):
super(DockTitleBar, self).__init__(dockWidget)
self.renamable = renamable
self.setLayout(QtWidgets.QHBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 1)
self.buttonsLay = QtWidgets.QHBoxLayout()
self.buttonsLay.setSpacing(1)
self.buttonsLay.setMargin(1)
self.box = QtWidgets.QGroupBox("")
self.box.setLayout(self.buttonsLay)
self.box.setObjectName("Docked")
self.layout().addWidget(self.box)
self.box.mouseDoubleClickEvent = self.mouseDoubleClickEvent
self.box.mousePressEvent = self.mousePressEvent
self.box.mouseMoveEvent = self.mouseMoveEvent
self.box.mouseReleaseEvent = self.mouseReleaseEvent
self.titleLabel = QtWidgets.QLabel(self)
self.titleLabel.setStyleSheet("background:transparent")
self.titleEdit = QtWidgets.QLineEdit(self)
self.titleEdit.hide()
self.titleEdit.editingFinished.connect(self.finishEdit)
self.buttonSize = QtCore.QSize(14, 14)
self.dockButton = QtWidgets.QToolButton(self)
self.dockButton.setIcon(QtGui.QIcon(':/split_window.png'))
self.dockButton.setMaximumSize(self.buttonSize)
self.dockButton.setAutoRaise(True)
self.dockButton.clicked.connect(self.toggleFloating)
self.closeButton = QtWidgets.QToolButton(self)
self.closeButton.setMaximumSize(self.buttonSize)
self.closeButton.setAutoRaise(True)
self.closeButton.setIcon(QtGui.QIcon(':/close_window.png'))
self.closeButton.clicked.connect(self.closeParent)
self.buttonsLay.addSpacing(2)
self.buttonsLay.addWidget(self.titleLabel)
self.buttonsLay.addWidget(self.titleEdit)
self.buttonsLay.addStretch()
self.buttonsLay.addSpacing(5)
self.buttonsLay.addWidget(self.dockButton)
self.buttonsLay.addWidget(self.closeButton)
dockWidget.featuresChanged.connect(self.onFeaturesChanged)
self.onFeaturesChanged(dockWidget.features())
self.setTitle(dockWidget.windowTitle())
dockWidget.installEventFilter(self)
dockWidget.topLevelChanged.connect(self.ChangeFloatingStyle)