本文整理汇总了Python中PyQt5.QtWidgets.QSizePolicy.Minimum方法的典型用法代码示例。如果您正苦于以下问题:Python QSizePolicy.Minimum方法的具体用法?Python QSizePolicy.Minimum怎么用?Python QSizePolicy.Minimum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy.Minimum方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def __init__(self, parent, buttons=False):
super(CollectionEditor, self).__init__(QWidget(parent))
self.preferences = None
self.propertyEditors = {}
self.setLayout(QVBoxLayout())
self.layout().setSpacing(0)
self.form = QFormLayout()
self.layout().addLayout(self.form)
self.stats = QVBoxLayout()
self.layout().addLayout(self.stats)
self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.layout().addItem(self.verticalSpacer)
self.buttons = buttons
if self.buttons:
self.addButtons()
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def __init__(self, win_id, parent=None):
super().__init__(parent)
self.setTextFormat(Qt.RichText)
self._win_id = win_id
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
self.hide()
self._show_timer = usertypes.Timer(self, 'keyhint_show')
self._show_timer.timeout.connect(self.show)
self._show_timer.setSingleShot(True)
stylesheet.set_register(self)
示例3: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def __init__(self, parent=None, elidemode=Qt.ElideRight):
super().__init__(parent)
self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Minimum)
self._elidemode = elidemode
self._elided_text = ''
示例4: __set_design
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def __set_design(self):
"""
Sets general settings of frame widget, adds dock area and dock widgets.
"""
self.setWindowTitle('Player')
self.resize(1200, 550)
self.dock_area = DockAreaWidget()
# dock fixed waveform
dock_waveform = pgdock.Dock(name="Waveform", area='Top',
hideTitle=True, closable=False,
autoOrientation=False)
dock_waveform.setMinimumHeight(100)
dock_waveform.layout.setSizeConstraint(QLayout.SetMinimumSize)
dock_waveform.widgetArea.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,
QSizePolicy.Minimum))
# initializing waveform widget
self.waveform_widget = WaveformWidget()
# adding waveform widget to waveform dock
dock_waveform.addWidget(self.waveform_widget)
dock_waveform.allowedAreas = ['top']
dock_waveform.setAcceptDrops(False)
# adding waveform dock to dock area
self.dock_area.addDock(dock_waveform, position='top')
# adding dock area to frame
layout = QVBoxLayout(self)
layout.addWidget(self.dock_area)
示例5: init_layout
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def init_layout(self):
for row in range(0, self.__rows):
self.layout().setRowStretch(row, 1)
# item = QSpacerItem(0, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)
# self.layout().addItem(item, row, 0)
for column in range(0, self.__columns):
self.layout().setColumnStretch(column, 1)
# item = QSpacerItem(0, 0, QSizePolicy.Expanding, QSizePolicy.Minimum)
# self.layout().addItem(item, 0, column)
示例6: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def __init__(self, *args, **kwargs):
QWidget.__init__(self, *args, **kwargs)
self.setLayout(QVBoxLayout())
self.layout().setContentsMargins(0, 0, 0, 0)
self.listenerlist = ListenerList()
self.listenerlist.listenersUpdated.connect(self.listenersUpdated)
self.layout().addWidget(self.listenerlist)
self.hostinput = QLineEdit()
self.hostinput.setText("127.0.0.1")
self.hostinput.returnPressed.connect(self.add_listener)
self.portinput = QLineEdit()
self.portinput.setMaxLength(5)
self.portinput.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
self.portinput.returnPressed.connect(self.add_listener)
self.addbutton = QToolButton()
self.addbutton.setText("+")
self.removebutton = QToolButton()
self.removebutton.setText("-")
editbar = QHBoxLayout()
editbar.addWidget(self.addbutton)
editbar.addWidget(self.removebutton)
editbar.addWidget(QLabel("Interface:"))
editbar.addWidget(self.hostinput)
editbar.addWidget(QLabel("Port:"))
editbar.addWidget(self.portinput)
self.removebutton.clicked.connect(self.listenerlist.delete_selected)
self.addbutton.clicked.connect(self.add_listener)
self.layout().addLayout(editbar)
示例7: loadProperties
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def loadProperties(self, obj):
self.cleanup()
for prop in obj.props:
self.propertyEditors[prop] = PropertyEditor(self, obj.props[prop], self.preferences)
self.propertyEditors[prop].valueChanged.connect(self.propertyUpdate)
label = QLabel(obj.props[prop].dispName + ':')
label.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Expanding)
self.form.addRow(label, self.propertyEditors[prop])
if self.buttons:
self.applyButton.show()
self.cancelButton.show()
self.propertyUpdate()
示例8: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def __init__(self, client):
QWidget.__init__(self)
self.client = client
self.history = []
self.history_pos = 0
self.setLayout(QVBoxLayout())
self.layout().setSpacing(0)
self.layout().setContentsMargins(0, 0, 0, 0)
buttons = QHBoxLayout()
buttons.setContentsMargins(0, 0, 0, 0)
buttons.setSpacing(8)
submitButton = QPushButton("Submit")
submitButton.clicked.connect(self.submit)
self.dest_host_input = QLineEdit()
self.dest_port_input = QLineEdit()
self.dest_port_input.setMaxLength(5)
self.dest_port_input.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)
self.dest_usetls_input = QCheckBox()
self.back_button = QToolButton()
self.back_button.setText("<")
self.back_button.clicked.connect(self.back)
self.forward_button = QToolButton()
self.forward_button.setText(">")
self.forward_button.clicked.connect(self.forward)
buttons.addWidget(self.back_button)
buttons.addWidget(self.forward_button)
buttons.addWidget(submitButton)
buttons.addWidget(QLabel("Host:"))
buttons.addWidget(self.dest_host_input)
buttons.addWidget(QLabel("Port:"))
buttons.addWidget(self.dest_port_input)
buttons.addWidget(QLabel("Use TLS:"))
buttons.addWidget(self.dest_usetls_input)
buttons.addStretch()
self.reqview = ReqViewWidget(tag_tab=True)
self.reqview.set_read_only(False)
self.reqview.set_tags_read_only(False)
self.layout().addLayout(buttons)
self.layout().addWidget(self.reqview)
self.req = None
self.dest_host = ""
self.dest_port = 80
self.use_tls = False
self._update_buttons()
示例9: _initViews
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Minimum [as 别名]
def _initViews(self):
self.setFixedHeight(TITLE_BAR_HEIGHT)
palette = self.palette()
palette.setColor(palette.Window, QColor(240, 240, 240))
self.setPalette(palette)
# 布局
layout = QHBoxLayout(self, spacing=0)
layout.setContentsMargins(0, 0, 0, 0)
# 窗口图标
self.iconLabel = QLabel(self, objectName='iconLabel')
# 窗口标题
self.titleLabel = QLabel(self, objectName='titleLabel')
self.titleLabel.setMargin(5)
# 利用webdings字体来显示图标
font = self.font() or QFont()
font.setFamily('Webdings')
# 最小化按钮
self.buttonMinimum = QPushButton('0', self, font=font, objectName='buttonMinimum')
# 最大化/还原按钮
self.buttonMaximum = QPushButton('1', self, font=font, objectName='buttonMaximum')
# 关闭按钮
self.buttonClose = QPushButton('r', self, font=font, objectName='buttonClose')
self.theseSelect = QPushButton()
self.theseSelect.setObjectName("theseSelect")
self.theseSelect.setIcon(QIcon("icon/whitethese.png"))
self.theseSelect.clicked.connect(self._theseCallback)
self.buttonMinimum.setFixedSize(TITLE_BUTTON_SIZE, TITLE_BUTTON_SIZE)
self.buttonMaximum.setFixedSize(TITLE_BUTTON_SIZE, TITLE_BUTTON_SIZE)
self.buttonClose.setFixedSize(TITLE_BUTTON_SIZE, TITLE_BUTTON_SIZE)
self.iconLabel.setFixedSize(TITLE_LABEL_SIZE, TITLE_LABEL_SIZE)
self.titleLabel.setFixedHeight(TITLE_LABEL_SIZE)
self.iconLabel.setAlignment(Qt.AlignCenter)
self.titleLabel.setAlignment(Qt.AlignCenter)
self.buttonMinimum.clicked.connect(self.win.showMinimized)
self.buttonMaximum.clicked.connect(self.showMaximized)
self.buttonClose.clicked.connect(self.closeWindow)
layout.addWidget(self.iconLabel)
layout.addWidget(self.titleLabel)
# 中间伸缩条
layout.addSpacerItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum))
layout.addWidget(self.theseSelect)
layout.addWidget(self.buttonMinimum)
layout.addWidget(self.buttonMaximum)
layout.addWidget(self.buttonClose)
layout.setSpacing(2)
# self.setHeight()