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 | Private Slots | Private Attributes | List of all members
DiscreteRangeGUI Class Reference

#include <discreterangegui.h>

+ Inheritance diagram for DiscreteRangeGUI:
+ Collaboration diagram for DiscreteRangeGUI:

Public Member Functions

 DiscreteRangeGUI (QWidget *parent=0)
 
virtual ~DiscreteRangeGUI ()
 
void setLabel (const QString &text)
 
void setUnits (const QString &units)
 
void addItem (const QString &itemStr, double itemValue)
 
virtual double getCurrentValue ()
 
virtual void setValue (double value)
 
- Public Member Functions inherited from ItemSettingGUI
 ItemSettingGUI (QWidget *parent=0)
 
virtual ~ItemSettingGUI ()
 

Private Slots

void on_rangeCombo_currentIndexChanged (int index)
 

Private Attributes

Ui::DiscreteRangeGUI * ui
 
std::vector< double > itemValues
 

Additional Inherited Members

- Signals inherited from ItemSettingGUI
void valueChanged (double value)
 

Detailed Description

Definition at line 31 of file discreterangegui.h.

Constructor & Destructor Documentation

◆ DiscreteRangeGUI()

DiscreteRangeGUI::DiscreteRangeGUI ( QWidget *  parent = 0)
explicit

Definition at line 21 of file discreterangegui.cpp.

References ui.

21  :
22  ItemSettingGUI(parent),
23  ui(new Ui::DiscreteRangeGUI)
24 {
25  ui->setupUi(this);
26 }
Ui::DiscreteRangeGUI * ui
ItemSettingGUI(QWidget *parent=0)

◆ ~DiscreteRangeGUI()

DiscreteRangeGUI::~DiscreteRangeGUI ( )
virtual

Definition at line 28 of file discreterangegui.cpp.

References ui.

29 {
30  delete ui;
31 }
Ui::DiscreteRangeGUI * ui

Member Function Documentation

◆ addItem()

void DiscreteRangeGUI::addItem ( const QString &  itemStr,
double  itemValue 
)

Definition at line 43 of file discreterangegui.cpp.

References itemValues, and ui.

Referenced by SoapySDRInputGui::createRangesControl(), and SoapySDROutputGui::createRangesControl().

44 {
45  ui->rangeCombo->blockSignals(true);
46  ui->rangeCombo->addItem(itemStr);
47  itemValues.push_back(itemValue);
48  ui->rangeCombo->blockSignals(false);
49 }
Ui::DiscreteRangeGUI * ui
std::vector< double > itemValues
+ Here is the caller graph for this function:

◆ getCurrentValue()

double DiscreteRangeGUI::getCurrentValue ( )
virtual

Implements ItemSettingGUI.

Definition at line 51 of file discreterangegui.cpp.

References itemValues, and ui.

52 {
53  return itemValues[ui->rangeCombo->currentIndex()];
54 }
Ui::DiscreteRangeGUI * ui
std::vector< double > itemValues

◆ on_rangeCombo_currentIndexChanged

void DiscreteRangeGUI::on_rangeCombo_currentIndexChanged ( int  index)
privateslot

Definition at line 74 of file discreterangegui.cpp.

References itemValues, and ItemSettingGUI::valueChanged().

75 {
76  double newRange = itemValues[index];
77  emit ItemSettingGUI::valueChanged(newRange);
78 }
void valueChanged(double value)
std::vector< double > itemValues

◆ setLabel()

void DiscreteRangeGUI::setLabel ( const QString &  text)

Definition at line 33 of file discreterangegui.cpp.

References ui.

Referenced by SoapySDRInputGui::createRangesControl(), and SoapySDROutputGui::createRangesControl().

34 {
35  ui->rangeLabel->setText(text);
36 }
Ui::DiscreteRangeGUI * ui
+ Here is the caller graph for this function:

◆ setUnits()

void DiscreteRangeGUI::setUnits ( const QString &  units)

Definition at line 38 of file discreterangegui.cpp.

References ui.

Referenced by SoapySDRInputGui::createRangesControl(), and SoapySDROutputGui::createRangesControl().

39 {
40  ui->rangeUnits->setText(units);
41 }
Ui::DiscreteRangeGUI * ui
+ Here is the caller graph for this function:

◆ setValue()

void DiscreteRangeGUI::setValue ( double  value)
virtual

Implements ItemSettingGUI.

Definition at line 56 of file discreterangegui.cpp.

References itemValues, and ui.

57 {
58  int index = 0;
59 
60  for (const auto &it : itemValues)
61  {
62  if (it >= value)
63  {
64  ui->rangeCombo->blockSignals(true);
65  ui->rangeCombo->setCurrentIndex(index);
66  ui->rangeCombo->blockSignals(false);
67  break;
68  }
69 
70  index++;
71  }
72 }
Ui::DiscreteRangeGUI * ui
std::vector< double > itemValues

Member Data Documentation

◆ itemValues

std::vector<double> DiscreteRangeGUI::itemValues
private

◆ ui

Ui::DiscreteRangeGUI* DiscreteRangeGUI::ui
private

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