Hi all,

I have been attempting to port a small app from PyQt6 to PySide6, in part in 
order to use the more pythonic syntax enabled recently by:

from __feature__ import true_property, snake_case

Changing the syntax took a while but was eventually sorted. However, running 
the program resulted in a window appearing with the correct name but no widgets 
whatsoever. Diagnosing the issue took me quite a while but in the end I figured 
out that to set the layout of a widget and then make it the central widget it 
is apparently required to write:

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
...
        main_layout = QVBoxLayout()
layout_widget = QWidget()
        layout_widget.set_layout(main_layout)
        self.set_central_widget(layout_widget)

However, given that setter/getter methods of the form setText(info) has become 
set_text = info, I expected the syntax for setting a layout or central widget 
to be analogous i.e.:
...
        layout_widget.layout = main_layout
        self.central_widget = layout_widget

Is this intended behaviour or an oversight? If intended, why should setting a 
layout/widget be different to setting text or setting a widget to be enabled?

Kind regards,

Matt
_______________________________________________
PySide mailing list
PySide@qt-project.org
https://lists.qt-project.org/listinfo/pyside

Reply via email to