[PySide] Form dialog subclassing QDialog

Stefan Champailler schampailler at skynet.be
Sat Mar 8 11:07:24 CET 2014

Didn't chaeck everything but I'm under the impression you're going 
through the kind of questions I had three years ago..

In Qt, the model and view are clearly separated. However, some 
components provide "default model" (I think QTableView does that).
So, they actually implements the model for you... In the beginning this 
confused me because those default models "hid" the regular one. And that 
made my code a bit awkward...

my 0.0000002 eurocents

On 03/03/2014 06:13 PM, Jérôme wrote:
> 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.
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside

Timeo Danaos et dona ferentes
Twitter @Arakowa1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140308/416b368f/attachment.html>

More information about the PySide mailing list