本文整理汇总了Python中AnyQt.QtWidgets.QVBoxLayout.setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.setContentsMargins方法的具体用法?Python QVBoxLayout.setContentsMargins怎么用?Python QVBoxLayout.setContentsMargins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.setContentsMargins方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __setupUi(self):
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
view = QTreeView(objectName="tool-tree-view")
view.setUniformRowHeights(True)
view.setFrameStyle(QTreeView.NoFrame)
view.setModel(self.__model)
view.setRootIsDecorated(False)
view.setHeaderHidden(True)
view.setItemsExpandable(True)
view.setEditTriggers(QTreeView.NoEditTriggers)
view.setItemDelegate(ToolTreeItemDelegate(self))
view.activated.connect(self.__onActivated)
view.clicked.connect(self.__onActivated)
view.entered.connect(self.__onEntered)
view.installEventFilter(self)
self.__view = view
layout.addWidget(view)
self.setLayout(layout)
示例2: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __setupUi(self):
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.toolbox = WidgetToolBox()
self.help = QuickHelpWidget(objectName="quick-help")
self.__splitter = QSplitter()
self.__splitter.setOrientation(Qt.Vertical)
self.__splitter.addWidget(self.toolbox)
self.__splitter.addWidget(self.help)
self.toolbar = DynamicResizeToolBar()
self.toolbar.setMovable(False)
self.toolbar.setFloatable(False)
self.toolbar.setSizePolicy(QSizePolicy.Ignored,
QSizePolicy.Preferred)
layout.addWidget(self.__splitter, 10)
layout.addWidget(self.toolbar)
self.setLayout(layout)
self.__splitterResizer = SplitterResizer(self)
self.__splitterResizer.setSplitterAndWidget(self.__splitter, self.help)
示例3: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent=None, **kwargs):
super().__init__(parent, **kwargs)
self.setWindowFlags(self.windowFlags() | Qt.Popup)
layout = QVBoxLayout()
layout.setContentsMargins(6, 6, 6, 6)
self.__menu = MenuPage()
self.__menu.setActionRole(QtWidgetRegistry.WIDGET_ACTION_ROLE)
if sys.platform == "darwin":
self.__menu.view().setAttribute(Qt.WA_MacShowFocusRect, False)
self.__menu.triggered.connect(self.__onTriggered)
self.__menu.hovered.connect(self.hovered)
self.__dragListener = ItemViewDragStartEventListener(self)
self.__dragListener.dragStarted.connect(self.__onDragStarted)
self.__menu.view().viewport().installEventFilter(self.__dragListener)
layout.addWidget(self.__menu)
self.setLayout(layout)
self.__action = None
self.__loop = None
self.__item = None
示例4: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent):
QFrame.__init__(self, parent)
self.setContentsMargins(0, 0, 0, 0)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(1)
self._setNameLineEdit = QLineEdit(self)
layout.addWidget(self._setNameLineEdit)
self._setListView = QListView(self)
self._listModel = QStandardItemModel(self)
self._proxyModel = QSortFilterProxyModel(self)
self._proxyModel.setSourceModel(self._listModel)
self._setListView.setModel(self._proxyModel)
self._setListView.setItemDelegate(ListItemDelegate(self))
self._setNameLineEdit.textChanged.connect(
self._proxyModel.setFilterFixedString)
self._completer = QCompleter(self._listModel, self)
self._setNameLineEdit.setCompleter(self._completer)
self._listModel.itemChanged.connect(self._onSetNameChange)
layout.addWidget(self._setListView)
buttonLayout = QHBoxLayout()
self._addAction = QAction(
"+", self, toolTip="Add a new sort key")
self._updateAction = QAction(
"Update", self, toolTip="Update/save current selection")
self._removeAction = QAction(
"\u2212", self, toolTip="Remove selected sort key.")
self._addToolButton = QToolButton(self)
self._updateToolButton = QToolButton(self)
self._removeToolButton = QToolButton(self)
self._updateToolButton.setSizePolicy(
QSizePolicy.MinimumExpanding, QSizePolicy.Minimum)
self._addToolButton.setDefaultAction(self._addAction)
self._updateToolButton.setDefaultAction(self._updateAction)
self._removeToolButton.setDefaultAction(self._removeAction)
buttonLayout.addWidget(self._addToolButton)
buttonLayout.addWidget(self._updateToolButton)
buttonLayout.addWidget(self._removeToolButton)
layout.addLayout(buttonLayout)
self.setLayout(layout)
self._addAction.triggered.connect(self.addCurrentSelection)
self._updateAction.triggered.connect(self.updateSelectedSelection)
self._removeAction.triggered.connect(self.removeSelectedSelection)
self._setListView.selectionModel().selectionChanged.connect(
self._onListViewSelectionChanged)
self.selectionModel = None
self._selections = []
示例5: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent=None, **kwargs):
QWidget.__init__(self, parent, **kwargs)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.setLayout(layout)
self.setSizePolicy(QSizePolicy.Fixed,
QSizePolicy.Expanding)
self.__tabs = []
self.__currentIndex = -1
self.__changeOnHover = False
self.__iconSize = QSize(26, 26)
self.__group = QButtonGroup(self, exclusive=True)
self.__group.buttonPressed[QAbstractButton].connect(
self.__onButtonPressed
)
self.setMouseTracking(True)
self.__sloppyButton = None
self.__sloppyRegion = QRegion()
self.__sloppyTimer = QTimer(self, singleShot=True)
self.__sloppyTimer.timeout.connect(self.__onSloppyTimeout)
示例6: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __setupUi(self):
vlayout = QVBoxLayout()
vlayout.setContentsMargins(0, 0, 0, 0)
top_layout = QVBoxLayout(objectName="top-layout")
margin = self.__margin
top_layout.setContentsMargins(margin, margin, margin, margin)
# Optional heading label
self.__heading = QLabel(
self, objectName="heading", visible=False
)
# Horizontal row with full text description and a large preview
# image.
hlayout = QHBoxLayout()
hlayout.setContentsMargins(0, 0, 0, 0)
self.__label = QLabel(
self, objectName="description-label",
wordWrap=True, alignment=Qt.AlignTop | Qt.AlignLeft
)
self.__label.setWordWrap(True)
self.__label.setFixedSize(220, PREVIEW_SIZE[1])
self.__label.setMinimumWidth(PREVIEW_SIZE[0] // 2)
self.__label.setMaximumHeight(PREVIEW_SIZE[1])
self.__image = QSvgWidget(self, objectName="preview-image")
self.__image.setFixedSize(*PREVIEW_SIZE)
self.__imageFrame = DropShadowFrame(self)
self.__imageFrame.setWidget(self.__image)
hlayout.addWidget(self.__label)
hlayout.addWidget(self.__image)
# Path text below the description and image
path_layout = QHBoxLayout()
path_layout.setContentsMargins(0, 0, 0, 0)
path_label = QLabel("<b>{0!s}</b>".format(self.tr("Path:")), self,
objectName="path-label")
self.__path = TextLabel(self, objectName="path-text")
path_layout.addWidget(path_label)
path_layout.addWidget(self.__path)
top_layout.addWidget(self.__heading)
top_layout.addLayout(hlayout)
top_layout.addLayout(path_layout)
vlayout.addLayout(top_layout)
# An list view with small preview icons.
self.__previewList = LinearIconView(
objectName="preview-list-view",
wordWrap=True
)
self.__previewList.doubleClicked.connect(self.__onDoubleClicked)
vlayout.addWidget(self.__previewList)
self.setLayout(vlayout)
示例7: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, master):
QWidget.__init__(self)
gui.OWComponent.__init__(self, master)
self.master = master
self.preprocessor = master.preprocessor
self.value = getattr(self.preprocessor, self.attribute)
# Title bar.
title_holder = QWidget()
title_holder.setSizePolicy(QSizePolicy.MinimumExpanding,
QSizePolicy.Fixed)
title_holder.setStyleSheet("""
.QWidget {
background: qlineargradient( x1:0 y1:0, x2:0 y2:1,
stop:0 #F8F8F8, stop:1 #C8C8C8);
border-bottom: 1px solid #B3B3B3;
}
""")
self.titleArea = QHBoxLayout()
self.titleArea.setContentsMargins(10, 5, 10, 5)
self.titleArea.setSpacing(0)
title_holder.setLayout(self.titleArea)
self.title_label = QLabel(self.title)
self.title_label.mouseDoubleClickEvent = self.on_toggle
self.title_label.setStyleSheet('font-size: 12px; border: 2px solid red;')
self.titleArea.addWidget(self.title_label)
self.off_label = QLabel('[disabled]')
self.off_label.setStyleSheet('color: #B0B0B0; margin-left: 5px;')
self.titleArea.addWidget(self.off_label)
self.off_label.hide()
self.titleArea.addStretch()
# Root.
self.rootArea = QVBoxLayout()
self.rootArea.setContentsMargins(0, 0, 0, 0)
self.rootArea.setSpacing(0)
self.setLayout(self.rootArea)
self.rootArea.addWidget(title_holder)
self.contents = QWidget()
contentArea = QVBoxLayout()
contentArea.setContentsMargins(15, 10, 15, 10)
self.contents.setLayout(contentArea)
self.rootArea.addWidget(self.contents)
self.method_layout = self.Layout()
self.setup_method_layout()
self.contents.layout().addLayout(self.method_layout)
if self.toggle_enabled:
self.on_off_button = OnOffButton(enabled=self.enabled)
self.on_off_button.stateChanged.connect(self.on_toggle)
self.on_off_button.setContentsMargins(0, 0, 0, 0)
self.titleArea.addWidget(self.on_off_button)
self.display_widget(update_master_width=False)
示例8: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __setupUi(self):
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.editor = SchemeInfoEdit(self)
self.editor.layout().setContentsMargins(20, 20, 20, 20)
self.editor.layout().setSpacing(15)
self.editor.setSizePolicy(QSizePolicy.MinimumExpanding,
QSizePolicy.MinimumExpanding)
heading = self.tr("Workflow Info")
heading = "<h3>{0}</h3>".format(heading)
self.heading = QLabel(heading, self, objectName="heading")
# Insert heading
self.editor.layout().insertRow(0, self.heading)
self.buttonbox = QDialogButtonBox(
QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
Qt.Horizontal,
self
)
# Insert button box
self.editor.layout().addRow(self.buttonbox)
widget = StyledWidget(self, objectName="auto-show-container")
check_layout = QHBoxLayout()
check_layout.setContentsMargins(20, 10, 20, 10)
self.__showAtNewSchemeCheck = \
QCheckBox(self.tr("Show when I make a New Workflow."),
self,
objectName="auto-show-check",
checked=False,
)
check_layout.addWidget(self.__showAtNewSchemeCheck)
check_layout.addWidget(
QLabel(self.tr("You can also edit Workflow Info later "
"(File -> Workflow Info)."),
self,
objectName="auto-show-info"),
alignment=Qt.AlignRight)
widget.setLayout(check_layout)
widget.setSizePolicy(QSizePolicy.MinimumExpanding,
QSizePolicy.Fixed)
if self.__autoCommit:
self.buttonbox.accepted.connect(self.editor.commit)
self.buttonbox.accepted.connect(self.accept)
self.buttonbox.rejected.connect(self.reject)
layout.addWidget(self.editor, stretch=10)
layout.addWidget(widget)
self.setLayout(layout)
示例9: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __setupUi(self):
self.setLayout(QVBoxLayout(self))
self.layout().setContentsMargins(6, 6, 6, 6)
self.__search = SearchWidget(self, objectName="search-line")
self.__search.setPlaceholderText(
self.tr("Search for widget or select from the list.")
)
self.layout().addWidget(self.__search)
self.__frame = QFrame(self, objectName="menu-frame")
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
self.__frame.setLayout(layout)
self.layout().addWidget(self.__frame)
self.__pages = PagedMenu(self, objectName="paged-menu")
self.__pages.currentChanged.connect(self.setCurrentIndex)
self.__pages.triggered.connect(self.triggered)
self.__pages.hovered.connect(self.hovered)
self.__frame.layout().addWidget(self.__pages)
self.setSizePolicy(QSizePolicy.Fixed,
QSizePolicy.Expanding)
self.__suggestPage = SuggestMenuPage(self, objectName="suggest-page")
self.__suggestPage.setActionRole(QtWidgetRegistry.WIDGET_ACTION_ROLE)
self.__suggestPage.setIcon(icon_loader().get("icons/Search.svg"))
if sys.platform == "darwin":
view = self.__suggestPage.view()
view.verticalScrollBar().setAttribute(Qt.WA_MacMiniSize, True)
# Don't show the focus frame because it expands into the tab bar.
view.setAttribute(Qt.WA_MacShowFocusRect, False)
i = self.addPage(self.tr("Quick Search"), self.__suggestPage)
button = self.__pages.tabButton(i)
button.setObjectName("search-tab-button")
button.setStyleSheet(
"TabButton {\n"
" qproperty-flat_: false;\n"
" border: none;"
"}\n")
self.__search.textEdited.connect(self.__on_textEdited)
self.__navigator = ItemViewKeyNavigator(self)
self.__navigator.setView(self.__suggestPage.view())
self.__search.installEventFilter(self.__navigator)
self.__grip = WindowSizeGrip(self)
self.__grip.raise_()
示例10: _setup_gui_labels
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def _setup_gui_labels(self):
vlayout = QVBoxLayout()
vlayout.setContentsMargins(0, 0, 0, 0)
vlayout.setSpacing(1)
self.labels_edit = QTreeView()
self.labels_edit.setEditTriggers(QTreeView.CurrentChanged)
self.labels_edit.setRootIsDecorated(False)
self.labels_model = DictItemsModel()
self.labels_edit.setModel(self.labels_model)
self.labels_edit.selectionModel().selectionChanged.connect(
self.on_label_selection_changed)
# Necessary signals to know when the labels change
self.labels_model.dataChanged.connect(self.on_labels_changed)
self.labels_model.rowsInserted.connect(self.on_labels_changed)
self.labels_model.rowsRemoved.connect(self.on_labels_changed)
vlayout.addWidget(self.labels_edit)
hlayout = QHBoxLayout()
hlayout.setContentsMargins(0, 0, 0, 0)
hlayout.setSpacing(1)
self.add_label_action = QAction(
"+", self,
toolTip="Add a new label.",
triggered=self.on_add_label,
enabled=False,
shortcut=QKeySequence(QKeySequence.New))
self.remove_label_action = QAction(
unicodedata.lookup("MINUS SIGN"), self,
toolTip="Remove selected label.",
triggered=self.on_remove_label,
enabled=False,
shortcut=QKeySequence(QKeySequence.Delete))
button_size = gui.toolButtonSizeHint()
button_size = QSize(button_size, button_size)
button = QToolButton(self)
button.setFixedSize(button_size)
button.setDefaultAction(self.add_label_action)
hlayout.addWidget(button)
button = QToolButton(self)
button.setFixedSize(button_size)
button.setDefaultAction(self.remove_label_action)
hlayout.addWidget(button)
hlayout.addStretch(10)
vlayout.addLayout(hlayout)
self.main_form.addRow("Labels:", vlayout)
示例11: main
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def main(argv=None): # pragma: no cover
from AnyQt.QtWidgets import QVBoxLayout, QCheckBox, QStatusBar
app = QApplication(list(argv) if argv else [])
l1 = QVBoxLayout()
l1.setContentsMargins(0, 0, 0, 0)
blayout = QVBoxLayout()
l1.addLayout(blayout)
sb = QStatusBar()
w = QWidget()
w.setLayout(l1)
messages = [
Message(Severity.Error, text="Encountered a HCF",
detailedText="<em>AAA! It burns.</em>",
textFormat=Qt.RichText),
Message(Severity.Warning,
text="ACHTUNG!",
detailedText=(
"<div style=\"color: red\">DAS KOMPUTERMASCHINE IST "
"NICHT FÜR DER GEFINGERPOKEN</div>"
),
textFormat=Qt.RichText),
Message(Severity.Information,
text="The rain in spain falls mostly on the plain",
informativeText=(
"<a href=\"https://www.google.si/search?q="
"Average+Yearly+Precipitation+in+Spain\">Link</a>"
),
textFormat=Qt.RichText),
Message(Severity.Error,
text="I did not do this!",
informativeText="The computer made suggestions...",
detailedText="... and the default options was yes."),
Message(),
]
mw = MessagesWidget(openExternalLinks=True)
for i, m in enumerate(messages):
cb = QCheckBox(m.text)
def toogled(state, i=i, m=m):
if state:
mw.setMessage(i, m)
else:
mw.removeMessage(i)
cb.toggled[bool].connect(toogled)
blayout.addWidget(cb)
sb.addWidget(mw)
w.layout().addWidget(sb, 0)
w.show()
return app.exec_()
示例12: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __setupUi(self):
vlayout = QVBoxLayout()
vlayout.setContentsMargins(0, 0, 0, 0)
top_layout = QHBoxLayout()
top_layout.setContentsMargins(12, 12, 12, 12)
# Top row with full text description and a large preview
# image.
self.__label = QLabel(self, objectName="description-label",
wordWrap=True,
alignment=Qt.AlignTop | Qt.AlignLeft)
self.__label.setWordWrap(True)
self.__label.setFixedSize(220, PREVIEW_SIZE[1])
self.__image = QSvgWidget(self, objectName="preview-image")
self.__image.setFixedSize(*PREVIEW_SIZE)
self.__imageFrame = DropShadowFrame(self)
self.__imageFrame.setWidget(self.__image)
# Path text below the description and image
path_layout = QHBoxLayout()
path_layout.setContentsMargins(12, 0, 12, 0)
path_label = QLabel("<b>{0!s}</b>".format(self.tr("Path:")), self,
objectName="path-label")
self.__path = TextLabel(self, objectName="path-text")
path_layout.addWidget(path_label)
path_layout.addWidget(self.__path)
self.__selectAction = \
QAction(self.tr("Select"), self,
objectName="select-action",
)
top_layout.addWidget(self.__label, 1,
alignment=Qt.AlignTop | Qt.AlignLeft)
top_layout.addWidget(self.__image, 1,
alignment=Qt.AlignTop | Qt.AlignRight)
vlayout.addLayout(top_layout)
vlayout.addLayout(path_layout)
# An list view with small preview icons.
self.__previewList = LinearIconView(objectName="preview-list-view")
self.__previewList.doubleClicked.connect(self.__onDoubleClicked)
vlayout.addWidget(self.__previewList)
self.setLayout(vlayout)
示例13: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent=None):
super().__init__(parent)
self.corpus = None
self.initial_ngram_range = None # initial range of input corpus — used for inplace
self.preprocessor = preprocess.Preprocessor()
# -- INFO --
info_box = gui.widgetBox(self.controlArea, 'Info')
info_box.setFixedWidth(self.control_area_width)
self.controlArea.layout().addStretch()
self.info_label = gui.label(info_box, self, '')
self.update_info()
# -- PIPELINE --
frame = QFrame()
frame.setContentsMargins(0, 0, 0, 0)
frame.setFrameStyle(QFrame.Box)
frame.setStyleSheet('.QFrame { border: 1px solid #B3B3B3; }')
frame_layout = QVBoxLayout()
frame_layout.setContentsMargins(0, 0, 0, 0)
frame_layout.setSpacing(0)
frame.setLayout(frame_layout)
self.stages = []
for stage in self.preprocessors:
widget = stage(self)
self.stages.append(widget)
setattr(self, stage.attribute, widget)
frame_layout.addWidget(widget)
widget.change_signal.connect(self.settings_invalidated)
frame_layout.addStretch()
self.scroll = QScrollArea()
self.scroll.setWidget(frame)
self.scroll.setWidgetResizable(True)
self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.scroll.resize(frame_layout.sizeHint())
self.scroll.setMinimumHeight(500)
self.set_minimal_width()
self.mainArea.layout().addWidget(self.scroll)
# Buttons area
self.report_button.setFixedWidth(self.control_area_width)
commit_button = gui.auto_commit(self.buttonsArea, self, 'autocommit',
'Commit', box=False)
commit_button.setFixedWidth(self.control_area_width - 5)
self.buttonsArea.layout().addWidget(commit_button)
示例14: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __setupUi(self):
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
self.setContentsMargins(0, 0, 0, 0)
heading = self.tr("Preview")
heading = "<h3>{0}</h3>".format(heading)
self.__heading = QLabel(heading, self,
objectName="heading")
self.__heading.setContentsMargins(12, 12, 12, 0)
self.__browser = previewbrowser.PreviewBrowser(self)
self.__buttons = QDialogButtonBox(QDialogButtonBox.Open | \
QDialogButtonBox.Cancel,
Qt.Horizontal,)
self.__buttons.button(QDialogButtonBox.Open).setAutoDefault(True)
# Set the Open dialog as disabled until the current index changes
self.__buttons.button(QDialogButtonBox.Open).setEnabled(False)
# The QDialogButtonsWidget messes with the layout if it is
# contained directly in the QDialog. So we create an extra
# layer of indirection.
buttons = QWidget(objectName="button-container")
buttons_l = QVBoxLayout()
buttons_l.setContentsMargins(12, 0, 12, 12)
buttons.setLayout(buttons_l)
buttons_l.addWidget(self.__buttons)
layout.addWidget(self.__heading)
layout.addWidget(self.__browser)
layout.addWidget(buttons)
self.__buttons.accepted.connect(self.accept)
self.__buttons.rejected.connect(self.reject)
self.__browser.currentIndexChanged.connect(
self.__on_currentIndexChanged
)
self.__browser.activated.connect(self.__on_activated)
layout.setSizeConstraint(QVBoxLayout.SetFixedSize)
self.setLayout(layout)
self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
示例15: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent=None, **kwargs):
super().__init__(parent, **kwargs)
self.__dropindicator = QSpacerItem(
16, 16, QSizePolicy.Expanding, QSizePolicy.Fixed
)
self.__dragstart = (None, None, None)
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
self.__flowlayout = QVBoxLayout()
layout.addLayout(self.__flowlayout)
layout.addSpacerItem(
QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Expanding))
self.setLayout(layout)
self.setAcceptDrops(True)