SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Indicator Class Reference

#include <indicator.h>

Inherits QWidget.

Public Member Functions

 Indicator (const QString &text, QWidget *parent=NULL)
 
void setColor (const QColor &color)
 

Protected Member Functions

void paintEvent (QPaintEvent *event)
 
QSize sizeHint () const
 

Private Attributes

QColor m_color
 
QString m_text
 

Detailed Description

Definition at line 25 of file indicator.h.

Constructor & Destructor Documentation

◆ Indicator()

Indicator::Indicator ( const QString &  text,
QWidget *  parent = NULL 
)

Definition at line 38 of file indicator.cpp.

38  :
39  QWidget(parent),
40  m_color(Qt::gray),
41  m_text(text)
42 {
43  setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
44 
45  QFont f = font();
46  f.setBold(true);
47  f.setPixelSize(8);
48  setFont(f);
49 }
QColor m_color
Definition: indicator.h:27
QString m_text
Definition: indicator.h:30

Member Function Documentation

◆ paintEvent()

void Indicator::paintEvent ( QPaintEvent *  event)
protected

Definition at line 22 of file indicator.cpp.

References m_color, and m_text.

23 {
24  QPainter painter(this);
25 
26  painter.setPen(Qt::black);
27  painter.setBrush(m_color);
28 
29  painter.drawRect(0, 0, 18, 15);
30  painter.drawText(0, 0, 19, 16, Qt::AlignCenter | Qt::AlignHCenter, m_text);
31 }
QColor m_color
Definition: indicator.h:27
QString m_text
Definition: indicator.h:30

◆ setColor()

void Indicator::setColor ( const QColor &  color)

Definition at line 51 of file indicator.cpp.

References m_color.

52 {
53  if(m_color != color) {
54  m_color = color;
55  update();
56  }
57 }
QColor m_color
Definition: indicator.h:27

◆ sizeHint()

QSize Indicator::sizeHint ( ) const
protected

Definition at line 33 of file indicator.cpp.

34 {
35  return QSize(20, 16);
36 }

Member Data Documentation

◆ m_color

QColor Indicator::m_color
private

Definition at line 27 of file indicator.h.

Referenced by paintEvent(), and setColor().

◆ m_text

QString Indicator::m_text
private

Definition at line 30 of file indicator.h.

Referenced by paintEvent().


The documentation for this class was generated from the following files: