本文整理汇总了Python中PyQt5.QtWidgets.QSplitter.orientation方法的典型用法代码示例。如果您正苦于以下问题:Python QSplitter.orientation方法的具体用法?Python QSplitter.orientation怎么用?Python QSplitter.orientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QSplitter
的用法示例。
在下文中一共展示了QSplitter.orientation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _s_CentralWidget
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import orientation [as 别名]
class _s_CentralWidget(QWidget):
###############################################################################
# CentralWidget SIGNALS
###############################################################################
"""
splitterCentralRotated()
"""
splitterCentralRotated = pyqtSignal()
###############################################################################
def __init__(self, parent=None):
super(_s_CentralWidget, self).__init__(parent)
self.parent = parent
#This variables are used to save the splitter sizes before hide
self._splitterMainSizes = None
self._splitterAreaSizes = None
self.lateralPanel = None
hbox = QHBoxLayout(self)
hbox.setContentsMargins(0, 0, 0, 0)
hbox.setSpacing(0)
#Create Splitters to divide the UI in: MainPanel, Explorer, Misc
self._splitterArea = QSplitter(Qt.Horizontal)
self._splitterMain = QSplitter(Qt.Vertical)
#Create scrollbar for follow mode
self.scrollBar = QScrollBar(Qt.Vertical, self)
self.scrollBar.setFixedWidth(20)
self.scrollBar.setToolTip('Follow Mode: Scroll the Editors together')
self.scrollBar.hide()
self.scrollBar.valueChanged[int].connect(self.move_follow_scrolls)
#Add to Main Layout
hbox.addWidget(self.scrollBar)
hbox.addWidget(self._splitterArea)
def insert_central_container(self, container):
self.mainContainer = container
self._splitterMain.insertWidget(0, container)
def insert_lateral_container(self, container):
self.lateralPanel = LateralPanel(container)
self._splitterArea.insertWidget(0, self.lateralPanel)
def insert_bottom_container(self, container):
self.misc = container
self._splitterMain.insertWidget(1, container)
def showEvent(self, event):
#Show Event
QWidget.showEvent(self, event)
#Avoid recalculate the panel sizes if they are already loaded
if self._splitterArea.count() == 2:
return
#Rearrange widgets on Window
self._splitterArea.insertWidget(0, self._splitterMain)
if not event.spontaneous():
self.change_misc_visibility()
if bin(settings.UI_LAYOUT)[-1] == '1':
self.splitter_central_rotate()
if bin(settings.UI_LAYOUT >> 1)[-1] == '1':
self.splitter_misc_rotate()
if bin(settings.UI_LAYOUT >> 2)[-1] == '1':
self.splitter_central_orientation()
qsettings = QSettings(resources.SETTINGS_PATH, QSettings.IniFormat)
#Lists of sizes as list of QVariant- heightList = [QVariant, QVariant]
heightList = list(qsettings.value("window/central/mainSize",
[(self.height() / 3) * 2, self.height() / 3]))
widthList = list(qsettings.value("window/central/areaSize",
[(self.width() / 6) * 5, self.width() / 6]))
self._splitterMainSizes = [int(heightList[0]), int(heightList[1])]
self._splitterAreaSizes = [int(widthList[0]), int(widthList[1])]
#Set the sizes to splitters
#self._splitterMain.setSizes(self._splitterMainSizes)
self._splitterMain.setSizes(self._splitterMainSizes)
self._splitterArea.setSizes(self._splitterAreaSizes)
self.misc.setVisible(
qsettings.value("window/show_misc", False, type=bool))
def change_misc_visibility(self, on_start=False):
if self.misc.isVisible():
self._splitterMainSizes = self._splitterMain.sizes()
self.misc.hide()
widget = self.mainContainer.get_actual_widget()
if widget:
widget.setFocus()
else:
self.misc.show()
self.misc.gain_focus()
def change_main_visibility(self):
if self.mainContainer.isVisible():
self.mainContainer.hide()
else:
self.mainContainer.show()
def change_explorer_visibility(self, force_hide=False):
#.........这里部分代码省略.........
示例2: Listspace
# 需要导入模块: from PyQt5.QtWidgets import QSplitter [as 别名]
# 或者: from PyQt5.QtWidgets.QSplitter import orientation [as 别名]
#.........这里部分代码省略.........
"""
Protected slot to handle the syntaxerrorToggled signal.
@param editor editor that sent the signal
"""
currentRow = self.viewlist.currentRow()
index = self.editors.index(editor)
keys = []
if editor.isModified():
keys.append("fileModified.png")
if editor.hasSyntaxErrors():
keys.append("syntaxError22.png")
elif editor.hasWarnings():
keys.append("warning22.png")
if not keys:
keys.append("empty.png")
self.viewlist.item(index).setIcon(
UI.PixmapCache.getCombinedIcon(keys))
self.viewlist.setCurrentRow(currentRow)
ViewManager._syntaxErrorToggled(self, editor)
def addSplit(self):
"""
Public method used to split the current view.
"""
stack = StackedWidget(self.stackArea)
stack.show()
self.stackArea.addWidget(stack)
self.stacks.append(stack)
self.currentStack = stack
stack.currentChanged.connect(self.__currentChanged)
stack.installEventFilter(self)
if self.stackArea.orientation() == Qt.Horizontal:
size = self.stackArea.width()
else:
size = self.stackArea.height()
self.stackArea.setSizes(
[int(size / len(self.stacks))] * len(self.stacks))
self.splitRemoveAct.setEnabled(True)
self.nextSplitAct.setEnabled(True)
self.prevSplitAct.setEnabled(True)
def removeSplit(self):
"""
Public method used to remove the current split view.
@return flag indicating successfull removal
"""
if len(self.stacks) > 1:
stack = self.currentStack
res = True
savedEditors = stack.editors[:]
for editor in savedEditors:
res &= self.closeEditor(editor)
if res:
try:
i = self.stacks.index(stack)
except ValueError:
return True
if i == len(self.stacks) - 1:
i -= 1
self.stacks.remove(stack)
stack.close()
self.currentStack = self.stacks[i]
if len(self.stacks) == 1: