Results 1 to 3 of 3

Thread: How to get QTableView position

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default How to get QTableView position

    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:

    Qt Code:
    1. QPoint logPos = MainWindow::view->pos();
    2. int xLog = MainWindow::view->logPos.x();
    3. int yLog = MainWindow::view->logPos.y();
    To copy to clipboard, switch view to plain text mode 

    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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to get QTableView position

    Shouldn't the code be -
    Qt Code:
    1. QPoint logPos = MainWindow::view->pos();
    2. int xLog = logPos.x();
    3. int yLog = logPos.y();
    To copy to clipboard, switch view to plain text mode 

    No doubt you get the error that logPos is not a member of mainwindow

  3. The following user says thank you to aamer4yu for this useful post:

    waynew (30th January 2010)

  4. #3
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get QTableView position

    Of course. Thanks aamer4yu, it works fine now.

Similar Threads

  1. Icon position
    By Stobie in forum Qt Programming
    Replies: 2
    Last Post: 7th December 2009, 04:49
  2. Replies: 2
    Last Post: 26th November 2009, 04:45
  3. QGridLayout XY position
    By paule22 in forum Newbie
    Replies: 2
    Last Post: 9th August 2008, 18:42
  4. Index (position) changed on saving with QTableView
    By Auryn in forum Qt Programming
    Replies: 2
    Last Post: 22nd July 2008, 08:15
  5. set Position
    By mickey in forum Newbie
    Replies: 3
    Last Post: 17th June 2006, 21:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.