Closed natxo14 closed 4 years ago
Hi @natxo14 . I will have a look at the issue. Are you using PyQt4 or PyQt5 ?
Hi @IvarsKarpics , thanks for your reply.
I'm on PyQt5.
If this helps:
On gui/utils/GUIDisplay.py file some wrappers for common Qt widgets ( Spacer, CustomFrame, CustomGroupBox ... ) are created, but QSplitter is used directly on the code.
Besides on the WindowDisplayWidget.add_item(self, item_cfg, parent):
function, the code splits in conditionals according to the item_type
, and for the case of splitters ( vertical or horizontal ), there's no instruction at all:
elif item_type == "vsplitter" or type == "hsplitter":
pass
If you find out what's missing and explaining it to me is going to cost you less than coding it, I'd be pleased to fix it. Thanks!
Hi @natxo14 . We are using PyQt4 and PyQt5 behaves sometimes different and is not tested enough. So, its not a wonder that some bugs appear. I have a ubuntu virtual machine with python3 and PyQt5. I will try to fix it. Meanwhile, of course you can open PR with a solution.
Hi @natxo14
Yes. I looked at it. It seems that the Splitter classes have never been used in "mxcube" (at least in Qt4/Qt5) but "nearly" everything is ready for them.
Other than the modified calls to the constructor that you have already fixed, there is the "addWidget" call missing for children of the QSplitter. The reason is that QSplitter is a container but has no layout manager, addWidget must be called directly on the splitter class.
In Qt4_GUIDisplay.py file:
in method make_item() at the end of the loop through children, there is the block that calls addWidget on layouts. It should be modified to something like:
if layout is not None: [......] elif isinstance(parent,QSplitter): self.preview_items.append(new_item) parent.addWidget(new_item)
See if that solves your problem. Probably some customization of the splitter is still needed in the horizontalSplitter / verticalSplitter splitter creation methods.
Have fun !
Whoo, your a star @vrey01 !
Thanks @vrey01 . PR with solution is in #397
Solved with #397
Trying to use/add vertical or horizontal splitters to a GUI with qt MxCUBE version, I found some issues:
Splitter constructor was called with too much parameters (error raised when trying to create a splitter object), so in gui/utils/GUIDisplay.py , had to change from
to
and also, as a splitter has no layout, in
def add_widget(self, child, parent):
function had to addafter the
if isinstance(parent, TabCfg):
statement.Now no errors are raised, but when executing the gui file, nothing included on the splitter widget is displayed.
Does anyone know about what could be failing or missing to integrate splitters correctly on a GUI?? Thanks!