diff --git a/spectrogramplot.cpp b/spectrogramplot.cpp index 295d1c0..e3f38d1 100644 --- a/spectrogramplot.cpp +++ b/spectrogramplot.cpp @@ -128,34 +128,6 @@ void SpectrogramPlot::paintFront(QPainter &painter, QRect &rect, range_t } - -/*void SpectrogramPlot::paintEvent(QPaintEvent *event) -{ - QRect rect = event->rect(); - QPainter painter(this); - painter.fillRect(rect, Qt::black); - - if (inputSource != nullptr) { - int height = rect.height(); - off_t y = rect.y(); - - QImage image(fftSize, height, QImage::Format_RGB32); - - while (height > 0) { - int tileOffset = y % linesPerTile(); // To handle drawing a partial first tile - int drawHeight = std::min(linesPerTile() - tileOffset, height); // Draw rest of first tile, full tile, or partial final tile - off_t tileId = lineToSample(y - tileOffset); - QPixmap *tile = getPixmapTile(tileId); - painter.drawPixmap(QRect(0, y, fftSize, drawHeight), *tile, QRect(0, tileOffset, fftSize, drawHeight)); - y += drawHeight; - height -= drawHeight; - } - - paintTimeAxis(&painter, rect); - paintCursors(&painter, rect); - } -}*/ - QPixmap* SpectrogramPlot::getPixmapTile(off_t tile) { QPixmap *obj = pixmapCache.object(TileCacheKey(fftSize, zoomLevel, tile)); @@ -236,26 +208,6 @@ void SpectrogramPlot::paintCursors(QPainter *painter, QRect rect) } } -void SpectrogramPlot::paintTimeAxis(QPainter *painter, QRect rect) -{ - if (timeScaleIsEnabled) { - // Round up for firstLine and round each to nearest linesPerGraduation - int firstLine = ((rect.y() + linesPerGraduation - 1) / linesPerGraduation) * linesPerGraduation; - int lastLine = ((rect.y() + rect.height()) / linesPerGraduation) * linesPerGraduation; - - painter->save(); - QPen pen(Qt::white, 1, Qt::SolidLine); - painter->setPen(pen); - QFontMetrics fm(painter->font()); - int textOffset = fm.ascent() / 2 - 1; - for (int line = firstLine; line <= lastLine; line += linesPerGraduation) { - painter->drawLine(0, line, 10, line); - painter->drawText(12, line + textOffset, sampleToTime(lineToSample(line))); - } - painter->restore(); - } -} - void SpectrogramPlot::setSampleRate(int rate) { sampleRate = rate; diff --git a/spectrogramplot.h b/spectrogramplot.h index cc11272..e4e8f2d 100644 --- a/spectrogramplot.h +++ b/spectrogramplot.h @@ -69,7 +69,6 @@ public slots: void update() { emit needUpdate(); }; protected: - void paintEvent(QPaintEvent *event); void mouseReleaseEvent(QMouseEvent * event); void mouseMoveEvent(QMouseEvent * event); void mousePressEvent(QMouseEvent * event); @@ -99,7 +98,6 @@ private: QPixmap* getPixmapTile(off_t tile); float* getFFTTile(off_t tile); void getLine(float *dest, off_t sample); - void paintTimeAxis(QPainter *painter, QRect rect); void paintCursors(QPainter *painter, QRect rect); int sampleToLine(off_t sample); QString sampleToTime(off_t sample);