DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::ValidatorComboBox Class Reference

#include <ValidatorComboBox.hpp>

Inheritance diagram for dbe::ValidatorComboBox:
[legend]
Collaboration diagram for dbe::ValidatorComboBox:
[legend]

Public Slots

void TryValidate (const QString &ValidateString)
 

Signals

void ValueWasChanged ()
 

Public Member Functions

 ValidatorComboBox (QWidget *parent=nullptr)
 Including QT Headers.
 
 ~ValidatorComboBox ()
 
bool IsValid () const
 
bool IsChanged () const
 
QStringList GetDataList ()
 

Private Slots

void ChangeDetected (const QString &StringChange)
 
void CheckDefaults (int Default)
 
bool CompareDefaults ()
 

Private Member Functions

void wheelEvent (QWheelEvent *e)
 

Private Attributes

QStringList DataList
 
QString Default
 
bool Valid
 
bool ValueChanged
 

Detailed Description

Definition at line 9 of file ValidatorComboBox.hpp.

Constructor & Destructor Documentation

◆ ValidatorComboBox()

dbe::ValidatorComboBox::ValidatorComboBox ( QWidget * parent = nullptr)
explicit

Including QT Headers.

Including DBE

Definition at line 7 of file ValidatorComboBox.cpp.

8 : QComboBox ( parent ),
9 Valid ( false ),
10 ValueChanged ( false )
11{
12 connect ( this, SIGNAL ( editTextChanged ( const QString & ) ), this,
13 SLOT ( TryValidate ( const QString & ) ) );
14 connect ( this, SIGNAL ( activated ( const QString & ) ), this,
15 SLOT ( ChangeDetected ( const QString & ) ) );
16 connect ( this, SIGNAL ( currentIndexChanged ( int ) ), this,
17 SLOT ( CheckDefaults ( int ) ) );
18}
void ChangeDetected(const QString &StringChange)
void CheckDefaults(int Default)
void TryValidate(const QString &ValidateString)

◆ ~ValidatorComboBox()

dbe::ValidatorComboBox::~ValidatorComboBox ( )

Definition at line 20 of file ValidatorComboBox.cpp.

21{
22}

Member Function Documentation

◆ ChangeDetected

void dbe::ValidatorComboBox::ChangeDetected ( const QString & StringChange)
privateslot

Definition at line 86 of file ValidatorComboBox.cpp.

87{
88 Q_UNUSED ( StringChange )
89 ValueChanged = true;
90 emit ValueWasChanged();
91}

◆ CheckDefaults

void dbe::ValidatorComboBox::CheckDefaults ( int Default)
privateslot

Definition at line 93 of file ValidatorComboBox.cpp.

94{
95 Q_UNUSED ( DefaultIndex )
96
97 if ( !Default.isEmpty() )
98 {
99 TryValidate ( this->currentText() );
100 }
101}

◆ CompareDefaults

bool dbe::ValidatorComboBox::CompareDefaults ( )
privateslot

Definition at line 103 of file ValidatorComboBox.cpp.

104{
105 if ( Default.isEmpty() )
106 {
107 return false;
108 }
109
110 if ( Default == this->currentText() )
111 {
112 return true;
113 }
114
115 return false;
116}

◆ GetDataList()

QStringList dbe::ValidatorComboBox::GetDataList ( )

Definition at line 34 of file ValidatorComboBox.cpp.

35{
36 DataList.clear();
37 DataList << currentText();
38 return DataList;
39}

◆ IsChanged()

bool dbe::ValidatorComboBox::IsChanged ( ) const

Definition at line 29 of file ValidatorComboBox.cpp.

30{
31 return ValueChanged;
32}

◆ IsValid()

bool dbe::ValidatorComboBox::IsValid ( ) const

Definition at line 24 of file ValidatorComboBox.cpp.

25{
26 return Valid;
27}

◆ TryValidate

void dbe::ValidatorComboBox::TryValidate ( const QString & ValidateString)
slot

Definition at line 47 of file ValidatorComboBox.cpp.

48{
49 QString Tmp = ValidateString;
50 int index = 0;
51
52 if ( this->validator() != nullptr )
53 {
54 if ( this->validator()->validate ( Tmp, index ) == QValidator::Acceptable )
55 {
56 Valid = true;
57
58 if ( CompareDefaults() )
59 {
60 this->setPalette ( StyleUtility::LoadedDefault );
61 }
62 else
63 {
64 this->setPalette ( QApplication::palette ( this ) );
65 }
66 }
67 else if ( this->validator()->validate ( Tmp, index ) == QValidator::Intermediate )
68 {
69 Valid = false;
70 this->setPalette ( StyleUtility::WarningStatusBarPallete );
71 }
72 }
73 else
74 {
75 if ( CompareDefaults() )
76 {
77 this->setPalette ( StyleUtility::LoadedDefault );
78 }
79 else
80 {
81 this->setPalette ( QApplication::palette ( this ) );
82 }
83 }
84}
static QPalette LoadedDefault
static QPalette WarningStatusBarPallete

◆ ValueWasChanged

void dbe::ValidatorComboBox::ValueWasChanged ( )
signal

◆ wheelEvent()

void dbe::ValidatorComboBox::wheelEvent ( QWheelEvent * e)
private

Definition at line 41 of file ValidatorComboBox.cpp.

42{
43 ( void ) event;
44 return;
45}

Member Data Documentation

◆ DataList

QStringList dbe::ValidatorComboBox::DataList
private

Definition at line 19 of file ValidatorComboBox.hpp.

◆ Default

QString dbe::ValidatorComboBox::Default
private

Definition at line 20 of file ValidatorComboBox.hpp.

◆ Valid

bool dbe::ValidatorComboBox::Valid
private

Definition at line 21 of file ValidatorComboBox.hpp.

◆ ValueChanged

bool dbe::ValidatorComboBox::ValueChanged
private

Definition at line 22 of file ValidatorComboBox.hpp.


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