[Qt-interest] QTableView with summary footer

Linos info at linos.es
Fri Sep 9 20:59:40 CEST 2011


El 09/09/11 18:50, Linos escribió:
> El 09/09/11 15:18, Linos escribió:
>>>
>>> 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
>>>
>>
>> Hi Andre,
>> 	i have tried today this way but i can't find a style sheet that make space
>> between the rows and the bottom scrollbar without break the internal painting of
>> the table.
>>
>> It only works well if i apply the stylesheet to the QTableView like this:
>>
>> QTableView { margin-bottom: 15px; }
>>
>> But then it creates the space below the scrollbar, i have tried with padding
>> too, any padding or margin applied to QAbstractScrollArea or the bottom
>> scrollbar seems to break the table painting routine.
>>
>> Any ideas on show should i apply the style sheet?
>>
> 
> I have accepted that the headerview will be below the horizontalScrollBar so i
> have adjusted the tableview margin with style sheet and now i can see my
> headerview but i have two problems.
> 
> 1) it show empty sections (without the text) no matter what i do, i have tried
> create a QStandardItemModel setting horizontal labels and i have tried too to
> use the same model of the table but it never show any text, it seems that
> QHeaderView needs to be attached to a QTableView or QTreeView to work as expected.
> 
> 2) I don't know how make the headerview follow the horizontalScrollbar.
> 
> Any ideas on how to fix that or a better idea on how to get the desired effect?
> 
> Regards,
> Miguel Angel.

I will compose a new widget, it seems this way QHeaderView works correctly, i
was trying to get the results subclassing QTableView, but it seems that finally
i will go the route of composing a new widget.

Thanks by the help.




More information about the Qt-interest-old mailing list