Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Learn what row is under the mouse in QAbstractTableModel? [Solved]
Forum Updated to NodeBB v4.3 + New Features

Learn what row is under the mouse in QAbstractTableModel? [Solved]

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dcortesi
    wrote on last edited by
    #1

    In a QAbstractTableModel, for one particular column I would like to return different toolTip data depending on the row under the mouse.

    My problem was just confusion -- I need to return ToolTip data from the data() method, which does receive the row number. Not from headerData.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I might be wrong, but when data is called for a tooltip, doesn't the index provided contain the right row/col information ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dcortesi
        wrote on last edited by
        #3

        Alas no, the signature is "QAbstractItemModel::headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole )" where "section" is the column number for horizontal orientation.

        You are correct the "section" is row number for vertical orientation, I will investigate when that orientation is presented.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Sorry I misread the signature...
          Then I'm not sure I understand what you want to achieve.

          You're hovering with your mouse over the horizontal table header and want to make it show a tooltip dependent of the row you're on with the mouse ? Then would you not be hovering over the table rather than the header ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved