[Qt-interest] qtableview : is it possible to add an extra "filter row" above the header ?
david.jobet at free.fr
david.jobet at free.fr
Mon Dec 1 05:04:09 CET 2008
I was thinking, maybe it's possible to subclass qheaderview instead, then replace the horizontal header of the table by my own.
That way, it would :
- be in the scroll area
- QTableView::updateGeometries() would handle reserving enough space with setViewportMargins() for me
- I could then add my widgets and a headerview in a vertical layout in my reimplementation
Does it sound doable ?
Tx
David
----- Mail d'origine -----
De: Anthony Serdyukov <uksus70 at gmail.com>
À: qt-interest at trolltech.com
Envoyé: Mon, 1 Dec 2008 04:34:49 +0100 (CET)
Objet: Re: [Qt-interest] qtableview : is it possible to add an extra "filter row" above the header ?
I'd subclass QTableView. I think this is the way you should choose.
2008/11/30 <david.jobet at free.fr>:
> OK, I did understand well in that case.
> This is NOT something I want to do : I don't want those controls to be part of the table. (orthogonal stuff => must be separate)
>
> I just want them to be aligned with the table so that the user understand its use.
>
> It leaves me with only 1 choice if QT doesn't have an API :
> - implement a custom layout able to synchronize with header move/resize signals
>
> David
>
> ----- Mail d'origine -----
> De: Tiago Correia <tiago at cnotinfor.pt>
> À: qt-interest at trolltech.com
> Envoyé: Sun, 30 Nov 2008 06:09:17 +0100 (CET)
> Objet: Re: qtableview : is it possible to add an extra "filter row" above the header ?
>
> Hi,
> Delegates are only for dealing with the interaction between the user and the
> GUI. They allow you to add custom widgets (comboboxes, ...) on a cell. Check
> the classe QAbstractItemDelegate.
>
> This should be an easy way to create custom widgets for row 0. Just for
> methods you reimplement (editorEvent, paint, setEditor, setModaldata,
> createEditor), you must just do something if the row is equal 0, and do
> different things for each column.
>
> Then I said something wrong. You should create a class from
> QAbstractProxyModel, that would move your data a row below. Just reimplement
> the virtual fucntions and use the sibling methods from the QModelItem to get
> the item in row above (since row 1, should be the data form row 0)
>
> The only think that I think it is going to be difficult to do is to have the
> headers on the second row.
>
> On Sun, Nov 30, 2008 at 3:23 AM, <david.jobet at free.fr> wrote:
>
>> Now I'm confused, what exactly are you suggesting ?
>>
>> I've never used delegates previously, but my understanding was : delegates
>> are used to paint things in a different way.
>> Is there another use ?
>> So unless there is another use I don't really understand how I can use them
>> and I don't know what for ?
>> And how is it going to solve my problem ? (Which is to display my "control
>> filtering" widgets above the header of the table ?)
>>
>> Something like :
>> |combo1|lineedit2|...|comboP|
>> |header1|header2|...|headerP|
>> |data11 |data12 |...|data1P |
>> |data21 |data22 |...|data2P |
>> |... |... |...|... |
>> |dataN1 |dataN2 |...|dataNP |
>>
>> Thanks
>>
>> David
>>
>> ----- Mail d'origine -----
>> De: Tiago Correia <tiago at cnotinfor.pt>
>> À: david jobet <david.jobet at free.fr>
>> Envoyé: Sun, 30 Nov 2008 03:13:58 +0100 (CET)
>> Objet: Re: qtableview : is it possible to add an extra "filter row" above
>> the header ?
>>
>> OK, so my guess is that you will just need to extend the view class, so
>> that when you get an index for row 0, you change it to row 1. Then you
>> could
>> use delegates for these index on row 0.
>>
>> On Sun, Nov 30, 2008 at 2:05 AM, <david.jobet at free.fr> wrote:
>>
>> > No, as I said, I don't want to put it into row 0, because I want to
>> > separate the "filtering" from the content.
>> > The filtering being only a view/proxy thing, the model must not know
>> > anything about it.
>> >
>> > ----- Mail d'origine -----
>> > De: Tiago Correia <tiago at cnotinfor.pt>
>> > À: Qt Interest <qt-interest at trolltech.com>
>> > Envoyé: Sun, 30 Nov 2008 02:44:45 +0100 (CET)
>> > Objet: Re: qtableview : is it possible to add an extra "filter row" above
>> > the header ?
>> >
>> > Hi,
>> > Maybe a solution, might just by building special delegates, that for the
>> > indexes of row 0, will have a special beahviour.
>> >
>> > Also the model should reflect this, so for the row 0,the QIndexItem(s)
>> > should be different.
>> >
>> > On Sun, Nov 30, 2008 at 12:58 AM, <david.jobet at free.fr> wrote:
>> >
>> > > Hello,
>> > >
>> > > I hope I'm not too off here, I think I recall seeing it somewhere in
>> the
>> > qt
>> > > documentation, but I cannot find it again.
>> > >
>> > > To explain in more details :
>> > > - I have a table view with a custom model and a qsortfilterproxymodel
>> > > between the 2
>> > > - for each column of my table I want to add a control (a lineedit or a
>> > > combo) to be able to control the filtering of the content of my
>> tableview
>> > > - I want those controls to always be aligned with the table's column
>> > layout
>> > >
>> > > I could do a hack somewhere and make row 0 contain those controls, but
>> > I'd
>> > > prefer to separate the filtering controls from the table.
>> > > It would be great to be able to put those controls just above the
>> header.
>> > >
>> > > I guess I could put those controls above the table and resize them when
>> > my
>> > > table's header is resized, but I'm lazy ;-)
>> > > Do you know if qt's tableview/treeview have support for it ?
>> > >
>> > > Thanks
>> > >
>> > > David
>> > >
>> > > --
>> > > To unsubscribe - send a mail to qt-interest-request at trolltech.com with
>> > > "unsubscribe" in the subject or the body.
>> > > List archive and information: http://lists.trolltech.com/qt-interest/
>> > >
>> > >
>> >
>> >
>> > --
>> > Tiago Correia
>> > chief technology officer
>> >
>> > cnoti inovação & desenvolvimento – Aprendizagem enRiquecida pela
>> Tecnologia
>> > www.cnotinfor.pt
>> > Telefone: +351 239 499 231
>> >
>> > Subscreva gratuitamente a nossa Newsletter BICA – Boletim informativo de
>> > Interactividade, Comunicação e Aprendizagem
>> >
>> >
>>
>>
>> --
>> Tiago Correia
>> chief technology officer
>>
>> cnoti inovação & desenvolvimento – Aprendizagem enRiquecida pela Tecnologia
>> www.cnotinfor.pt
>> Telefone: +351 239 499 231
>>
>> Subscreva gratuitamente a nossa Newsletter BICA – Boletim informativo de
>> Interactividade, Comunicação e Aprendizagem
>>
>>
>
>
> --
> Tiago Correia
> chief technology officer
>
> cnoti inovação & desenvolvimento – Aprendizagem enRiquecida pela Tecnologia
> www.cnotinfor.pt
> Telefone: +351 239 499 231
>
> Subscreva gratuitamente a nossa Newsletter BICA – Boletim informativo de
> Interactividade, Comunicação e Aprendizagem
>
> --
> To unsubscribe - send a mail to qt-interest-request at trolltech.com with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
Regards,
Anthony
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list