本文整理汇总了Python中PyQt5.QtWidgets.QSizePolicy.Fixed方法的典型用法代码示例。如果您正苦于以下问题:Python QSizePolicy.Fixed方法的具体用法?Python QSizePolicy.Fixed怎么用?Python QSizePolicy.Fixed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QSizePolicy
的用法示例。
在下文中一共展示了QSizePolicy.Fixed方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [as 别名]
def __init__(self, model, parent=None):
super().__init__(parent)
if not utils.is_mac:
self.setStyle(QStyleFactory.create('Fusion'))
stylesheet.set_register(self)
self.setResizeMode(QListView.Adjust)
self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
self.setFocusPolicy(Qt.NoFocus)
self.setFlow(QListView.LeftToRight)
self.setSpacing(1)
self._menu = None
model.rowsInserted.connect(functools.partial(update_geometry, self))
model.rowsRemoved.connect(functools.partial(update_geometry, self))
model.dataChanged.connect(functools.partial(update_geometry, self))
self.setModel(model)
self.setWrapping(True)
self.setContextMenuPolicy(Qt.CustomContextMenu)
self.customContextMenuRequested.connect(self.show_context_menu)
self.clicked.connect(self.on_clicked)
示例2: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [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: progress_dialog
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [as 别名]
def progress_dialog(message):
prgr_dialog = QProgressDialog()
prgr_dialog.setFixedSize(300, 50)
prgr_dialog.setAutoFillBackground(True)
prgr_dialog.setWindowModality(Qt.WindowModal)
prgr_dialog.setWindowTitle('Please wait')
prgr_dialog.setLabelText(message)
prgr_dialog.setSizeGripEnabled(False)
prgr_dialog.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
prgr_dialog.setWindowFlag(Qt.WindowContextHelpButtonHint, False)
prgr_dialog.setWindowFlag(Qt.WindowCloseButtonHint, False)
prgr_dialog.setModal(True)
prgr_dialog.setCancelButton(None)
prgr_dialog.setRange(0, 0)
prgr_dialog.setMinimumDuration(0)
prgr_dialog.setAutoClose(False)
return prgr_dialog
示例4: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [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 Fixed [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)
示例6: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
stylesheet.set_register(self)
self.enabled = False
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self.setTextVisible(False)
self.hide()
示例7: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [as 别名]
def __init__(self, x, y_train, y_cv, ylim, title, parent=None,
width=5, height=4, dpi=100):
self.fig = Figure(figsize=(width, height), dpi=dpi)
self.axes = self.fig.add_subplot(111)
FigureCanvas.__init__(self, self.fig)
self.setParent(parent)
FigureCanvas.setSizePolicy(self,
QSizePolicy.Fixed, QSizePolicy.Fixed)
FigureCanvas.updateGeometry(self)
self.plot(x, y_train, y_cv, ylim, title)
示例8: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [as 别名]
def __init__(self, parent=None, track_radius=10, thumb_radius=8):
super().__init__(parent=parent)
self.setCheckable(True)
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
self._track_radius = track_radius
self._thumb_radius = thumb_radius
self._margin = max(0, self._thumb_radius - self._track_radius)
self._base_offset = max(self._thumb_radius, self._track_radius)
self._end_offset = {
True: lambda: self.width() - self._base_offset,
False: lambda: self._base_offset,
}
self._offset = self._base_offset
palette = self.palette()
if self._thumb_radius > self._track_radius:
self._track_color = {True: palette.highlight(), False: palette.dark()}
self._thumb_color = {True: palette.highlight(), False: palette.light()}
self._text_color = {
True: palette.highlightedText().color(),
False: palette.dark().color(),
}
self._thumb_text = {True: "", False: ""}
self._track_opacity = 0.5
else:
self._thumb_color = {True: palette.highlightedText(), False: palette.light()}
self._track_color = {True: palette.highlight(), False: palette.dark()}
self._text_color = {True: palette.highlight().color(), False: palette.dark().color()}
self._thumb_text = {True: "✔", False: "✕"}
self._track_opacity = 1
示例9: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [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
)
示例10: setCamera
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [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 )
示例11: __init__
# 需要导入模块: from PyQt5.QtWidgets import QSizePolicy [as 别名]
# 或者: from PyQt5.QtWidgets.QSizePolicy import Fixed [as 别名]
def __init__(self, *, win_id, private, parent=None):
super().__init__(parent)
self.setObjectName(self.__class__.__name__)
self.setAttribute(Qt.WA_StyledBackground)
stylesheet.set_register(self)
self.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Fixed)
self._win_id = win_id
self._color_flags = ColorFlags()
self._color_flags.private = private
self._hbox = QHBoxLayout(self)
self._set_hbox_padding()
self._hbox.setSpacing(5)
self._stack = QStackedLayout()
self._hbox.addLayout(self._stack)
self._stack.setContentsMargins(0, 0, 0, 0)
self.cmd = command.Command(private=private, win_id=win_id)
self._stack.addWidget(self.cmd)
objreg.register('status-command', self.cmd, scope='window',
window=win_id)
self.txt = textwidget.Text()
self._stack.addWidget(self.txt)
self.cmd.show_cmd.connect(self._show_cmd_widget)
self.cmd.hide_cmd.connect(self._hide_cmd_widget)
self._hide_cmd_widget()
self.url = url.UrlText()
self.percentage = percentage.Percentage()
self.backforward = backforward.Backforward()
self.tabindex = tabindex.TabIndex()
self.keystring = keystring.KeyString()
self.prog = progress.Progress(self)
self._draw_widgets()
config.instance.changed.connect(self._on_config_changed)
QTimer.singleShot(0, self.maybe_hide)