PDA

View Full Version : How to map Viewport coordinates to content coordinates in QTableView



kalos80
15th March 2010, 10:43
Hi all,

I did not find a way to map viewport coordinates to content coordinates in QTableView.

In Qt 3 I was using viewportToContents() function, but I did not find a similar function in Qt4.

I would be really glad you if someone could suggest me what to use.

Thanks in advance,
Calogero

zgulser
15th March 2010, 11:13
Hi,

Maybe you can try to catch mouse move event inside your widget?

kalos80
15th March 2010, 13:16
Hi zgulser,

Thanks for your reply.

I'm already doing that, but the coordinates I'm getting are viewport coordinates. I'd like to know a way to translate those coordinates into content coordinates.

wysota
15th March 2010, 14:12
The coordinates of the widget representing the viewport can be mapped to the coordinates in the content space by adding (or substracting, based on the mapping direction) values of respective scroll bars.

kalos80
18th March 2010, 10:11
wysota,
thank you very much for you hint.

It is really helpfull!