本文整理汇总了Python中AnyQt.QtWidgets.QVBoxLayout.addWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.addWidget方法的具体用法?Python QVBoxLayout.addWidget怎么用?Python QVBoxLayout.addWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.addWidget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [as 别名]
def __init__(self):
super().__init__()
self.corpus = None
self.learning_thread = None
# Commit button
gui.auto_commit(self.buttonsArea, self, 'autocommit', 'Commit', box=False)
button_group = QButtonGroup(self, exclusive=True)
button_group.buttonClicked[int].connect(self.change_method)
self.widgets = []
method_layout = QVBoxLayout()
self.controlArea.layout().addLayout(method_layout)
for i, (method, attr_name) in enumerate(self.methods):
widget = method(self, title='Options')
widget.setFixedWidth(self.control_area_width)
widget.valueChanged.connect(self.commit)
self.widgets.append(widget)
setattr(self, attr_name, widget)
rb = QRadioButton(text=widget.Model.name)
button_group.addButton(rb, i)
method_layout.addWidget(rb)
method_layout.addWidget(widget)
button_group.button(self.method_index).setChecked(True)
self.toggle_widgets()
method_layout.addStretch()
# Topics description
self.topic_desc = TopicViewer()
self.topic_desc.topicSelected.connect(self.send_topic_by_id)
self.mainArea.layout().addWidget(self.topic_desc)
self.topic_desc.setFocus()
示例3: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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 addWidget [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: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [as 别名]
def __setupUi(self):
layout = QVBoxLayout()
# Scene with the link editor.
self.scene = LinksEditScene()
self.view = QGraphicsView(self.scene)
self.view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.view.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.view.setRenderHint(QPainter.Antialiasing)
self.scene.editWidget.geometryChanged.connect(self.__onGeometryChanged)
# Ok/Cancel/Clear All buttons.
buttons = QDialogButtonBox(QDialogButtonBox.Ok |
QDialogButtonBox.Cancel |
QDialogButtonBox.Reset,
Qt.Horizontal)
clear_button = buttons.button(QDialogButtonBox.Reset)
clear_button.setText(self.tr("Clear All"))
buttons.accepted.connect(self.accept)
buttons.rejected.connect(self.reject)
clear_button.clicked.connect(self.scene.editWidget.clearLinks)
layout.addWidget(self.view)
layout.addWidget(buttons)
self.setLayout(layout)
layout.setSizeConstraint(QVBoxLayout.SetFixedSize)
self.setSizeGripEnabled(False)
示例6: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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)
示例7: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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)
示例8: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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: _setup_gui_labels
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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)
示例10: __run_add_package_dialog
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [as 别名]
def __run_add_package_dialog(self):
self.__add_package_by_name_dialog = dlg = QDialog(
self, windowTitle="Add add-on by name",
)
dlg.setAttribute(Qt.WA_DeleteOnClose)
vlayout = QVBoxLayout()
form = QFormLayout()
form.setContentsMargins(0, 0, 0, 0)
nameentry = QLineEdit(
placeholderText="Package name",
toolTip="Enter a package name as displayed on "
"PyPI (capitalization is not important)")
nameentry.setMinimumWidth(250)
form.addRow("Name:", nameentry)
vlayout.addLayout(form)
buttons = QDialogButtonBox(
standardButtons=QDialogButtonBox.Ok | QDialogButtonBox.Cancel
)
okb = buttons.button(QDialogButtonBox.Ok)
okb.setEnabled(False)
okb.setText("Add")
def changed(name):
okb.setEnabled(bool(name))
nameentry.textChanged.connect(changed)
vlayout.addWidget(buttons)
vlayout.setSizeConstraint(QVBoxLayout.SetFixedSize)
dlg.setLayout(vlayout)
f = None
def query():
nonlocal f
name = nameentry.text()
def query_pypi(name):
# type: (str) -> _QueryResult
res = pypi_json_query_project_meta([name])
assert len(res) == 1
r = res[0]
if r is not None:
r = installable_from_json_response(r)
return _QueryResult(queryname=name, installable=r)
f = self.__executor.submit(query_pypi, name)
okb.setDisabled(True)
f.add_done_callback(
method_queued(self.__on_add_single_query_finish, (object,))
)
buttons.accepted.connect(query)
buttons.rejected.connect(dlg.reject)
dlg.exec_()
示例11: __setupUi
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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)
示例12: main
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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_()
示例13: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [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 addWidget [as 别名]
def __setupUi(self):
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
# Scroll area for the contents.
self.__scrollArea = \
_ToolBoxScrollArea(self, objectName="toolbox-scroll-area")
self.__scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
self.__scrollArea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.__scrollArea.setSizePolicy(QSizePolicy.MinimumExpanding,
QSizePolicy.MinimumExpanding)
self.__scrollArea.setFrameStyle(QScrollArea.NoFrame)
self.__scrollArea.setWidgetResizable(True)
# A widget with all of the contents.
# The tabs/contents are placed in the layout inside this widget
self.__contents = QWidget(self.__scrollArea,
objectName="toolbox-contents")
# The layout where all the tab/pages are placed
self.__contentsLayout = QVBoxLayout()
self.__contentsLayout.setContentsMargins(0, 0, 0, 0)
self.__contentsLayout.setSizeConstraint(QVBoxLayout.SetMinAndMaxSize)
self.__contentsLayout.setSpacing(0)
self.__contents.setLayout(self.__contentsLayout)
self.__scrollArea.setWidget(self.__contents)
layout.addWidget(self.__scrollArea)
self.setLayout(layout)
self.setSizePolicy(QSizePolicy.Fixed,
QSizePolicy.MinimumExpanding)
self.__tabActionGroup = \
QActionGroup(self, objectName="toolbox-tab-action-group")
self.__tabActionGroup.setExclusive(self.__exclusive)
self.__actionMapper = QSignalMapper(self)
self.__actionMapper.mapped[QObject].connect(self.__onTabActionToogled)
示例15: __init__
# 需要导入模块: from AnyQt.QtWidgets import QVBoxLayout [as 别名]
# 或者: from AnyQt.QtWidgets.QVBoxLayout import addWidget [as 别名]
def __init__(self, parent=None, **kwargs):
BaseEditor.__init__(self, parent, **kwargs)
self.__method = DiscretizeEditor.EqualFreq
self.__nintervals = 4
layout = QVBoxLayout()
self.setLayout(layout)
self.__group = group = QButtonGroup(self, exclusive=True)
for method in [self.EntropyMDL, self.EqualFreq, self.EqualWidth,
self.Drop]:
rb = QRadioButton(
self, text=self.Names[method],
checked=self.__method == method
)
layout.addWidget(rb)
group.addButton(rb, method)
group.buttonClicked.connect(self.__on_buttonClicked)
self.__slbox = slbox = QGroupBox(
title="Number of intervals (for equal width/frequency)",
flat=True
)
slbox.setLayout(QHBoxLayout())
self.__slider = slider = QSlider(
orientation=Qt.Horizontal,
minimum=2, maximum=10, value=self.__nintervals,
enabled=self.__method in [self.EqualFreq, self.EqualWidth],
pageStep=1, tickPosition=QSlider.TicksBelow
)
slider.valueChanged.connect(self.__on_valueChanged)
slbox.layout().addWidget(slider)
self.__slabel = slabel = QLabel()
slbox.layout().addWidget(slabel)
container = QHBoxLayout()
container.setContentsMargins(13, 0, 0, 0)
container.addWidget(slbox)
self.layout().insertLayout(3, container)
self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Preferred)