本文整理汇总了Python中PyQt5.QtWidgets.QVBoxLayout.setStretchFactor方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.setStretchFactor方法的具体用法?Python QVBoxLayout.setStretchFactor怎么用?Python QVBoxLayout.setStretchFactor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QVBoxLayout
的用法示例。
在下文中一共展示了QVBoxLayout.setStretchFactor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DebugViewer
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setStretchFactor [as 别名]
#.........这里部分代码省略.........
self.__tabWidget.setTabToolTip(
index, self.watchpointViewer.windowTitle())
from .ExceptionLogger import ExceptionLogger
# add the exception logger
self.exceptionLogger = ExceptionLogger()
index = self.__tabWidget.addTab(
self.exceptionLogger,
UI.PixmapCache.getIcon("exceptions.png"), '')
self.__tabWidget.setTabToolTip(
index, self.exceptionLogger.windowTitle())
if self.embeddedShell:
self.__tabWidget.setCurrentWidget(self.shellAssembly)
else:
if self.embeddedBrowser:
self.__tabWidget.setCurrentWidget(self.browser)
else:
self.__tabWidget.setCurrentWidget(self.glvWidget)
# add the threads viewer
self.__mainLayout.addWidget(QLabel(self.tr("Threads:")))
self.__threadList = QTreeWidget()
self.__threadList.setHeaderLabels(
[self.tr("ID"), self.tr("Name"),
self.tr("State"), ""])
self.__threadList.setSortingEnabled(True)
self.__mainLayout.addWidget(self.__threadList)
self.__doThreadListUpdate = True
self.__threadList.currentItemChanged.connect(self.__threadSelected)
self.__mainLayout.setStretchFactor(self.__tabWidget, 5)
self.__mainLayout.setStretchFactor(self.__threadList, 1)
self.currPage = None
self.currentStack = None
self.framenr = 0
self.debugServer.clientStack.connect(self.handleClientStack)
self.__autoViewSource = Preferences.getDebugger("AutoViewSourceCode")
self.sourceButton.setVisible(not self.__autoViewSource)
def preferencesChanged(self):
"""
Public slot to handle the preferencesChanged signal.
"""
self.__autoViewSource = Preferences.getDebugger("AutoViewSourceCode")
self.sourceButton.setVisible(not self.__autoViewSource)
def setDebugger(self, debugUI):
"""
Public method to set a reference to the Debug UI.
@param debugUI reference to the DebugUI object (DebugUI)
"""
self.debugUI = debugUI
self.debugUI.clientStack.connect(self.handleClientStack)
self.callStackViewer.setDebugger(debugUI)
def handleResetUI(self):
"""
Public method to reset the SBVviewer.
"""
示例2: _init_layout
# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setStretchFactor [as 别名]
def _init_layout(self):
"""
Create the GUI widgets (but leave them empty).
"""
hostname_combobox = QComboBox(parent=self)
self._hostname_combobox = hostname_combobox
hostname_combobox.setEditable(True)
hostname_combobox.setSizePolicy( QSizePolicy.Expanding, QSizePolicy.Maximum )
for hostname in self._suggested_hostnames:
hostname_combobox.addItem( hostname )
# EventFilter is installed after everything else is initialized. (See below.)
#hostname_combobox.installEventFilter(self)
self._connect_button = QPushButton("Connect", parent=self, clicked=self._handle_new_hostname)
hostname_layout = QHBoxLayout()
hostname_layout.addWidget( hostname_combobox )
hostname_layout.addWidget( self._connect_button )
hostinfo_table = QTableWidget()
hostinfo_table.setColumnCount(len(SERVER_INFO_FIELDS))
hostinfo_table.setHorizontalHeaderLabels(SERVER_INFO_FIELDS)
hostinfo_table.horizontalHeader().setVisible(True)
hostinfo_table.verticalHeader().setVisible(False)
hostinfo_table.setRowCount(1)
hostinfo_table.setItem(0,0, QTableWidgetItem("Placeholder"))
hostinfo_table.setVisible(False)
hostinfo_table.resizeRowsToContents()
hostinfo_table.horizontalHeader().setStretchLastSection(True)
table_height = hostinfo_table.verticalHeader().sectionSize(0) + hostinfo_table.rowHeight(0)
hostinfo_table.resize( QSize( hostinfo_table.width(), table_height ) )
hostinfo_table.setMaximumSize( QSize( 1000, table_height ) )
hostinfo_table.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
host_layout = QVBoxLayout()
host_layout.addLayout(hostname_layout)
host_layout.addWidget(hostinfo_table)
host_groupbox = QGroupBox("DVID Host", parent=self)
host_groupbox.setLayout( host_layout )
host_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
repo_treewidget = QTreeWidget(parent=self)
repo_treewidget.setHeaderLabels( TREEVIEW_COLUMNS ) # TODO: Add type, shape, axes, etc.
repo_treewidget.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
repo_treewidget.itemSelectionChanged.connect( self._handle_data_selection )
data_layout = QVBoxLayout()
data_layout.addWidget( repo_treewidget )
data_groupbox = QGroupBox("Data Volumes", parent=self)
data_groupbox.setLayout( data_layout )
node_listwidget = QListWidget(parent=self)
node_listwidget.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
node_listwidget.itemSelectionChanged.connect( self._update_status )
node_layout = QVBoxLayout()
node_layout.addWidget( node_listwidget )
node_groupbox = QGroupBox("Nodes", parent=self)
node_groupbox.setLayout( node_layout )
new_data_edit = QLineEdit(parent=self)
new_data_edit.textEdited.connect( self._update_status )
full_url_label = QLabel(parent=self)
full_url_label.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Maximum )
text_flags = full_url_label.textInteractionFlags()
full_url_label.setTextInteractionFlags( text_flags | Qt.TextSelectableByMouse )
new_data_layout = QVBoxLayout()
new_data_layout.addWidget( new_data_edit )
new_data_groupbox = QGroupBox("New Data Volume", parent=self)
new_data_groupbox.setLayout( new_data_layout )
new_data_groupbox.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Maximum )
buttonbox = QDialogButtonBox( Qt.Horizontal, parent=self )
buttonbox.setStandardButtons( QDialogButtonBox.Ok | QDialogButtonBox.Cancel )
buttonbox.accepted.connect( self.accept )
buttonbox.rejected.connect( self.reject )
buttonbox.button(QDialogButtonBox.Ok).setEnabled(False)
layout = QVBoxLayout()
layout.addWidget( host_groupbox )
layout.addWidget( data_groupbox )
layout.addWidget( node_groupbox )
if self._mode == "specify_new":
layout.addWidget( new_data_groupbox )
else:
new_data_groupbox.hide()
layout.addWidget( full_url_label )
layout.addWidget( buttonbox )
# Stretch factors
layout.setStretchFactor(data_groupbox, 3)
layout.setStretchFactor(node_groupbox, 1)
self.setLayout(layout)
self.setWindowTitle( "Select DVID Volume" )
self.resize(1000, 1000)
#.........这里部分代码省略.........