本文整理汇总了Python中PyQt5.QtWidgets.QSizePolicy.Expanding方法的典型用法代码示例。如果您正苦于以下问题:Python QSizePolicy.Expanding方法的具体用法?Python QSizePolicy.Expanding怎么用?Python QSizePolicy.Expanding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy.Expanding方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, parent=None):
super(SearchLineEdit, self).__init__()
self.setObjectName("SearchLine")
self.parent = parent
self.setMinimumSize(218, 20)
with open('QSS/searchLine.qss', 'r') as f:
self.setStyleSheet(f.read())
self.button = QPushButton(self)
self.button.setMaximumSize(13, 13)
self.button.setCursor(QCursor(Qt.PointingHandCursor))
self.setTextMargins(3, 0, 19, 0)
self.spaceItem = QSpacerItem(150, 10, QSizePolicy.Expanding)
self.mainLayout = QHBoxLayout()
self.mainLayout.addSpacerItem(self.spaceItem)
# self.mainLayout.addStretch(1)
self.mainLayout.addWidget(self.button)
self.mainLayout.addSpacing(10)
self.mainLayout.setContentsMargins(0, 0, 0, 0)
self.setLayout(self.mainLayout)
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, parent, slider: VideoSlider):
super(VideoSliderWidget, self).__init__(parent)
self.parent = parent
self.slider = slider
self.loaderEffect = OpacityEffect()
self.loaderEffect.setEnabled(False)
self.setGraphicsEffect(self.loaderEffect)
self.setContentsMargins(0, 0, 0, 0)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.layout().setStackingMode(QStackedLayout.StackAll)
self.genlabel = QLabel(self.parent)
self.genlabel.setContentsMargins(0, 0, 0, 14)
self.genlabel.setPixmap(QPixmap(':/images/generating-thumbs.png'))
self.genlabel.setAlignment(Qt.AlignCenter)
self.genlabel.hide()
sliderLayout = QGridLayout()
sliderLayout.setContentsMargins(0, 0, 0, 0)
sliderLayout.setSpacing(0)
sliderLayout.addWidget(self.slider, 0, 0)
sliderLayout.addWidget(self.genlabel, 0, 0)
sliderWidget = QWidget(self.parent)
sliderWidget.setLayout(sliderLayout)
self.addWidget(sliderWidget)
示例3: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [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()
示例4: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, *,
cmd: 'command.Command',
win_id: int,
parent: QWidget = None) -> None:
super().__init__(parent)
self.pattern = None # type: typing.Optional[str]
self._win_id = win_id
self._cmd = cmd
self._active = False
config.instance.changed.connect(self._on_config_changed)
self._delegate = completiondelegate.CompletionItemDelegate(self)
self.setItemDelegate(self._delegate)
self.setStyle(QStyleFactory.create('Fusion'))
stylesheet.set_register(self)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.setHeaderHidden(True)
self.setAlternatingRowColors(True)
self.setIndentation(0)
self.setItemsExpandable(False)
self.setExpandsOnDoubleClick(False)
self.setAnimated(False)
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# WORKAROUND
# This is a workaround for weird race conditions with invalid
# item indexes leading to segfaults in Qt.
#
# Some background: http://bugs.quassel-irc.org/issues/663
# The proposed fix there was later reverted because it didn't help.
self.setUniformRowHeights(True)
self.hide()
# FIXME set elidemode
# https://github.com/qutebrowser/qutebrowser/issues/118
示例5: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self._messages = [] # type: typing.MutableSequence[Message]
self._vbox = QVBoxLayout(self)
self._vbox.setContentsMargins(0, 0, 0, 0)
self._vbox.setSpacing(0)
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self._clear_timer = QTimer()
self._clear_timer.timeout.connect(self.clear_messages)
config.instance.changed.connect(self._set_clear_timer_interval)
self._last_text = None
示例6: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, *, win_id, private, parent=None):
if private:
assert not qtutils.is_single_process()
super().__init__(parent)
self.widget = tabwidget.TabWidget(win_id, parent=self)
self._win_id = win_id
self._tab_insert_idx_left = 0
self._tab_insert_idx_right = -1
self.shutting_down = False
self.widget.tabCloseRequested.connect(self.on_tab_close_requested)
self.widget.new_tab_requested.connect(
self.tabopen) # type: ignore[arg-type]
self.widget.currentChanged.connect(self._on_current_changed)
self.cur_fullscreen_requested.connect(self.widget.tabBar().maybe_hide)
self.widget.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-65223
if qtutils.version_check('5.10', compiled=False):
self.cur_load_finished.connect(self._leave_modes_on_load)
else:
self.cur_load_started.connect(self._leave_modes_on_load)
# This init is never used, it is immediately thrown away in the next
# line.
self._undo_stack = (
collections.deque()
) # type: typing.MutableSequence[typing.MutableSequence[UndoEntry]]
self._update_stack_size()
self._filter = signalfilter.SignalFilter(win_id, self)
self._now_focused = None
self.search_text = None
self.search_options = {} # type: typing.Mapping[str, typing.Any]
self._local_marks = {
} # type: typing.MutableMapping[QUrl, typing.MutableMapping[str, int]]
self._global_marks = {
} # type: typing.MutableMapping[str, typing.Tuple[int, QUrl]]
self.default_window_icon = self.widget.window().windowIcon()
self.is_private = private
self.tab_deque = TabDeque()
config.instance.changed.connect(self._on_config_changed)
quitter.instance.shutting_down.connect(self.shutdown)
示例7: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, acc, inertia=0.985):
super().__init__()
self.acc = acc
self.g_fps = self.acc.goal_framerate
self.fps = None
self.fps_inertia_max = None
self.fps_inertia_min = None
self.inertia = inertia
self.set_fps = False
self.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
self.indicator_color = (40, 230, 150)
self.indicator_shadow_color = (17, 147, 91)
self.error_indicator_color = (230, 40, 0)
self.error_indicator_shadow_color = (170, 30, 0)
示例8: newButton
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def newButton(self, icon):
button = QIconPushButton(self)
button.setFocusPolicy(Qt.NoFocus)
button.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Expanding)
button.setIcon(icon)
button.setIconSize(QSize(32, 32))
return button
示例9: init_layout
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [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)
示例10: init_scale
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def init_scale(self) -> None:
screen_size = qApp.desktop().availableGeometry(-1)
self.scale = 'LOW' if screen_size.width() <= 1024 else 'NORMAL'
self.setMinimumSize(self.get_size(self.scale))
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
示例11: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, app, parent=None):
super().__init__(parent)
self._app = app
self.setPlaceholderText('搜索歌曲、歌手、专辑、用户')
self.setToolTip('直接输入文字可以进行过滤,按 Enter 可以搜索\n'
'输入 >>> 前缀之后,可以执行 Python 代码\n'
'输入 # 前缀之后,可以过滤表格内容\n'
'输入 > 前缀可以执行 fuo 命令(未实现,欢迎 PR)')
self.setFont(QFontDatabase.systemFont(QFontDatabase.FixedFont))
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self.setFixedHeight(32)
self.setFrame(False)
self.setAttribute(Qt.WA_MacShowFocusRect, 0)
self.setTextMargins(5, 0, 0, 0)
self._timer = QTimer(self)
self._cmd_text = None
self._mode = 'cmd' # 详见 _set_mode 函数
self._timer.timeout.connect(self.__on_timeout)
self.textChanged.connect(self.__on_text_edited)
# self.textEdited.connect(self.__on_text_edited)
self.returnPressed.connect(self.__on_return_pressed)
self._app.hotkey_mgr.register(
[QKeySequence('Ctrl+F'), QKeySequence(':'), QKeySequence('Alt+x')],
self.setFocus
)
示例12: setCamera
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def setCamera( self, cameraDevice ):
self._cameraDevice = cameraDevice
self._cameraDevice.newFrame.connect( self._onNewFrame )
w, h = self._cameraDevice.frameSize
self.setMinimumSize(w, h)
self.setMaximumSize( 960, 1280)
#self.setSizePolicy( QSizePolicy.Fixed, QSizePolicy.Fixed )
self.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Expanding )
示例13: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
self.axes = fig.add_subplot(111)
FigureCanvas.__init__(self, fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
QSizePolicy.Expanding,
QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
self.plot()
示例14: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [as 别名]
def __init__(self):
self.fig = Figure()
FigureCanvas.__init__(self, self.fig)
FigureCanvas.setSizePolicy(self,
QSizePolicy.Expanding,
QSizePolicy.Expanding)
FigureCanvas.updateGeometry(self)
示例15: loadProperties
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Expanding [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()