[PyKDE] Re: QTableView vs QTableWidget (Andreas Pakulat)

Paulino paulino1 at sapo.pt
Wed Feb 7 01:19:37 GMT 2007


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
    <apaku at gmx.de> Subject: Re: [PyKDE] QTableView vs QTableWidget To:
    pykde at mats.imk.fraunhofer.de Message-ID:
    <20070201015341.GA31513 at morpheus.apaku.dnsalias.org> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070207/11ec2088/attachment.html


More information about the PyQt mailing list