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 14 of file ValidatorComboBox.hpp.

Constructor & Destructor Documentation

◆ ValidatorComboBox()

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

Including QT Headers.

Including DBE

Definition at line 12 of file ValidatorComboBox.cpp.

13 : QComboBox ( parent ),
14 Valid ( false ),
15 ValueChanged ( false )
16{
17 connect ( this, SIGNAL ( editTextChanged ( const QString & ) ), this,
18 SLOT ( TryValidate ( const QString & ) ) );
19 connect ( this, SIGNAL ( activated ( const QString & ) ), this,
20 SLOT ( ChangeDetected ( const QString & ) ) );
21 connect ( this, SIGNAL ( currentIndexChanged ( int ) ), this,
22 SLOT ( CheckDefaults ( int ) ) );
23}
void ChangeDetected(const QString &StringChange)
void CheckDefaults(int Default)
void TryValidate(const QString &ValidateString)

◆ ~ValidatorComboBox()

dbe::ValidatorComboBox::~ValidatorComboBox ( )

Definition at line 25 of file ValidatorComboBox.cpp.

26{
27}

Member Function Documentation

◆ ChangeDetected

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

Definition at line 91 of file ValidatorComboBox.cpp.

92{
93 Q_UNUSED ( StringChange )
94 ValueChanged = true;
95 emit ValueWasChanged();
96}

◆ CheckDefaults

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

Definition at line 98 of file ValidatorComboBox.cpp.

99{
100 Q_UNUSED ( DefaultIndex )
101
102 if ( !Default.isEmpty() )
103 {
104 TryValidate ( this->currentText() );
105 }
106}

◆ CompareDefaults

bool dbe::ValidatorComboBox::CompareDefaults ( )
privateslot

Definition at line 108 of file ValidatorComboBox.cpp.

109{
110 if ( Default.isEmpty() )
111 {
112 return false;
113 }
114
115 if ( Default == this->currentText() )
116 {
117 return true;
118 }
119
120 return false;
121}

◆ GetDataList()

QStringList dbe::ValidatorComboBox::GetDataList ( )

Definition at line 39 of file ValidatorComboBox.cpp.

40{
41 DataList.clear();
42 DataList << currentText();
43 return DataList;
44}

◆ IsChanged()

bool dbe::ValidatorComboBox::IsChanged ( ) const

Definition at line 34 of file ValidatorComboBox.cpp.

35{
36 return ValueChanged;
37}

◆ IsValid()

bool dbe::ValidatorComboBox::IsValid ( ) const

Definition at line 29 of file ValidatorComboBox.cpp.

30{
31 return Valid;
32}

◆ TryValidate

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

Definition at line 52 of file ValidatorComboBox.cpp.

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

◆ ValueWasChanged

void dbe::ValidatorComboBox::ValueWasChanged ( )
signal

◆ wheelEvent()

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

Definition at line 46 of file ValidatorComboBox.cpp.

47{
48 ( void ) event;
49 return;
50}

Member Data Documentation

◆ DataList

QStringList dbe::ValidatorComboBox::DataList
private

Definition at line 24 of file ValidatorComboBox.hpp.

◆ Default

QString dbe::ValidatorComboBox::Default
private

Definition at line 25 of file ValidatorComboBox.hpp.

◆ Valid

bool dbe::ValidatorComboBox::Valid
private

Definition at line 26 of file ValidatorComboBox.hpp.

◆ ValueChanged

bool dbe::ValidatorComboBox::ValueChanged
private

Definition at line 27 of file ValidatorComboBox.hpp.


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