I have two QTreeViews next to each other in a VBoxLayout. In light mode (default), the spacing is appropriate since I have a customized size hint and minimum size. However, in dark mode, the top tree is 'squished'. It seems my size hint and minimum size are ignored.
import qdarkstyle
from pyqtgraph.parametertree import ParameterTree, Parameter
from pyqtgraph.Qt import QtWidgets, QtCore
import pyqtgraph as pg
app = pg.mkQApp()
from utilitys.widgets import EasyWidget
# Populate both trees with some stuff
children = []
for ii in range(20):
innerCh = [dict(name=str(jj), type='int', value=jj) for jj in range(4)]
newCh = dict(name=f'nested{ii}', type='group', children=innerCh)
children.append(newCh)
topParams = dict(name='test', type='group', children=children[:2])
botParams = dict(name='test2', type='group', children=children)
topTree = ParameterTree()
topTree.setParameters(Parameter.create(**topParams))
bottomTree = ParameterTree()
bottomTree.setParameters(Parameter.create(**botParams))
topTree.setSizePolicy(topTree.sizePolicy().horizontalPolicy(), QtWidgets.QSizePolicy.Fixed)
# Size is just a tad too small on its own regardless of darkstyle
oldSzHint = topTree.sizeHint
def newSzHint():
baseHint = oldSzHint()
baseHint.setHeight(int(baseHint.height()*1.1))
return baseHint
topTree.setMinimumHeight(newSzHint().height())
topTree.sizeHint = newSzHint
# Make a window with a qslider between the two trees
win = EasyWidget.buildMainWin([topTree, bottomTree], useSplitter=True)
win.show()
QtCore.QTimer.singleShot(5000, lambda: win.setStyleSheet(qdarkstyle.load_stylesheet()))
app.exec_()
Note: It might be worth mentioning that for non-nested tree items, i.e. when all items are at the top level, this problem is not nearly as pronounced.
Describe Your Environment
[Versions from your environment]
Language
Python
Description / Steps to Reproduce [if necessary]
I have two
QTreeView
s next to each other in aVBoxLayout
. In light mode (default), the spacing is appropriate since I have a customized size hint and minimum size. However, in dark mode, the top tree is 'squished'. It seems my size hint and minimum size are ignored.https://user-images.githubusercontent.com/23620506/115135097-a768fc00-9fe3-11eb-97a6-945d8cecace8.mp4
Is this a problem with my code or
qdarkstyle
?Code to reproduce
Note: It might be worth mentioning that for non-nested tree items, i.e. when all items are at the top level, this problem is not nearly as pronounced.