@@ -1192,7 +1192,20 @@ def __init__(self, caller):
11921192
11931193 self .caller .centralWidget .inspectorFilter .textChanged .connect (self .searchTreeFilter )
11941194 self .caller .centralWidget .inspectorTableFilter .textChanged .connect (self .searchTableFilter )
1195+
1196+ self .caller .centralWidget .inspectorSplitter .setContextMenuPolicy (Qt .CustomContextMenu )
1197+ self .caller .centralWidget .inspectorSplitter .customContextMenuRequested .connect (self .splitterAdjust )
11951198 self .firstRun = False
1199+
1200+ def splitterAdjust (self ,pos ):
1201+ splitter = self .caller .centralWidget .inspectorSplitter
1202+
1203+ if splitter .orientation () == Qt .Vertical :
1204+ if pos .y () >= splitter .sizes ()[0 ] and pos .y () <= splitter .sizes ()[0 ]+ splitter .handleWidth ():
1205+ splitter .setOrientation (Qt .Horizontal )
1206+ else :
1207+ if pos .x () >= splitter .sizes ()[0 ] and pos .x () <= splitter .sizes ()[0 ]+ splitter .handleWidth ():
1208+ splitter .setOrientation (Qt .Vertical )
11961209
11971210 def selected (self ):
11981211 if not self .firstRun :
@@ -1290,6 +1303,13 @@ def showCurrentWidget(self, toggle, switchTab = False):
12901303
12911304 def refreshItems (self , currentItem = None , currentWindow = None ):
12921305 self .treeObjList = []
1306+ oldText = self .caller .centralWidget .inspectorFilter .text ()
1307+ oldColumnWidth = [
1308+ self .treeView .columnWidth (0 ),
1309+ self .treeView .columnWidth (1 ),
1310+ self .treeView .columnWidth (2 ),
1311+ self .treeView .columnWidth (3 ),
1312+ ]
12931313 self .caller .centralWidget .inspectorFilter .setText ("" )
12941314 self .treeModel .clear ()
12951315 self .treeModel .setHorizontalHeaderLabels (['Class' , 'Name' , 'Meta Class' , 'From' , 'Text/Value' ])
@@ -1303,6 +1323,11 @@ def refreshItems(self, currentItem = None, currentWindow = None):
13031323
13041324 if indexes :
13051325 self .treeView .scrollTo (indexes [0 ], QAbstractItemView .ScrollHint .PositionAtCenter )
1326+ self .caller .centralWidget .inspectorFilter .setText (oldText )
1327+ self .treeView .setColumnWidth (0 ,oldColumnWidth [0 ])
1328+ self .treeView .setColumnWidth (1 ,oldColumnWidth [1 ])
1329+ self .treeView .setColumnWidth (2 ,oldColumnWidth [2 ])
1330+ self .treeView .setColumnWidth (3 ,oldColumnWidth [3 ])
13061331
13071332
13081333
@@ -1496,6 +1521,7 @@ def selectItemByRef(self, obj):
14961521 #>>self.treeSelectModel.select(idx[0], self.treeSelectModel.SelectionFlag.Select | self.treeSelectModel.SelectionFlag.Rows )
14971522
14981523 def itemSelectionChanged (self , new , old ):
1524+ key = QGuiApplication .queryKeyboardModifiers ()
14991525 indexes = new .indexes ()
15001526 if indexes :
15011527 obj = self .treeObjList [indexes [0 ].data (101 )]
@@ -1504,6 +1530,8 @@ def itemSelectionChanged(self, new, old):
15041530 item .setIcon ( Krita .instance ().icon ('window-close' ) )
15051531 else :
15061532 self .loadItemInfo ( obj )
1533+ if key == Qt .ControlModifier :
1534+ self .treeView .expandRecursively (indexes [0 ])
15071535
15081536 def loadItemInfo (self , obj ):
15091537 self .hideUpdateLayout ()
@@ -1514,6 +1542,12 @@ def loadItemInfo(self, obj):
15141542 if self .showCurrentWidgetHighlight :
15151543 self .caller .t ['selector' ].setCurrentSelector (self .currentWidget , False )
15161544
1545+ oldColumnWidth = [
1546+ self .tableView .columnWidth (0 ),
1547+ self .tableView .columnWidth (1 ),
1548+ self .tableView .columnWidth (2 ),
1549+ ]
1550+
15171551 self .tableModel .clear ()
15181552 self .tableModel .setHorizontalHeaderLabels (['Name' , "Type" , 'Value' ])
15191553
@@ -1643,6 +1677,10 @@ def loadItemInfo(self, obj):
16431677 item [0 ].setData (meth , 101 )
16441678
16451679 parentItem .appendRow (item )
1680+
1681+ self .tableView .setColumnWidth (0 ,oldColumnWidth [0 ])
1682+ self .tableView .setColumnWidth (1 ,oldColumnWidth [1 ])
1683+ self .tableView .setColumnWidth (2 ,oldColumnWidth [2 ])
16461684
16471685 def fillMethods (self ,obj , metaDict , otherMethods , inheritsFrom , prepend = '' ):
16481686 meta = obj .metaObject ()
0 commit comments