Results 1 to 2 of 2

Thread: Innacurate QModelIndex computations

  1. #1
    Join Date
    Dec 2010
    Location
    Russia
    Posts
    83
    Thanks
    1
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Innacurate QModelIndex computations

    So the thing is that i need to call a menu on a per-item basis, and one of the ways i've found so far was this:

    Set table's parent context menu policy to Qt::CustomContextMenu
    Connect customContextMenuRequested(const QPoint&) signal with a custom slot
    Get the underlying item index via the
    QModelIndex QAbstractItemView::indexAt ( const QPoint & point )

    But somehow the index i get doesn't always belong to the item i clicked on. I mean,if i right-click in the center of an item:no problems.But as i move closer to the upper or lower edget of it...things start getting worse.

    So maybe there are some options available or smth.Any tips are greatly appreciated!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Innacurate QModelIndex computations

    You are mixing two coordinate systems - that of the view and that of its viewport.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    AlexSudnik (18th February 2011)

Similar Threads

  1. QModelIndex question?
    By QXiaoWang in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2010, 08:47
  2. getting data & QModelIndex
    By alexandernst in forum Newbie
    Replies: 3
    Last Post: 6th August 2009, 19:43
  3. Problem with QModelIndex
    By Kesy in forum Qt Programming
    Replies: 6
    Last Post: 30th October 2008, 08:44
  4. Replies: 1
    Last Post: 28th September 2008, 21:00
  5. MainWindow update during computations
    By Gizmho in forum Qt Programming
    Replies: 7
    Last Post: 13th July 2006, 20:10

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.