2023-04-29 Fred Gleason <fredg@paravelsystems.com>

* Added a 'RDWidget::setBackgroundPixmap()' method.
	* Fixed a bug in the voice tracker in rdairplay(1) that caused the
	the track waveform areas to be painted solid black.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2023-04-29 13:20:54 -04:00
parent 8a679e2733
commit b18da6a1aa
11 changed files with 62 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
//
// Base class for Rivendell modal widgets.
//
// (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2019-2023 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -18,6 +18,8 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <QPainter>
#include "rdwidget.h"
RDWidget::RDWidget(QWidget *parent,Qt::WindowFlags f)
@@ -32,3 +34,33 @@ RDWidget::RDWidget(RDConfig *config,QWidget *parent,Qt::WindowFlags f)
{
setFont(defaultFont());
}
QPixmap RDWidget::backgroundPixmap() const
{
return d_background_pixmap;
}
void RDWidget::setBackgroundPixmap(const QPixmap &pix)
{
d_background_pixmap=pix;
update();
}
void RDWidget::paintEvent(QPaintEvent *e)
{
int w=size().width();
int h=size().height();
if(!d_background_pixmap.isNull()) {
QPainter *p=new QPainter(this);
for(int i=0;i<h;i+=d_background_pixmap.height()) {
for(int j=0;j<w;j+=d_background_pixmap.width()) {
p->drawPixmap(j,i,d_background_pixmap);
}
}
delete p;
}
}

View File

@@ -2,7 +2,7 @@
//
// Base class for Rivendell widgets.
//
// (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2019-2023 Fred Gleason <fredg@paravelsystems.com>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -21,7 +21,7 @@
#ifndef RDWIDGET_H
#define RDWIDGET_H
#include <qwidget.h>
#include <QWidget>
#include <rdfontengine.h>
@@ -31,6 +31,14 @@ class RDWidget : public QWidget, public RDFontEngine
public:
RDWidget(QWidget *parent=0,Qt::WindowFlags f=0);
RDWidget(RDConfig *config,QWidget *parent=0,Qt::WindowFlags f=0);
QPixmap backgroundPixmap() const;
void setBackgroundPixmap(const QPixmap &pix);
protected:
void paintEvent(QPaintEvent *e);
private:
QPixmap d_background_pixmap;
};