當前位置: 首頁>>代碼示例>>Python>>正文


Python QSizePolicy.Fixed方法代碼示例

本文整理匯總了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) 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:22,代碼來源:downloadview.py

示例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) 
開發者ID:ozmartian,項目名稱:vidcutter,代碼行數:25,代碼來源:videosliderwidget.py

示例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 
開發者ID:iGio90,項目名稱:Dwarf,代碼行數:19,代碼來源:utils.py

示例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 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:36,代碼來源:completionwidget.py

示例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) 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:12,代碼來源:keyhintwidget.py

示例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() 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:9,代碼來源:progress.py

示例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) 
開發者ID:canard0328,項目名稱:malss,代碼行數:14,代碼來源:learning_curve_base.py

示例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 
開發者ID:Scille,項目名稱:parsec-cloud,代碼行數:34,代碼來源:switch_button.py

示例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
        ) 
開發者ID:feeluown,項目名稱:FeelUOwn,代碼行數:31,代碼來源:magicbox.py

示例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 ) 
開發者ID:jchrisweaver,項目名稱:vidpipe,代碼行數:11,代碼來源:CameraWidget.py

示例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) 
開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:44,代碼來源:bar.py


注:本文中的PyQt5.QtWidgets.QSizePolicy.Fixed方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。