[Qt-interest] how can I get the event when the user click over the column name from QTableView
Michael Leupold
lemma at confuego.org
Thu Jul 30 16:18:26 CEST 2009
Mhayk Whandson wrote:
> On Thu, Jul 30, 2009 at 9:56 AM, Michael Leupold<lemma at confuego.org>
> wrote:
>> Mhayk Whandson wrote:
>>> I would like to receive a signal when the user click over the column
>>> name from QTableView, could you help me ?
>>
>> Use the QTableView::horizontalHeader() and connect to its
>> sectionClicked(int) signal.
>
> I would like to get the column number, are you know how can I do this
> after receive the clicked over the column name from QTableView ?
The column number is the argument of the signal:
QHeaderView::sectionClicked(int logicalIndex). AFAIK the logical index is
the index of the column in the header view's model, whereas the visualIndex
is the index in the display (they should be the same unless display columns
have been reordered). If you need the visualIndex you can transform the
logicalIndex using QHeaderView::visualIndex(int logicalIndex).
Regards,
Michael
More information about the Qt-interest-old
mailing list