[Qt-interest] QTableView with summary footer

Linos info at linos.es
Wed Sep 7 11:19:43 CEST 2011


El 07/09/11 09:35, André Somers escribió:
> Hi,
> 
> On Wed, Sep 7, 2011 at 9:07 AM, Linos <info at linos.es <mailto:info at linos.es>> wrote:
> 
>     El 07/09/11 09:03, Giuseppe D'Angelo escribió:
>     > On Tue, Sep 6, 2011 at 7:02 PM, Linos <info at linos.es
>     <mailto:info at linos.es>> wrote:
>     >> Hi,
>     >>        i am trying to create a QTableView subclass that allows me to show a
>     >> QHeaderView inside the viewport (above the horizontal scrollbar) with summary
>     >> data of the columns of the model, but i am getting a difficult time
>     getting this
>     >> to work, anyone have created something like this and can point me in the
>     correct
>     >> direction please? Thanks.
>     >
>     > Did you try with the same approach of the frozen column example?
>     > http://doc.qt.nokia.com/4.7/itemviews-frozencolumn.html
>     >
>     > Cheers,
> 
>     No, i saw the example but i would like to have a summary QHeaderView in footer,
>     not a frozen row with summary values, apart from the visual difference i would
>     like to attach any model to the table (Ex: QSqlQueryModel) without attach the
>     model to a proxy where i would calculate this last frozen row summary values.
> 
> 
> What you could do is a little bit of style sheet magic to make space in the
> QTableView on the bottom of the view. That way, you have space to put your
> header/footer there (or draw your own stuff or put some other widget there), and
> it will look like a proper single widget. Of course, it is up to you to make
> sure the column widths match, but that seems solveable. I used the same
> technique to slide up passive notifications into QScrollArea based widgets
> before, and it works quite nicely.
> 
> Andre
> 

I had not thought on use Style sheets to do that but if this works i like the
idea, i will try this and the other ideas and will see what works better (or
cleaner). Thanks.

Miguel Angel.




More information about the Qt-interest-old mailing list