[PySide] Form dialog subclassing QDialog

Jérôme jerome at jolimont.fr
Mon Mar 3 18:13:20 CET 2014


Hi.

Thank you all for your answers/precisions.

I adapted the code proposed by Aaron to my needs. I'm attaching the new
version.

I implemented Add, Edit, Remove, and even Copy (i.e. "Edit as new").

A few questions remain (and probably much more to come...).

Isn't there a data duplication in the TableModel class, with both the
buildings[] list, and the model's Items ? In practice, this is what I
was going to do since there will be attributes that are not values but
references to other custom classes instances. But although I was
expecting to do this, I suspected it might not be the best way.

I ended up removing the Controller and merging it with the Main window.
It looked simpler to me, but it might not be the best choice.

I also had to remove the TableView class, because the TableView is
already instanciated in the .py file generated by Qt Designer and I
didn't know how to do otherwise.

In practice, I now have a main window that acts both as view and
controller, and a building model. (Qt's doc talks about Model/View
programming.)

The whole {TableView + AddEditCopyRemove buttons} is meant to be used
extensively in this application, so it may become a custom widget.

There is currently no value check. At some point, the model would need
to be able to perform a check and return an error if, for instance, we
don't want two buildings with the same name. I suppose I'll find a way
using Exceptions.

Thanks again for your precious help. Things are clearer now and I'm not
stuck anymore.

Have a nice evening.

-- 
Jérôme
-------------- next part --------------
A non-text attachment was scrubbed...
Name: buildingSurvey.py
Type: text/x-c++
Size: 4332 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140303/8713ae8f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dialogBuilding.py
Type: text/x-c++
Size: 4389 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140303/8713ae8f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dialogBuilding.ui
Type: application/xml
Size: 3676 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140303/8713ae8f/attachment.wsdl>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mainwindow.py
Type: text/x-c++
Size: 4248 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140303/8713ae8f/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mainwindow.ui
Type: application/xml
Size: 2716 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140303/8713ae8f/attachment-0001.wsdl>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: building.py
Type: text/x-c++
Size: 3939 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140303/8713ae8f/attachment-0003.bin>


More information about the PySide mailing list