Files
raDIYo/swbarwidget.h
2025-08-05 22:36:00 +02:00

69 lines
1.5 KiB
C++

/***************************************************************************
source::worx raDIYo
Copyright © 2020-2022 c.holzheuer
chris@sourceworx.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#ifndef SWBARWIDGET_H
#define SWBARWIDGET_H
#include <QWidget>
#include <raDIYoglobals.h>
#include <swdialhandler.h>
#include <swrangevalue.h>
/**
* @brief Abstrakte Basisklasse für Balkendiagramme.
* @see SWDialHandler
* @see SWVolumeWidget
* @see SWSpectrumWidget
*/
class SWBarWidget : public QWidget, public SWDialHandler, public SWRangeValue
{
Q_OBJECT
public:
explicit SWBarWidget( QWidget* parent = 0 );
virtual ~SWBarWidget() = default;
virtual void paintEvent( QPaintEvent* event ) override = 0;
int numBars();
void setNumBars( int bars );
int numBlocks();
void setNumBlocks( int blocks );
int padding();
void setPadding( int padding );
void setColorRange( const QStringList& colorlist );
void setColorRange( const SWColorVec& colorlist );
protected:
QColor getBlockColor( int x, int y );
int _numBars = -1;
int _numBlocks = -1;
int _padding = 3;
SWColorVec _colors;
};
#endif // SWBARWIDGET_H