Python PyQt5.QtWidgets.QSizePolicy.Fixed() Examples
The following are 11
code examples of PyQt5.QtWidgets.QSizePolicy.Fixed().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtWidgets.QSizePolicy
, or try the search function
.
Example #1
Source File: downloadview.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: videosliderwidget.py From vidcutter with GNU General Public License v3.0 | 6 votes |
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)
Example #3
Source File: utils.py From Dwarf with GNU General Public License v3.0 | 6 votes |
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
Example #4
Source File: completionwidget.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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
Example #5
Source File: keyhintwidget.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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)
Example #6
Source File: progress.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
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()
Example #7
Source File: learning_curve_base.py From malss with MIT License | 5 votes |
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)
Example #8
Source File: switch_button.py From parsec-cloud with GNU Affero General Public License v3.0 | 5 votes |
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
Example #9
Source File: magicbox.py From FeelUOwn with GNU General Public License v3.0 | 5 votes |
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 )
Example #10
Source File: CameraWidget.py From vidpipe with GNU General Public License v3.0 | 5 votes |
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 )
Example #11
Source File: bar.py From qutebrowser with GNU General Public License v3.0 | 1 votes |
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)