当前位置: 首页>>代码示例>>Python>>正文


Python QVBoxLayout.setSpacing方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QVBoxLayout.setSpacing方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.setSpacing方法的具体用法?Python QVBoxLayout.setSpacing怎么用?Python QVBoxLayout.setSpacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QVBoxLayout的用法示例。


在下文中一共展示了QVBoxLayout.setSpacing方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_layout

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
    def _create_layout(self, main_window):
        """
        Create main layout of widget.
        """

        layout = QVBoxLayout()
        self.setLayout(layout)
        layout.setContentsMargins(30, 10, 30, 10)
        layout.setSpacing(0)

        l = QLabel(_(self.model.__table__.name))
        l.setObjectName('title')
        layout.addWidget(l)

        scrollable = QVBoxLayout()
        for row in self._get_rows(self.model, main_window):
            for w in row:
                scrollable.addWidget(w)

        scrollable = utils.get_scrollable(scrollable)

        controls_layout = self._get_controls_layout(layout)

        layout.addWidget(scrollable)
        layout.addLayout(controls_layout)

        self.show()
        self.raise_()
        self.move((main_window.width() - self.width()) / 2, (main_window.height() - self.height()) / 2)
开发者ID:aq1,项目名称:Hospital-Helper-2,代码行数:31,代码来源:crud_widget.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
    def __init__(self, parent=None):
        super(LocatorWidget, self).__init__(
            parent, Qt.Dialog | Qt.FramelessWindowHint)
        self._parent = parent
        self.setModal(True)
        self.setAttribute(Qt.WA_TranslucentBackground)
        self.setStyleSheet("background:transparent;")
        self.setFixedHeight(400)
        self.setFixedWidth(500)
        view = QQuickWidget()
        view.rootContext().setContextProperty("theme", resources.QML_COLORS)
        view.setResizeMode(QQuickWidget.SizeRootObjectToView)
        view.setSource(ui_tools.get_qml_resource("Locator.qml"))
        self._root = view.rootObject()
        vbox = QVBoxLayout(self)
        vbox.setContentsMargins(0, 0, 0, 0)
        vbox.setSpacing(0)
        vbox.addWidget(view)

        self.locate_symbols = locator.LocateSymbolsThread()
        self.locate_symbols.finished.connect(self._cleanup)
        # FIXME: invalid signal
        # self.locate_symbols.terminated.connect(self._cleanup)
        # Hide locator with Escape key
        shortEscMisc = QShortcut(QKeySequence(Qt.Key_Escape), self)
        shortEscMisc.activated.connect(self.hide)

        # Locator things
        self.filterPrefix = re.compile(r'(@|<|>|-|!|\.|/|:)')
        self.page_items_step = 10
        self._colors = {
            "@": "#5dade2",
            "<": "#4becc9",
            ">": "#ff555a",
            "-": "#66ff99",
            ".": "#a591c6",
            "/": "#f9d170",
            ":": "#18ffd6",
            "!": "#ff884d"}
        self._filters_list = [
            ("@", "Filename"),
            ("<", "Class"),
            (">", "Function"),
            ("-", "Attribute"),
            (".", "Current"),
            ("/", "Opened"),
            (":", "Line"),
            ("!", "NoPython")
        ]
        self._replace_symbol_type = {"<": "&lt;", ">": "&gt;"}
        self.reset_values()

        self._filter_actions = {
            '.': self._filter_this_file,
            '/': self._filter_tabs,
            ':': self._filter_lines
        }
        self._root.textChanged['QString'].connect(self.set_prefix)
        self._root.open['QString', int].connect(self._open_item)
        self._root.fetchMore.connect(self._fetch_more)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:62,代码来源:locator_widget.py

示例3: LeftPanel

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class LeftPanel(FFrame):
    def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app

        self.library_panel = LP_LibraryPanel(self._app)
        self.playlists_panel = LP_PlaylistsPanel(self._app)

        self._layout = QVBoxLayout(self)
        self.setLayout(self._layout)
        self.setObjectName('c_left_panel')
        self.set_theme_style()
        self.setup_ui()

    def set_theme_style(self):
        theme = self._app.theme_manager.current_theme
        style_str = '''
            #{0} {{
                background: transparent;
            }}
        '''.format(self.objectName(),
                   theme.color5.name())
        self.setStyleSheet(style_str)

    def setup_ui(self):
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)

        self._layout.addWidget(self.library_panel)
        self._layout.addWidget(self.playlists_panel)
        self._layout.addStretch(1)
开发者ID:leohazy,项目名称:FeelUOwn,代码行数:33,代码来源:ui.py

示例4: nestWidget

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
 def nestWidget(parent, child):
     l = QVBoxLayout()
     l.setContentsMargins(0,0,0,0)
     l.setSpacing(0)
     parent.setLayout(l)
     parent.layout().addWidget(child)
     return child
开发者ID:GuLinux,项目名称:PySpectrum,代码行数:9,代码来源:qtcommons.py

示例5: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
 def __init__(self, parent, name):
     QWidget.__init__(self, parent)
     self.setStyleSheet(get_stylesheet("ribbonPane"))
     horizontal_layout = QHBoxLayout()
     horizontal_layout.setSpacing(0)
     horizontal_layout.setContentsMargins(0, 0, 0, 0)
     self.setLayout(horizontal_layout)
     vertical_widget = QWidget(self)
     horizontal_layout.addWidget(vertical_widget)
     horizontal_layout.addWidget(RibbonSeparator(self))
     vertical_layout = QVBoxLayout()
     vertical_layout.setSpacing(0)
     vertical_layout.setContentsMargins(0, 0, 0, 0)
     vertical_widget.setLayout(vertical_layout)
     label = QLabel(name)
     label.setAlignment(Qt.AlignCenter)
     label.setStyleSheet("color:#666;")
     content_widget = QWidget(self)
     vertical_layout.addWidget(content_widget)
     vertical_layout.addWidget(label)
     content_layout = QHBoxLayout()
     content_layout.setAlignment(Qt.AlignLeft)
     content_layout.setSpacing(0)
     content_layout.setContentsMargins(0, 0, 0, 0)
     self.contentLayout = content_layout
     content_widget.setLayout(content_layout)
开发者ID:pracedru,项目名称:pyDesign,代码行数:28,代码来源:RibbonPane.py

示例6: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
    def __init__(self, parent=None):
        super(QueryContainer, self).__init__(parent)
        self._parent = parent
        box = QVBoxLayout(self)
        self.setObjectName("query_container")
        box.setContentsMargins(0, 0, 0, 0)
        box.setSpacing(0)
        # Regex for validate variable name
        self.__validName = re.compile(r'^[a-z_]\w*$')

        self.__nquery = 1

        # Tab
        self._tabs = tab_widget.TabWidget()
        self._tabs.tabBar().setObjectName("tab_query")
        self._tabs.setAutoFillBackground(True)
        p = self._tabs.palette()
        p.setColor(p.Window, Qt.white)
        self._tabs.setPalette(p)
        box.addWidget(self._tabs)

        self.relations = {}

        self.__hide()

        # Connections
        self._tabs.tabCloseRequested.connect(self.__hide)
        self._tabs.saveEditor['PyQt_PyObject'].connect(
            self.__on_save_editor)
开发者ID:yoshitomimaehara,项目名称:pireal,代码行数:31,代码来源:query_container.py

示例7: EditorWidget

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class EditorWidget(QFrame):
    def __init__(self, parent=None, text=None, EditorSidebarClass=EditorSidebar, EditorViewClass=EditorView):
        QFrame.__init__(self, parent)
        self.view = EditorViewClass(self, text)
        self.sidebar = EditorSidebarClass(self)
        self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken)
        self.setLineWidth(2)
        self.vlayout = QVBoxLayout()
        self.vlayout.setSpacing(0)
        self.setLayout(self.vlayout)
        self.hlayout = QHBoxLayout()
        self.vlayout.addLayout(self.hlayout)
        self.hlayout.addWidget(self.sidebar)
        self.hlayout.addWidget(self.view)
        self.vlayout.setContentsMargins(2, 2, 2, 2)

    def setPlainText(self, text):
        self.view.document().setPlainText(text)
        self.view.setModified(False)

    def isModified(self):
        return self.view.document().isModified()

    def toPlainText(self):
        return unicode(self.view.document().toPlainText())

    def setModified(self, flag):
        self.view.document().setModified(flag)
开发者ID:QuLogic,项目名称:scribus-plugin-scripter,代码行数:30,代码来源:widget.py

示例8: LeftPanelContainer

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class LeftPanelContainer(MScrollArea):
    def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app

        self.left_panel = LeftPanel(self._app)
        self._layout = QVBoxLayout(self)  # no layout, no children
        self.setWidget(self.left_panel)  # set Widget connect to self(self is ScrollArea)

        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setWidgetResizable(True)  # Widget can resize

        self.setObjectName('c_left_panel_container')
        self.set_theme_style()
        self.setMinimumWidth(180)
        self.setMaximumWidth(221)

        self.setup_ui()

    def set_theme_style(self):
        theme = self._app.theme_manager.current_theme
        style_str = '''
            #{0} {{
                background: transparent;
                border: 0px;
                border-right: 3px inset {1};
            }}
        '''.format(self.objectName(),
                   theme.color0_light.name())
        self.setStyleSheet(style_str)

    def setup_ui(self):
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
开发者ID:zltningx,项目名称:music-player,代码行数:37,代码来源:MusicBox_UI.py

示例9: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
    def __init__(self, font, *args):
        QWidget.__init__(self, *args)
        self._browser = QTextEdit(self)
        self._browser.setReadOnly(True)
        document = self._browser.document()
        document.setDefaultStyleSheet(document.defaultStyleSheet() +
                                      "span {white-space:pre;}")

        self._browser.setFont(font)
        self._edit = _TextEdit(self, font)

        lowLevelWidget = self._edit.focusProxy()
        if lowLevelWidget is None:
            lowLevelWidget = self._edit
        lowLevelWidget.installEventFilter(self)

        self._edit.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
        self.setFocusProxy(self._edit)

        layout = QVBoxLayout(self)
        layout.setSpacing(0)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.addWidget(self._browser)
        layout.addWidget(self._edit)

        self._history = ['']  # current empty line
        self._historyIndex = 0

        self._edit.setFocus()
开发者ID:freason,项目名称:enki,代码行数:31,代码来源:termwidget.py

示例10: PlaylistCenterPanelContainer

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class PlaylistCenterPanelContainer(MScrollArea):
    def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app
        self.check_group = MyCheckBox(self._app)

        self.setObjectName('pc_container')
        self._layout = QVBoxLayout(self)
        self.setWidget(self.check_group)

        self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
        self.setWidgetResizable(True)

        self.set_theme_style()
        self.setup_ui()

    def set_theme_style(self):
        theme = self._app.theme_manager.current_theme
        style_str = '''
            #{0} {{
                background: {1};
            }}
        '''.format(self.objectName(),
                   theme.color0_light.name())
        self.setStyleSheet(style_str)

    def setup_ui(self):
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
开发者ID:zltningx,项目名称:music-player,代码行数:32,代码来源:UI.py

示例11: SongsTable_Container

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class SongsTable_Container(FFrame):
    def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app

        self.songs_table = None
        self.table_control = TableControl(self._app)
        self._layout = QVBoxLayout(self)
        self.setup_ui()

    def setup_ui(self):
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)

        self._layout.addWidget(self.table_control)

    def set_table(self, songs_table):
        if self.songs_table:
            self._layout.replaceWidget(self.songs_table, songs_table)
            self.songs_table.close()
            del self.songs_table
        else:
            self._layout.addWidget(songs_table)
            self._layout.addSpacing(10)
        self.songs_table = songs_table
开发者ID:yiranjianning,项目名称:FeelUOwn,代码行数:27,代码来源:ui.py

示例12: MyCheckBox

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class MyCheckBox(MFrame):
    def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app

        # self.header = MLabel("请选择歌曲并确认", self._app)
        self._layout = QVBoxLayout(self)
        self.setLayout(self._layout)

        self.set_theme_style()
        self.setObjectName("my_checkbox")
        self.setup_ui()

    def set_theme_style(self):
        theme = self._app.theme_manager.current_theme
        style_str = '''
            #{0} {{
                background: {1};
            }}
        '''.format(self.objectName(),
                   theme.color0_light.name())
        self.setStyleSheet(style_str)

    def setup_ui(self):
        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)

        # self._layout.addWidget(self.header)
        self._layout.addStretch(1)

    def add_item(self, checkbox):
        self._layout.addWidget(checkbox)
