ucam-department-of-psychiatry / camcops

Cambridge Cognitive and Psychiatric Test Kit (CamCOPS)
Other
12 stars 8 forks source link

BoxLayoutHfw for PySide6 #339

Closed jamesdbrock closed 7 months ago

jamesdbrock commented 7 months ago

Hi @RudolfCardinal I read your StackOverflow answer about QLabel with rich text https://stackoverflow.com/questions/14238138/heightforwidth-label/41676092#41676092 and I'm convinced that your approach is the best.

I would like to use your layouts in PySide6 and PyQt6.

https://github.com/ucam-department-of-psychiatry/camcops/blob/master/tablet_qt/layouts/

Do you know if there is a Python wrapper for your layouts published anywhere?

RudolfCardinal commented 7 months ago

Thanks (and for catching the broken link)! Yes, it's a challenge. I suspect the Qt layouts were designed mainly for "constant aspect ratio" height-for-width widgets, with height proportional to width, rather than "(approximately) constant area" ones, where height is inversely proportional to width, and it's a particular challenge for text because the relationship isn't so simple. Anyway, I'm afraid I'm not aware of any PySide or PyQt support for our versions. I presume the wrappers themselves are not likely to be too complex. However, I guess that maintaining an extension to the Python tools for an unsupported extension to Qt may be challenging in the long run. I don't know whether the Qt team would accept this kind of modification into the core product, but I imagine that'd have the highest chance of long-term integration. (Closing here but maybe a thing to raise with Qt?)

jamesdbrock commented 7 months ago

I doubt Qt would respond. I think it would be best for someone to publish a Python library with bindings to your C++ widgets and layouts. https://doc.qt.io/qtforpython-6/shiboken6/index.html

jamesdbrock commented 7 months ago

Your widgets and layouts are GPLv3 licensed, which means non-GPL projects cannot depend on them. Would you be willing to republish

with an LGPL license instead of GPLv3?

RudolfCardinal commented 7 months ago

@martinburchell Any complications with doing this that you can foresee? I think the original Qt code (license as quoted in our files) gives the option of GPL3 or LGPL3. Not obviously easier to split this into a separate repository. We could just change the license for this small set of files.

RudolfCardinal commented 7 months ago

Relevant files easily discoverable via find . -type f -exec egrep -l "(OPTIONAL LGPL)|(BSD LICENSE)" {} \;

RudolfCardinal commented 7 months ago

Done.