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 get QChart XY position?
Forum Updated to NodeBB v4.3 + New Features

How to get QChart XY position?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 189 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.
  • L Offline
    L Offline
    LISP
    wrote on last edited by
    #1

    I want to trigger an event when the mouse is in the area of the chart.

    void MainWindow::wheelEvent(QWheelEvent *event) {
    if(chart->rect().contains(event->pos())) {
    qDebug()<<"in chart!";
    }
    }
    However, it is different from the actual location on the screen.
    How can I get the coordinate value of the chart area on the screen?

    Pl45m4P 1 Reply Last reply
    0
    • L LISP

      I want to trigger an event when the mouse is in the area of the chart.

      void MainWindow::wheelEvent(QWheelEvent *event) {
      if(chart->rect().contains(event->pos())) {
      qDebug()<<"in chart!";
      }
      }
      However, it is different from the actual location on the screen.
      How can I get the coordinate value of the chart area on the screen?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @LISP said in How to get QChart XY position?:

      event->pos()

      Different coodinate system.

      -> mapToGlobal

      • https://doc.qt.io/qt-5/qwidget.html#mapToGlobal

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1

      • Login

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