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


Python QVBoxLayout.setContentsMargins方法代码示例

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


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

示例1: _close_group

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
    def _close_group(self, main_layout, group_name, group_layout):
        """Closes the the existing group, used during controls creation
        """
        debug_print('FormContainer._close_group close group', group_name)

        # The widget that holds this group's controls
        controls_widget = QWidget()
        controls_widget.setLayout(group_layout)

        if group_name:
            # Group controls start out hidden
            controls_widget.setVisible(False)

            # The group box, which contains the label to toggle the controls
            # and the controls themselves
            group_box_layout = QVBoxLayout()
            group_box_layout.addWidget(ToggleWidgetLabel(
                group_name, controls_widget, initially_visible=False
            ))
            group_box_layout.addWidget(controls_widget)
            group_box_layout.setContentsMargins(
                0,  # left
                0,  # top
                0,  # right
                0   # bottom
            )
            group_box = QGroupBox()
            group_box.setLayout(group_box_layout)

            # Add the group box to the main layout
            main_layout.addRow(group_box)
        else:
            # current group has no name and therefore no toggle group
            main_layout.addRow(controls_widget)
开发者ID:NaturalHistoryMuseum,项目名称:inselect,代码行数:36,代码来源:metadata.py

示例2: RightPanel_Container

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

        self.right_panel = RightPanel(self._app)
        self._layout = QVBoxLayout(self)
        self.setWidget(self.right_panel)

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

        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;
                border: 0px;
            }}
        '''.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)
开发者ID:leohazy,项目名称:FeelUOwn,代码行数:33,代码来源:ui.py

示例3: initMainUi

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
    def initMainUi(self):
        role_names = self.parentApplet.dataSelectionApplet.topLevelOperator.DatasetRoles.value
        self.list_widgets = []
        
        # Create a tab for each role
        for role_index, role_name in enumerate(role_names):
            select_button = QPushButton("Select " + role_name + " Files...", 
                                        clicked=partial(self.select_files, role_index) )
            clear_button = QPushButton("Clear " + role_name + " Files",
                                       clicked=partial(self.clear_files, role_index) )
            button_layout = QHBoxLayout()
            button_layout.addWidget(select_button)
            button_layout.addSpacerItem( QSpacerItem(0,0,hPolicy=QSizePolicy.Expanding) )
            button_layout.addWidget(clear_button)
            button_layout.setContentsMargins(0, 0, 0, 0)
            
            button_layout_widget = QWidget()
            button_layout_widget.setLayout(button_layout)
            button_layout_widget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) )

            list_widget = QListWidget(parent=self)
            list_widget.setSizePolicy( QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) )
            self.list_widgets.append( list_widget )

            tab_layout = QVBoxLayout()
            tab_layout.setContentsMargins(0, 0, 0, 0)
            tab_layout.addWidget( button_layout_widget )
            tab_layout.addWidget( list_widget )
            
            layout_widget = QWidget(parent=self)
            layout_widget.setLayout(tab_layout)
            self.addTab(layout_widget, role_name)
开发者ID:DerThorsten,项目名称:ilastik,代码行数:34,代码来源:batchProcessingGui.py

示例4: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [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

示例5: LP_PlaylistsPanel

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

        self.header = LP_GroupHeader(self._app, '歌单')
        self._layout = QVBoxLayout(self)
        self.setObjectName('lp_playlists_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 add_item(self, item):
        self._layout.addWidget(item)

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

        self._layout.addWidget(self.header)
开发者ID:leohazy,项目名称:FeelUOwn,代码行数:32,代码来源:ui.py

示例6: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
    def __init__(self, parent=None):
        super(MDIHistory, self).__init__(parent)
        self.setMinimumSize(QSize(300, 200))    
        self.setWindowTitle("PyQt5 editor test example") 

        lay = QVBoxLayout()
        lay.setContentsMargins(0,0,0,0)
        self.setLayout(lay)

        self.list = QListView()
        self.list.setEditTriggers(QListView.NoEditTriggers)
        self.list.activated.connect(self.activated)
        self.list.setAlternatingRowColors(True)
        self.list.selectionChanged = self.selectionChanged
        self.model = QStandardItemModel(self.list)


        self.MDILine = MDILine()
        self.MDILine.soft_keyboard = False
        self.MDILine.line_up = self.line_up
        self.MDILine.line_down = self.line_down

        # add widgets
        lay.addWidget(self.list)
        lay.addWidget(self.MDILine)
        self.reload()
开发者ID:lacquer,项目名称:linuxcnc,代码行数:28,代码来源:mdi_history.py

示例7: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [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

示例8: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
    def __init__(self, parent=None):
        super(CentralWidget, self).__init__(parent)
        self.parent = parent
        main_container = QHBoxLayout(self)
        main_container.setContentsMargins(0, 0, 0, 0)
        main_container.setSpacing(0)
        # This variables are used to save the spliiter sizes
        self.lateral_panel = LateralPanel()

        self._add_functions = {
            "central": self._insert_widget_inside,
            "lateral": self._insert_widget_base
        }
        self._items = {}

        # Toolbar
        self._toolbar = ntoolbar.NToolBar(self)
        main_container.addWidget(self._toolbar)

        # Create Splitters to divide the UI 3 regions
        self._splitter_base = dynamic_splitter.DynamicSplitter(Qt.Horizontal)
        self._splitter_inside = dynamic_splitter.DynamicSplitter(Qt.Vertical)
        self._splitter_base.addWidget(self._splitter_inside)

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

        vbox.addWidget(self._splitter_base)
        tools_dock = IDE.get_service("tools_dock")
        vbox.addWidget(tools_dock.buttons_widget)
        main_container.addLayout(vbox)
        # main_container.addWidget(self._splitter_base)
        IDE.register_service("central_container", self)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:36,代码来源:central_widget.py

示例9: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [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

示例10: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [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

示例11: Col_select

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
class Col_select(QWidget):
    """Drop down element to select columns after a quantity was selected"""

    def __init__(self, columns, parent=None):

        super().__init__(parent) 
        self.columns = columns
        self.checkboxes = []
        self.initUI()


    def initUI(self):  

        self.layout = QVBoxLayout()
        self.layout.setContentsMargins(30, 0, 0, 0)
        for column in self.columns:
            checkbox = QCheckBox()
            checkbox.setText(column)
            self.layout.addWidget(checkbox)
            self.checkboxes.append(checkbox)
        self.setLayout(self.layout) 

    def get_selected(self):
        
        return [col for col, checkbox in zip(self.columns, self.checkboxes)
                if checkbox.isChecked()]
开发者ID:philippHorn,项目名称:csv-plot,代码行数:28,代码来源:gui.py

示例12: RightWidget

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

        self.set_me()
        self.set_widgets_prop()
        self.set_layouts_prop()

    def set_me(self):
        self.setLayout(self.layout)

    def paintEvent(self, event):
        """
        self is derived from QWidget, Stylesheets don't work unless \
        paintEvent is reimplemented.y
        at the same time, if self is derived from QFrame, this isn't needed.
        """
        option = QStyleOption()
        option.initFrom(self)
        painter = QPainter(self)
        style = self.style()
        style.drawPrimitive(QStyle.PE_Widget, option, painter, self)

    def set_widgets_prop(self):
        self.webview.setObjectName("webview")

    def set_layouts_prop(self):
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.layout.setSpacing(0)

        self.layout.addWidget(self.webview)
开发者ID:Ericjxa,项目名称:FeelUOwn,代码行数:35,代码来源:right_widget.py

示例13: DocWindow

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
class DocWindow(QWidget):
    app = None

    def __init__(self, app):
        super(DocWindow, self).__init__()
        DocWindow.app = app
        self.vlayout  = QVBoxLayout()
        self.view     = DocView()
        self.backbtn  = QPushButton('Back')
        self.closebtn = QPushButton('Close')
        self.vlayout.setContentsMargins(1, 1, 1, 1)
        self.vlayout.setSpacing(1)
        self.vlayout.addWidget(self.view)
        hlayout = QHBoxLayout()
        buttonbox = QWidget()
        buttonbox.setLayout(hlayout)
        self.vlayout.addWidget(buttonbox)
        hlayout.addWidget(self.closebtn)
        hlayout.addWidget(self.backbtn)
        self.closebtn.clicked.connect(self.hide)
        self.backbtn.clicked.connect(self.view.back)
        self.setLayout(self.vlayout)
        self.setWindowTitle('BlueSky documentation')

    def show_cmd_doc(self, cmd):
        if not cmd:
            cmd = 'Command-Reference'
        self.view.load(QUrl.fromLocalFile(QFileInfo('data/html/' + cmd.lower() + '.html').absoluteFilePath()))
开发者ID:ProfHoekstra,项目名称:bluesky,代码行数:30,代码来源:docwindow.py

示例14: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
    def __init__(
        self, parent, node, target_node_id, file_server_widget, node_monitor, dynamic_node_id_allocator_widget
    ):
        super(NodePropertiesWindow, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)  # This is required to stop background timers!
        self.setWindowTitle("Node Properties [%d]" % target_node_id)
        self.setMinimumWidth(640)

        self._target_node_id = target_node_id
        self._node = node
        self._file_server_widget = file_server_widget

        self._info_box = InfoBox(self, target_node_id, node_monitor)
        self._controls = Controls(self, node, target_node_id, file_server_widget, dynamic_node_id_allocator_widget)
        self._config_params = ConfigParams(self, node, target_node_id)

        self._status_bar = QStatusBar(self)
        self._status_bar.setSizeGripEnabled(False)

        layout = QVBoxLayout(self)
        layout.addWidget(self._info_box)
        layout.addWidget(self._controls)
        layout.addWidget(self._config_params)
        layout.addWidget(self._status_bar)

        left, top, right, bottom = layout.getContentsMargins()
        bottom = 0
        layout.setContentsMargins(left, top, right, bottom)

        self.setLayout(layout)
开发者ID:UAVCAN,项目名称:gui_tool,代码行数:32,代码来源:node_properties.py

示例15: PluginUninstallDialog

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
class PluginUninstallDialog(QDialog):
    """
    Class for the dialog variant.
    """
    def __init__(self, pluginManager, parent=None):
        """
        Constructor
        
        @param pluginManager reference to the plugin manager object
        @param parent reference to the parent widget (QWidget)
        """
        super(PluginUninstallDialog, self).__init__(parent)
        self.setSizeGripEnabled(True)
        
        self.__layout = QVBoxLayout(self)
        self.__layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.__layout)
        
        self.cw = PluginUninstallWidget(pluginManager, self)
        size = self.cw.size()
        self.__layout.addWidget(self.cw)
        self.resize(size)
        self.setWindowTitle(self.cw.windowTitle())
        
        self.cw.buttonBox.accepted.connect(self.accept)
        self.cw.buttonBox.rejected.connect(self.reject)
开发者ID:Darriall,项目名称:eric,代码行数:28,代码来源:PluginUninstallDialog.py


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