PDA

View Full Version : How to get QTableView position



waynew
30th January 2010, 01:36
I need to get the position of a QTableView.
The view has already been instantiated in a MainWindow function.
I have no problem referencing it in other MainWindow functions.

Here is what I have tried:



QPoint logPos = MainWindow::view->pos();
int xLog = MainWindow::view->logPos.x();
int yLog = MainWindow::view->logPos.y();


The error I get is: 'class QTableView' has no member named 'logPos'
I understand the error, but I don't know how to correct the code.
When I do similar code for MainWindow position, it works fine.
Any suggestions considered :)

aamer4yu
30th January 2010, 06:57
Shouldn't the code be -

QPoint logPos = MainWindow::view->pos();
int xLog = logPos.x();
int yLog = logPos.y();
:rolleyes:
No doubt you get the error that logPos is not a member of mainwindow :)

waynew
30th January 2010, 13:55
Of course. Thanks aamer4yu, it works fine now.