开发者ID:zltningx,项目名称:music-player,代码行数:34,代码来源:UI.py

示例13: LoginDialog

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class LoginDialog(MDialog):
    def __init__(self, app, parent=None):
        super().__init__(parent)
        self._app = app

        self.username_input = LineInput(self)
        self.password_input = LineInput(self)
        self.password_input.setEchoMode(MQLineEdit.Password)
        self.login_btn = MButton('登录', self)
        self.register_btn = MButton('注册', self)
        self._login_frame = MFrame()
        self._login_layout = QHBoxLayout(self._login_frame)
        self._layout = QVBoxLayout(self)

        self.username_input.setPlaceholderText('用户名或管理员backdoor登录')
        self.password_input.setPlaceholderText('密码')

        self.setObjectName('login_dialog')
        self.set_theme_style()
        self.setup_ui()

    def setup_ui(self):
        self.setFixedWidth(200)

        self._login_layout.setContentsMargins(0, 0, 0, 0)
        self._login_layout.setSpacing(1)
        self._login_layout.addWidget(self.login_btn)
        self._login_layout.addWidget(self.register_btn)

        self._layout.setContentsMargins(0, 0, 0, 0)
        self._layout.setSpacing(0)
        self._layout.addWidget(self.username_input)
        self._layout.addWidget(self.password_input)
        self._layout.addWidget(self._login_frame)
开发者ID:zltningx,项目名称:music-player,代码行数:36,代码来源:UI.py

示例14: CoverArtBox

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
class CoverArtBox(QWidget):
    def __init__(self, parent=None):
        super(CoverArtBox, self).__init__(parent)
        self._renderUI()

    def _renderUI(self):
        self.layout = QVBoxLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)

        defaultAlbumCover = QtGui.QPixmap(':/left_sidebar_icons/default_album_cover.png')

        self.coverArt = CoverArt()
        self.coverArt.setPixmap(defaultAlbumCover)
        self.coverArt.setFrameShape(QFrame.Box)
        self.coverArt.setAlignment(Qt.AlignHCenter)
        self.coverArt.setSizePolicy(QSizePolicy.MinimumExpanding,
                                    QSizePolicy.MinimumExpanding)

        self.infoLabel = InformationLabel()
        self.coverArt.setSizePolicy(QSizePolicy.MinimumExpanding,
                                    QSizePolicy.Fixed)

        self.layout.addWidget(self.coverArt)
        self.layout.addWidget(self.infoLabel, 0, Qt.AlignBottom)

        self.setLayout(self.layout)

    @QtCore.pyqtSlot(str, str, bytes)
    def setCoverArtBox(self, title, artist, coverArt):
        self.coverArt.setCoverArt(coverArt)
        self.infoLabel.setInformation(title, artist)
开发者ID:gdankov,项目名称:sonance-music-player,代码行数:34,代码来源:cover_art_display.py

示例15: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setSpacing [as 别名]
    def __init__(self, main_window, items):
        super().__init__()

        vbox = QVBoxLayout()
        vbox.setSpacing(0)
        vbox.setContentsMargins(0, 0, 0, 0)
        self.setLayout(vbox)

        top_system_buttons = TopSystemButtons(main_window)
        vbox.addWidget(top_system_buttons)
        vbox.addStretch()
        hbox = QHBoxLayout()
        hbox.addSpacing(25)
        hbox.setSpacing(0)
        hbox.setContentsMargins(0, 0, 0, 0)
        vbox.addLayout(hbox)

        l = QLabel()
        hbox.addWidget(l)
        vbox.addStretch()
        vbox.addWidget(SelectMenu(main_window, items))

        main_window.communication.input_changed_signal.connect(l.setText)
        self.resizeEvent = functools.partial(main_window.resized, self,
                                             top_system_buttons)

        self.setGraphicsEffect(utils.get_shadow())
开发者ID:aq1,项目名称:Hospital-Helper-2,代码行数:29,代码来源:top_frame.py


注:本文中的PyQt5.QtWidgets.QVBoxLayout.setSpacing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。