Re: [Interest] new TableView columns hiding

2018-10-24 Thread Vlad Stelmahovsky

just to clarify, its about QML's TableView, not widget's QTableView

On 10/24/18 6:05 PM, Christian Ehrlicher wrote:

Am 24.10.2018 um 10:26 schrieb Shawn Rutledge:

ue (have no idea, why)
Why: because the layout algorithm could have a bad edge case if some columns 
are zero-width.  (It keeps trying to fill the width of the view, but maybe it 
will never get there?)
You not talk about QHeaderView but I think the codebase may be derived 
from it:


void QHeaderView::resizeSection(int /logicalIndex/, int /size/)
Resizes the section specified by /logicalIndex/ to /size/ measured in 
pixels. The size parameter must be a value larger or equal to zero. A 
size equal to zero is however not recommended. In that situation 
hideSection  
should be used instead.



Christian

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] new TableView columns hiding

2018-10-24 Thread Christian Ehrlicher

Am 24.10.2018 um 10:26 schrieb Shawn Rutledge:

ue (have no idea, why)
Why: because the layout algorithm could have a bad edge case if some columns 
are zero-width.  (It keeps trying to fill the width of the view, but maybe it 
will never get there?)
You not talk about QHeaderView but I think the codebase may be derived 
from it:


void QHeaderView::resizeSection(int /logicalIndex/, int /size/)
Resizes the section specified by /logicalIndex/ to /size/ measured in 
pixels. The size parameter must be a value larger or equal to zero. A 
size equal to zero is however not recommended. In that situation 
hideSection  should 
be used instead.



Christian
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] new TableView columns hiding

2018-10-24 Thread Shawn Rutledge

> On 24 Oct 2018, at 09:24, Vlad Stelmahovsky  
> wrote:
> 
> Hi all
> 
> investigating new TableView, added to 5.12 and have a question: is it 
> possible to hide some columns dynamically w/o modify model?
> 
> bruteforce way to set column width to 0 doesnt works, because its checking 
> width and force set it to some minimal value (have no idea, why)

Why: because the layout algorithm could have a bad edge case if some columns 
are zero-width.  (It keeps trying to fill the width of the view, but maybe it 
will never get there?)

I ran into that while preparing for my QtWS talk about TableView.  But I needed 
to subclass QSortFilterProxyModel anyway, to have sorting and filtering; so it 
was also not too hard to change the columns there by overriding mapFromSource 
and mapToSource.  You could think of your QSortFilterProxyModel subclass as a 
“view model”, and use it do whatever corrections you need to make to the 
original model to make it presentable.  At least that’s what I came up with for 
now.

https://github.com/ec1oud/qps/blob/unsquashed/qtquick/sortfilterprocessmodel.cpp

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


[Interest] new TableView columns hiding

2018-10-24 Thread Vlad Stelmahovsky

Hi all

investigating new TableView, added to 5.12 and have a question: is it 
possible to hide some columns dynamically w/o modify model?


bruteforce way to set column width to 0 doesnt works, because its 
checking width and force set it to some minimal value (have no idea, why)



br,

Vlad

___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest