Thank You very much Andreas! So QTableWidget is more simple, but less powerfull than QTableView.
Date: Thu, 1 Feb 2007 02:53:41 +0100 From: Andreas Pakulat <[EMAIL PROTECTED]> Subject: Re: [PyKDE] QTableView vs QTableWidget To: [email protected] Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=us-ascii On 01.02.07 01:20:40, Paulino wrote:
> It's an invoicing app that I'm working on. The main dialog, will send data to > several tables: invoices, invoices lines, products, customers. > > What is the best approach: > > The QSqlQueryModel with writing flags and QtableView or QtableWidget? What are > the pro's and con's of each?
Well, view's are meant to be used with models and give you the full control over their behaviour, however it takes more time to understand all parts. Widgets on the other hand hide a good part of the model-stuff but allow for much easier setup of simple stuff like showing a small table of items.
> In the first one I don't see yet how I can handle the multiple inserts and > updates.
You mean you want to insert multiple new rows at once? no problem, create a button for that and call the models insertRows() function (button may be a context menu entry too). As for updates, like setting all values of a column to a specific value, same thing except this time you'd have to call the models setData() for each row and the changed column.
> QValidators don't seem to work with cells of both widgets, I have to implement > the method by hand?
If you want a validator on the input create a custom delegate which provides a lineedit (or whatever you want there) widget which has a validator set on it as editing widget. Andreas
_______________________________________________ PyKDE mailing list [email protected] http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
