[Qt-interest] QTableView heading clicked

David Boosalis david.boosalis at gmail.com
Mon Sep 20 21:09:20 CEST 2010


Try this

MyTableView::MyTableView()
{
 QHeaderView *horHeader = horizontalHeader();
 connect(horHeader,SIGNAL(*sectionPressed <qheaderview.html#sectionPressed>*
 ( int )),
                this,SLOT(headerSelectedSlot(int)))
}
void MyTableView::headerSelecteedSlot(int index)
{
  // do action here
}


Note : horHeader also has slots for doubleClicked()
And of course you can capture this signal outside of the MyTableView as well


Hope this helps
-david

On Mon, Sep 20, 2010 at 6:50 AM, <nora at sappho-net.de> wrote:

> Am 20. September 2010 um 15:07:21 +0200 schrieb Marius Roets:
>
> > How do I catch and re-implement the event of the header row being clicked
> in
> > a QTableView. The QTableView clicked() signal is only triggered when
> > clicking on data cells.
>
> I've the following:
>
>   // QTableView *tbl;
>   // QHeaderView *hhdr;
>   ....
>   hhdr = tbl->horizontalHeader ();
>   ....
>   connect (hhdr, SIGNAL (sectionClicked (int)), this, SLOT (hdrClicked
> (int)));
>   ....
>
> Hope, this helps.
>
> Liebe Grüße, Nora.
>
> nora at nxe.de
>     IM-NETZ Neue Medien, Berlin                 http://www.im-netz.de/
>     WWW von Frauen für Frauen, Hamburg          http://www.w4w.net/
>     Lesbian Computer Networks, Helsinki         http://www.sappho.net/
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100920/fcbca96d/attachment.html 


More information about the Qt-interest-old mailing list