raDIYo 0.4
swabstractbarwidget.h
1/***************************************************************************
2
3 source::worx raDIYo
4 Copyright © 2020-2022 c.holzheuer
5 c.holzheuer@sourceworx.org
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12***************************************************************************/
13
14
15#ifndef SWABSTRACTBARWIDGET_H
16#define SWABSTRACTBARWIDGET_H
17
18#include <QWidget>
19#include <raDIYo.h>
20
21
22class SWAbstractBarWidget : public QWidget
23{
24 Q_OBJECT
25
26public:
27
28 explicit SWAbstractBarWidget( QWidget* parent = 0 );
29 virtual ~SWAbstractBarWidget();
30
31 virtual void paintEvent( QPaintEvent* event ) override = 0;
32
33 bool gradientMode();
34 void setGradienMode( bool mode );
35
36 bool barMode();
37 void setBarMode( bool mode );
38 int numBars();
39
40 void setNumBars( int bars );
41 int numBlocks();
42
43 void setNumBlocks( int blocks );
44 void setNumBarsBlocks( int bars, int blocks );
45
46 double value();
47 void setValue( double value );
48 void clearValueList();
49
50 void setColorRange( const QStringList& colorlist );
51 void setColorRange( const SWColorVec& colorlist );
52
53public slots:
54
55 virtual void onDialValueChanged( int newvalue );
56 virtual void onValueListChanged( const SWDoubleVec& freshdata );
57
58
59
60protected:
61
62 void setRange( int rangeFrom, int rangeTo );
63 QColor getBlockColor( int x, int y );
64 void calcSizeRatio();
65
66 // intern für on value changed
67 // Defaultwerte sind der Default-Wertebereich von QDial
68
69 int _rangeFrom = 0;
70 int _rangeTo = 99;
71
72 // Brainfuck!
73 double _minValue = 0.0;
74 double _maxValue = 1.0;
75 double _value = 0.0;
76
77 int _numBars = -1;
78 int _numBlocks = -1;
79
80 int _maxNumBarsBlocks = -1;
81 double _sizeRatio = -1;
82
83 int _padding = 3;
84 bool _barMode = false;
85 bool _gradientMode = true;
86
87 SWColorVec _colors;
88 SWDoubleVec _valueList;
89
90};
91
92
93#endif // SWABSTRACTBARWIDGET_H
bool gradientMode()
SWAbstractBarWidget::gradientMode.
void setNumBarsBlocks(int bars, int blocks)
SWAbstractBarWidget::setNumBarsBlocks.
void setGradienMode(bool mode)
SWAbstractBarWidget::setGradienMode.
void setNumBlocks(int blocks)
SWAbstractBarWidget::setNumBlocks.
int numBlocks()
SWAbstractBarWidget::numBlocks.
void setRange(int rangeFrom, int rangeTo)
SWAbstractBarWidget::setRange.
SWAbstractBarWidget(QWidget *parent=0)
SWAbstractBarWidget::SWAbstractBarWidget : Konstruktor.
void setValue(double value)
SWAbstractBarWidget::setValue.
double value()
SWAbstractBarWidget::value.
int numBars()
SWAbstractBarWidget::numBars.
virtual void onDialValueChanged(int newvalue)
SWAbstractBarWidget::onDialValueChanged.
bool barMode()
SWAbstractBarWidget::barMode.
void setBarMode(bool mode)
SWAbstractBarWidget::setBarMode.
virtual ~SWAbstractBarWidget()
SWAbstractBarWidget::~SWAbstractBarWidget: Destruktor, macht nix.
void setNumBars(int bars)
SWAbstractBarWidget::setNumBars.