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. How to add hover for lines on a QChart
QtWS25 Last Chance

How to add hover for lines on a QChart

Scheduled Pinned Locked Moved Unsolved General and Desktop
qchartqgraphicsitemhhovertooltip
2 Posts 1 Posters 1.1k Views
  • 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.
  • M Offline
    M Offline
    mmikeinsantarosa
    wrote on 2 Jul 2020, 18:37 last edited by
    #1

    I'd like to add tooltip hover to expose the X/Y values over any line in a QChart. I'm trying to follow the example "callout" that ships with my Qt-12.6.
    For starters my chart GUI uses

    class HtcChart : public QMainWindow
    {
        Q_OBJECT
    
    and the example uses
    class Callout : public QGraphicsItem
    { 
    

    My QMainwindow includes buttons and the QGraphicsItem doesn't.

    I'm kind of lost in translating what I need to get into my HtcChart.

    Maybe one piece at a time.

    What do I need to add to my QChart/subclassed QChart construction to capture the hover.

    The example connects signals & slots as series are added and I have an iterator where I add series lines so I have a place to do the connections, I'm just really not sure what else needs to be in place for the rest of it to work.

    Any advice or pointers or other examples would be much appreciated.

    Thanks - Mike

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mmikeinsantarosa
      wrote on 2 Jul 2020, 21:13 last edited by
      #2

      How about a basic tip?
      I construct a QChart and render it on a QMainWindow using

      chartView = new QChartView(_chart);
      

      using baby steps here, I figured I could trap the chartViewws-> mouseMoveEvent by connecting it up to a slot:

      connect(this, SIGNAL(chartView->mouseMoveEvent(QMouseEvent*)),  this,SLOT(showPointToolTip(QMouseEvent*)));
      

      but I get

      No such signal HtcChart::chartView->mouseMoveEvent(QMouseEvent*)
      
      1 Reply Last reply
      0

      1/2

      2 Jul 2020, 18:37

      • Login

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