本文整理汇总了Python中AnyQt.QtWidgets.QVBoxLayout类的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout类的具体用法?Python QVBoxLayout怎么用?Python QVBoxLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QVBoxLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __setupUi
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__
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)
示例3: __init__
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__
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)
示例5: __setupUi
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_()
示例6: setup_gui
def setup_gui(self):
layout = QVBoxLayout()
self.setLayout(layout)
self.main_form = QFormLayout()
self.main_form.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
layout.addLayout(self.main_form)
self._setup_gui_name()
self._setup_gui_labels()
示例7: __setupUi
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)
示例8: __setupUi
def __setupUi(self):
layout = QVBoxLayout()
label = QLabel(self)
pixmap, _ = config.splash_screen()
label.setPixmap(pixmap)
layout.addWidget(label, Qt.AlignCenter)
name = QApplication.applicationName()
version = QApplication.applicationVersion()
text = ABOUT_TEMPLATE.format(
name=escape(name),
version=escape(version),
)
# TODO: Also list all known add-on versions??.
text_label = QLabel(text)
layout.addWidget(text_label, Qt.AlignCenter)
buttons = QDialogButtonBox(
QDialogButtonBox.Close, Qt.Horizontal, self)
layout.addWidget(buttons)
buttons.rejected.connect(self.accept)
layout.setSizeConstraint(QVBoxLayout.SetFixedSize)
self.setLayout(layout)
示例9: __setupUi
def __setupUi(self):
layout = QVBoxLayout()
label = QLabel(self)
pixmap, _ = config.splash_screen()
label.setPixmap(pixmap)
layout.addWidget(label, Qt.AlignCenter)
try:
from Orange.version import version
from Orange.version import git_revision
except ImportError:
dist = pkg_resources.get_distribution("Orange3")
version = dist.version
git_revision = "Unknown"
text = ABOUT_TEMPLATE.format(version=version,
git_revision=git_revision[:7])
# TODO: Also list all known add-on versions.
text_label = QLabel(text)
layout.addWidget(text_label, Qt.AlignCenter)
buttons = QDialogButtonBox(QDialogButtonBox.Close,
Qt.Horizontal,
self)
layout.addWidget(buttons)
buttons.rejected.connect(self.accept)
layout.setSizeConstraint(QVBoxLayout.SetFixedSize)
self.setLayout(layout)
示例10: __setupUi
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)
示例11: __init__
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)
示例12: _setup_gui_labels
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)
示例13: __setupUi
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)
示例14: __init__
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()
示例15: __setupUi
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)