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. Qt Charts zoom signal is missing

Qt Charts zoom signal is missing

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.3k Views 2 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.
  • F Offline
    F Offline
    FdLSifu
    wrote on last edited by
    #1

    Hi,

    I am working on a signal viewer powered by Qt Charts. I manipulate dozen of curves with 65 Millions points and OpenGL is not sufficent.
    So I have to downsample, I have written an algorithm that plot only ymin & ymax of a high density area thus plotting only my window pixel width.

    Problem comes when I zoom, I am able to zoom through mouse and keyboard but I cannot find a correct signal where I can plug a slot for updating my downsampling.

    An idea is to do it while grabbing keyboard and mouse event but it is not clean as it will lag my UI.

    Any ideas ?

    Thanks!!!

    1 Reply Last reply
    0
    • F Offline
      F Offline
      FdLSifu
      wrote on last edited by FdLSifu
      #2

      As I found the solution, I will respond to myself.

      I have a QChart inside a QChartView. A zoom is a X axis range change, but QChart has a QAbstractAxis with no signal refering to X Axis range change.

      The trick was to static_cast<QValueAxis *>(chart()->axisX()), then we have access to &QValueAxis::rangeChanged signal which is emitted for each zoomIn or zoomOut. It gives you the new visible range from which I determine a new width to compute my downsample.

      Solved!

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

        Hi and welcome to devnet,

        You should use qobject_cast when casting QObject based classes.

        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
        • F Offline
          F Offline
          FdLSifu
          wrote on last edited by
          #4

          I applied your suggestion. Thanks

          What it is the difference btw ? qobject_cast is the equivalent of static_cast for QObject ?

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

            More or less. static_cast doesn't do any check. With it you basically just tell the computer what the object should be.

            qobject_cast verifies that the object you are casting is of the right type or at least one subclass of the type you pass as template parameter.

            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