Qt-interest Archive, May 2008
swap headers in QTableView
Message 1 in thread
Hello,
I have a QTreeView (with 4 columns) which displays the contents of a model.
I'm only displaying the horizontal header of the tree view. Now, instead of
displaying the header normally (i.e. using the method headerData()) I would
like to place 4 combo boxes to the corresponding 4 sections of the header.
Is such thing possible? Could you please provide me with some code hints?
Thank you in advance
--
[ signature omitted ]
Message 2 in thread
i doubt it's a good idea to try and force the QHeaderView into doing this.
Instead, you could hide the header away and show comboboxes items in the first line of data, using delegates:
http://doc.trolltech.com/4.3/model-view-delegate.html
Cheers,
Peter
> -----Ursprüngliche Nachricht-----
> Von: Nikos Geronitidis [mailto:geronik444@xxxxxxxxx]
> Gesendet: Mittwoch, 21. Mai 2008 18:16
> An: qt-interest@xxxxxxxxxxxxx
> Betreff: swap headers in QTableView
>
> Hello,
>
> I have a QTreeView (with 4 columns) which displays the
> contents of a model.
> I'm only displaying the horizontal header of the tree view.
> Now, instead of
> displaying the header normally (i.e. using the method
> headerData()) I would
> like to place 4 combo boxes to the corresponding 4 sections
> of the header.
> Is such thing possible? Could you please provide me with some
> code hints?
>
> Thank you in advance
>
> --
> Best Regards
> Nikos Gerontidis
>
--
[ signature omitted ]
Message 3 in thread
Thanks for the advice, I ll try the Comboboxes way..
Another question is related with QTableView. What is the easiest way to do
the following in a QTableView:
X| A B C
--------------
D|
E|
F|
convert to:
X| D E F
--------------
A|
B|
C|
To be more accurate, I have a QSqlTableModel via which I populate a
QTableView. Now instead of showing the database entries (records) in each
row of the view, I would like to show them in every column of the view.
Thank you in advance
On Wed, May 21, 2008 at 7:27 PM, Peter Prade <prade@xxxxxxxxxxx> wrote:
> i doubt it's a good idea to try and force the QHeaderView into doing this.
> Instead, you could hide the header away and show comboboxes items in the
> first line of data, using delegates:
> http://doc.trolltech.com/4.3/model-view-delegate.html
>
> Cheers,
> Peter
>
> > -----Ursprüngliche Nachricht-----
> > Von: Nikos Geronitidis [mailto:geronik444@xxxxxxxxx]
> > Gesendet: Mittwoch, 21. Mai 2008 18:16
> > An: qt-interest@xxxxxxxxxxxxx
> > Betreff: swap headers in QTableView
> >
> > Hello,
> >
> > I have a QTreeView (with 4 columns) which displays the
> > contents of a model.
> > I'm only displaying the horizontal header of the tree view.
> > Now, instead of
> > displaying the header normally (i.e. using the method
> > headerData()) I would
> > like to place 4 combo boxes to the corresponding 4 sections
> > of the header.
> > Is such thing possible? Could you please provide me with some
> > code hints?
> >
> > Thank you in advance
> >
> > --
> > Best Regards
> > Nikos Gerontidis
> >
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 4 in thread
Google is your friend:
http://wiki.qtcentre.org/index.php?title=Transpose_Proxy_Model
http://doc.trolltech.com/4.3/qabstractproxymodel.html
Cheers,
Peter
> -----Ursprüngliche Nachricht-----
> Von: Nikos Geronitidis [mailto:geronik444@xxxxxxxxx]
> Gesendet: Mittwoch, 21. Mai 2008 18:37
> An: qt-interest@xxxxxxxxxxxxx
> Betreff: Re: swap headers in QTableView
>
> Thanks for the advice, I ll try the Comboboxes way..
> Another question is related with QTableView. What is the
> easiest way to do the following in a QTableView:
>
> X| A B C
> --------------
> D|
> E|
> F|
>
> convert to:
>
> X| D E F
> --------------
> A|
> B|
> C|
>
>
> To be more accurate, I have a QSqlTableModel via which I
> populate a QTableView. Now instead of showing the database
> entries (records) in each row of the view, I would like to
> show them in every column of the view.
>
> Thank you in advance
>
>
> On Wed, May 21, 2008 at 7:27 PM, Peter Prade
> <prade@xxxxxxxxxxx> wrote:
>
>
> i doubt it's a good idea to try and force the
> QHeaderView into doing this.
> Instead, you could hide the header away and show
> comboboxes items in the first line of data, using delegates:
> http://doc.trolltech.com/4.3/model-view-delegate.html
>
> Cheers,
> Peter
>
> > -----Ursprüngliche Nachricht-----
> > Von: Nikos Geronitidis [mailto:geronik444@xxxxxxxxx]
> > Gesendet: Mittwoch, 21. Mai 2008 18:16
> > An: qt-interest@xxxxxxxxxxxxx
> > Betreff: swap headers in QTableView
>
> >
> > Hello,
> >
> > I have a QTreeView (with 4 columns) which displays the
> > contents of a model.
> > I'm only displaying the horizontal header of the tree view.
> > Now, instead of
> > displaying the header normally (i.e. using the method
> > headerData()) I would
> > like to place 4 combo boxes to the corresponding 4 sections
> > of the header.
> > Is such thing possible? Could you please provide me with some
> > code hints?
> >
> > Thank you in advance
> >
> > --
> > Best Regards
> > Nikos Gerontidis
> >
>
>
> --
> To unsubscribe - send a mail to
> qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the
> subject or the body.
> List archive and information:
> http://lists.trolltech.com/qt-interest/
>
>
>
>
>
>
> --
> Best Regards
> Nikos Gerontidis
>
--
[ signature omitted ]
Message 5 in thread
Yes that's it. Using a QAbstractProxyModel gives me a solution..
Thanks again guys
On Wed, May 21, 2008 at 7:47 PM, Peter Prade <prade@xxxxxxxxxxx> wrote:
> Google is your friend:
>
> http://wiki.qtcentre.org/index.php?title=Transpose_Proxy_Model
>
> http://doc.trolltech.com/4.3/qabstractproxymodel.html
>
> Cheers,
> Peter
>
> > -----Ursprüngliche Nachricht-----
> > Von: Nikos Geronitidis [mailto:geronik444@xxxxxxxxx]
> > Gesendet: Mittwoch, 21. Mai 2008 18:37
> > An: qt-interest@xxxxxxxxxxxxx
> > Betreff: Re: swap headers in QTableView
> >
> > Thanks for the advice, I ll try the Comboboxes way..
> > Another question is related with QTableView. What is the
> > easiest way to do the following in a QTableView:
> >
> > X| A B C
> > --------------
> > D|
> > E|
> > F|
> >
> > convert to:
> >
> > X| D E F
> > --------------
> > A|
> > B|
> > C|
> >
> >
> > To be more accurate, I have a QSqlTableModel via which I
> > populate a QTableView. Now instead of showing the database
> > entries (records) in each row of the view, I would like to
> > show them in every column of the view.
> >
> > Thank you in advance
> >
> >
> > On Wed, May 21, 2008 at 7:27 PM, Peter Prade
> > <prade@xxxxxxxxxxx> wrote:
> >
> >
> > i doubt it's a good idea to try and force the
> > QHeaderView into doing this.
> > Instead, you could hide the header away and show
> > comboboxes items in the first line of data, using delegates:
> > http://doc.trolltech.com/4.3/model-view-delegate.html
> >
> > Cheers,
> > Peter
> >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Nikos Geronitidis [mailto:geronik444@xxxxxxxxx]
> > > Gesendet: Mittwoch, 21. Mai 2008 18:16
> > > An: qt-interest@xxxxxxxxxxxxx
> > > Betreff: swap headers in QTableView
> >
> > >
> > > Hello,
> > >
> > > I have a QTreeView (with 4 columns) which displays the
> > > contents of a model.
> > > I'm only displaying the horizontal header of the tree view.
> > > Now, instead of
> > > displaying the header normally (i.e. using the method
> > > headerData()) I would
> > > like to place 4 combo boxes to the corresponding 4 sections
> > > of the header.
> > > Is such thing possible? Could you please provide me with some
> > > code hints?
> > >
> > > Thank you in advance
> > >
> > > --
> > > Best Regards
> > > Nikos Gerontidis
> > >
> >
> >
> > --
> > To unsubscribe - send a mail to
> > qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the
> > subject or the body.
> > List archive and information:
> > http://lists.trolltech.com/qt-interest/
> >
> >
> >
> >
> >
> >
> > --
> > Best Regards
> > Nikos Gerontidis
> >
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Message 6 in thread
On May 21, 2008, at 12:15 PM, Nikos Geronitidis wrote:
> I have a QTreeView (with 4 columns) which displays the contents of
> a model.
> I'm only displaying the horizontal header of the tree view. Now,
> instead of
> displaying the header normally (i.e. using the method headerData())
> I would
> like to place 4 combo boxes to the corresponding 4 sections of the
> header.
> Is such thing possible? Could you please provide me with some code
> hints?
Since QHeaderView is a subclass of QAbstractItemView, you should be
able to place any QWidget you want by calling
QAbstractItemView::setIndexWidget(). Note that I have not done this
on QHeaderView instances, only on a QTreeView instance and with a
QPushButton. Works great!
Brad
--
[ signature omitted ]
Message 7 in thread
I hadn't noticed the QAbstractItemView::setIndexWidget() function.. I think
it will work great..
Thanks again
On Wed, May 21, 2008 at 7:30 PM, Brad Howes <howes@xxxxxxxxxx> wrote:
> On May 21, 2008, at 12:15 PM, Nikos Geronitidis wrote:
>
> I have a QTreeView (with 4 columns) which displays the contents of a model.
>
> I'm only displaying the horizontal header of the tree view. Now, instead of
>
> displaying the header normally (i.e. using the method headerData()) I would
> like to place 4 combo boxes to the corresponding 4 sections of the header.
> Is such thing possible? Could you please provide me with some code hints?
>
>
> Since QHeaderView is a subclass of QAbstractItemView, you should be able to
> place any QWidget you want by calling QAbstractItemView::setIndexWidget().
> Note that I have not done this on QHeaderView instances, only on a QTreeView
> instance and with a QPushButton. Works great!
>
> Brad
>
> --
> Brad Howes
> Group 42
> MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
> Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420
>
>
>
>
>
--
[ signature omitted ]