eric6/Plugins/ViewManagerPlugins/Listspace/Listspace.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8176
31965986ecd1
child 8205
4a0f1f896341
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
221 ViewManager.__init__(self) 221 ViewManager.__init__(self)
222 self.__splitter.setChildrenCollapsible(False) 222 self.__splitter.setChildrenCollapsible(False)
223 223
224 self.viewlist = QListWidget(self) 224 self.viewlist = QListWidget(self)
225 policy = self.viewlist.sizePolicy() 225 policy = self.viewlist.sizePolicy()
226 policy.setHorizontalPolicy(QSizePolicy.Ignored) 226 policy.setHorizontalPolicy(QSizePolicy.Policy.Ignored)
227 self.viewlist.setSizePolicy(policy) 227 self.viewlist.setSizePolicy(policy)
228 self.__splitter.addWidget(self.viewlist) 228 self.__splitter.addWidget(self.viewlist)
229 self.viewlist.setContextMenuPolicy(Qt.CustomContextMenu) 229 self.viewlist.setContextMenuPolicy(
230 Qt.ContextMenuPolicy.CustomContextMenu)
230 self.viewlist.currentRowChanged.connect(self.__showSelectedView) 231 self.viewlist.currentRowChanged.connect(self.__showSelectedView)
231 self.viewlist.customContextMenuRequested.connect(self.__showMenu) 232 self.viewlist.customContextMenuRequested.connect(self.__showMenu)
232 233
233 self.stackArea = QSplitter(self) 234 self.stackArea = QSplitter(self)
234 self.stackArea.setChildrenCollapsible(False) 235 self.stackArea.setChildrenCollapsible(False)
235 self.__splitter.addWidget(self.stackArea) 236 self.__splitter.addWidget(self.stackArea)
236 self.stackArea.setOrientation(Qt.Vertical) 237 self.stackArea.setOrientation(Qt.Orientation.Vertical)
237 stack = StackedWidget(self.stackArea) 238 stack = StackedWidget(self.stackArea)
238 self.stackArea.addWidget(stack) 239 self.stackArea.addWidget(stack)
239 self.stacks.append(stack) 240 self.stacks.append(stack)
240 self.currentStack = stack 241 self.currentStack = stack
241 stack.currentChanged.connect(self.__currentChanged) 242 stack.currentChanged.connect(self.__currentChanged)
646 self.stackArea.addWidget(stack) 647 self.stackArea.addWidget(stack)
647 self.stacks.append(stack) 648 self.stacks.append(stack)
648 self.currentStack = stack 649 self.currentStack = stack
649 stack.currentChanged.connect(self.__currentChanged) 650 stack.currentChanged.connect(self.__currentChanged)
650 stack.installEventFilter(self) 651 stack.installEventFilter(self)
651 if self.stackArea.orientation() == Qt.Horizontal: 652 if self.stackArea.orientation() == Qt.Orientation.Horizontal:
652 size = self.stackArea.width() 653 size = self.stackArea.width()
653 else: 654 else:
654 size = self.stackArea.height() 655 size = self.stackArea.height()
655 self.stackArea.setSizes( 656 self.stackArea.setSizes(
656 [int(size / len(self.stacks))] * len(self.stacks)) 657 [int(size / len(self.stacks))] * len(self.stacks))
727 def getSplitOrientation(self): 728 def getSplitOrientation(self):
728 """ 729 """
729 Public method to get the orientation of the split view. 730 Public method to get the orientation of the split view.
730 731
731 @return orientation of the split 732 @return orientation of the split
732 @rtype Qt.Horizontal or Qt.Vertical 733 @rtype Qt.Orientation.Horizontal or Qt.Orientation.Vertical
733 """ 734 """
734 return self.stackArea.orientation() 735 return self.stackArea.orientation()
735 736
736 def setSplitOrientation(self, orientation): 737 def setSplitOrientation(self, orientation):
737 """ 738 """
738 Public method used to set the orientation of the split view. 739 Public method used to set the orientation of the split view.
739 740
740 @param orientation orientation of the split 741 @param orientation orientation of the split
741 @type Qt.Horizontal or Qt.Vertical 742 @type Qt.Orientation.Horizontal or Qt.Orientation.Vertical
742 """ 743 """
743 self.stackArea.setOrientation(orientation) 744 self.stackArea.setOrientation(orientation)
744 745
745 def nextSplit(self): 746 def nextSplit(self):
746 """ 747 """
901 @type QEvent 902 @type QEvent
902 @return flag indicating, if we handled the event 903 @return flag indicating, if we handled the event
903 @rtype bool 904 @rtype bool
904 """ 905 """
905 if ( 906 if (
906 event.type() == QEvent.MouseButtonPress and 907 event.type() == QEvent.Type.MouseButtonPress and
907 not event.button() == Qt.RightButton 908 not event.button() == Qt.MouseButton.RightButton
908 ): 909 ):
909 switched = True 910 switched = True
910 if isinstance(watched, QStackedWidget): 911 if isinstance(watched, QStackedWidget):
911 switched = watched is not self.currentStack 912 switched = watched is not self.currentStack
912 self.currentStack = watched 913 self.currentStack = watched

eric ide

mercurial