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. Zoom Crash Bug for Qt Spectrogram
Forum Update on Monday, May 27th 2025

Zoom Crash Bug for Qt Spectrogram

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.0k 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.
  • Y Offline
    Y Offline
    Yippiyak
    wrote on last edited by Yippiyak
    #1

    Hello All,
    I have fixed many of the performance issues on my program, but now I am encountering a crash anytime I attempt to zoom in on the data on my spectrogram. I am using Qt Charts, and there is an exception thrown when I zoom in that says I am dividing by zero. Does anyone know what may cause this issue, or how I would go about locating the bug in my program? I am new to Qt, so bear with me.

    Joseph

    jsulmJ 1 Reply Last reply
    0
    • Y Yippiyak

      Hello All,
      I have fixed many of the performance issues on my program, but now I am encountering a crash anytime I attempt to zoom in on the data on my spectrogram. I am using Qt Charts, and there is an exception thrown when I zoom in that says I am dividing by zero. Does anyone know what may cause this issue, or how I would go about locating the bug in my program? I am new to Qt, so bear with me.

      Joseph

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Yippiyak To locate a bug in your program you should use the debugger (from QtCreator). Also you can show the code where you do the zooming.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Y 1 Reply Last reply
      3
      • jsulmJ jsulm

        @Yippiyak To locate a bug in your program you should use the debugger (from QtCreator). Also you can show the code where you do the zooming.

        Y Offline
        Y Offline
        Yippiyak
        wrote on last edited by Yippiyak
        #3

        @jsulm
        So I did some debugging and I figured out that this function:

        void WaterfallDisplay::resetImage()
        {
        m_image = QImage();
        }

        which was intended to reset the image upon zooming in, returns a division by zero error elsewhere in the code, as it reduces the height to 0. Any idea on a way I can reset the image, but prevent the height from getting messed up?

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

          Hi,

          You can try with:

          m_image = QImage(1, 1, m_image.format());
          

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

          Y 1 Reply Last reply
          3
          • SGaistS SGaist

            Hi,

            You can try with:

            m_image = QImage(1, 1, m_image.format());
            
            Y Offline
            Y Offline
            Yippiyak
            wrote on last edited by
            #5

            @SGaist
            Youre the GOAT!
            That worked for the most part, but incase someone else stumbles upon this thread here was my final implementation:

            void WaterfallDisplay::resetImage()
            {
            m_image = QImage(m_image.width(),m_image.height(), m_image.format());
            m_image.fill(QColor(0,0,0,0));
            m_currentDrawingLine = 0;
            m_linesDrawn = 0;
            m_pastOneScreen = false;

            m_startTimer = true;
            }

            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