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

#include <string_attr_text_edit.hpp>

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

Public Slots

void TryValidate ()
 
void EmitDecSlot ()
 
void EmitOctSlot ()
 
void EmitHexSlot ()
 

Signals

void StringValidated ()
 
void ValueChanged ()
 
void DecChange ()
 
void HexChange ()
 
void OctChange ()
 

Public Member Functions

 string_attr_text_edit (QWidget *parent=0, bool IsNull=true, bool IsMulti=false)
 Include Qt Headers.
 
 ~string_attr_text_edit ()
 
void SetNullCheck (bool IsNull)
 
void SetMultiCheck (bool IsMulti)
 
bool IsNullCheck ()
 
bool IsValid ()
 
void SetCheckDefault (bool Default)
 
void SetDefaultValue (QString ValueDefault)
 
void ValidateText ()
 
void SetLoadedDefaultFlag (bool Loaded)
 
void SetValidator (QValidator *ValidatorSet)
 
void SetPopupMenu ()
 
void CreateActions ()
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *Event)
 

Private Attributes

bool Valid
 
bool NullCheck
 
bool CheckDefault
 
bool PopupMenu
 
bool IsMultiValue
 
QMenu * ContextMenu
 
QAction * Dec
 
QAction * Oct
 
QAction * Hex
 
QValidator * Validator
 
QString DefaultValue
 

Detailed Description

Definition at line 9 of file string_attr_text_edit.hpp.

Constructor & Destructor Documentation

◆ string_attr_text_edit()

dbe::string_attr_text_edit::string_attr_text_edit ( QWidget * parent = 0,
bool IsNull = true,
bool IsMulti = false )
explicit

Include Qt Headers.

Include DBE

Definition at line 10 of file string_attr_text_edit.cpp.

11 : QTextEdit ( parent ),
12 Valid ( false ),
13 NullCheck ( IsNull ),
14 CheckDefault ( true ),
15 PopupMenu ( false ),
16 IsMultiValue ( IsMulti ),
17 ContextMenu ( nullptr ),
18 Dec ( nullptr ),
19 Oct ( nullptr ),
20 Hex ( nullptr ),
21 Validator ( nullptr )
22{
23 connect ( this, SIGNAL ( textChanged ( ) ), this,
24 SLOT ( TryValidate ( ) ) );
25 //this->setFixedHeight ( 30 );
26 //this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
27}

◆ ~string_attr_text_edit()

dbe::string_attr_text_edit::~string_attr_text_edit ( )

Definition at line 29 of file string_attr_text_edit.cpp.

30{
31 if ( Validator != nullptr )
32 {
33 delete Validator;
34 }
35}

Member Function Documentation

◆ contextMenuEvent()

void dbe::string_attr_text_edit::contextMenuEvent ( QContextMenuEvent * Event)
protected

Definition at line 189 of file string_attr_text_edit.cpp.

190{
191 if ( !PopupMenu )
192 {
193 return;
194 }
195
196 if ( ContextMenu == nullptr )
197 {
198 ContextMenu = new QMenu ( this );
200 }
201
202 ContextMenu->exec ( Event->globalPos() );
203}

◆ CreateActions()

void dbe::string_attr_text_edit::CreateActions ( )

Definition at line 91 of file string_attr_text_edit.cpp.

92{
93 Dec = new QAction ( tr ( "Dec" ), this );
94 Dec->setShortcutContext ( Qt::WidgetShortcut );
95 connect ( Dec, SIGNAL ( triggered() ), this, SLOT ( EmitDecSlot() ) );
96 Dec->setCheckable ( true );
97 Dec->setChecked ( false );
98 ContextMenu->addAction ( Dec );
99
100 Oct = new QAction ( tr ( "Oct" ), this );
101 Oct->setShortcutContext ( Qt::WidgetShortcut );
102 connect ( Oct, SIGNAL ( triggered() ), this, SLOT ( EmitOctSlot() ) );
103 Oct->setCheckable ( true );
104 Oct->setChecked ( false );
105 ContextMenu->addAction ( Oct );
106
107 Hex = new QAction ( tr ( "Hex" ), this );
108 Hex->setShortcutContext ( Qt::WidgetShortcut );
109 Hex->setCheckable ( true );
110 Hex->setChecked ( false );
111 connect ( Hex, SIGNAL ( triggered() ), this, SLOT ( EmitHexSlot() ) );
112 ContextMenu->addAction ( Hex );
113}

◆ DecChange

void dbe::string_attr_text_edit::DecChange ( )
signal

◆ EmitDecSlot

void dbe::string_attr_text_edit::EmitDecSlot ( )
slot

Definition at line 165 of file string_attr_text_edit.cpp.

166{
167 Dec->setChecked ( true );
168 Oct->setChecked ( false );
169 Hex->setChecked ( false );
170 emit DecChange();
171}

◆ EmitHexSlot

void dbe::string_attr_text_edit::EmitHexSlot ( )
slot

Definition at line 181 of file string_attr_text_edit.cpp.

182{
183 Dec->setChecked ( false );
184 Oct->setChecked ( false );
185 Hex->setChecked ( true );
186 emit HexChange();
187}

◆ EmitOctSlot

void dbe::string_attr_text_edit::EmitOctSlot ( )
slot

Definition at line 173 of file string_attr_text_edit.cpp.

174{
175 Dec->setChecked ( false );
176 Oct->setChecked ( true );
177 Hex->setChecked ( false );
178 emit OctChange();
179}

◆ HexChange

void dbe::string_attr_text_edit::HexChange ( )
signal

◆ IsNullCheck()

bool dbe::string_attr_text_edit::IsNullCheck ( )

Definition at line 52 of file string_attr_text_edit.cpp.

53{
54 return NullCheck;
55}

◆ IsValid()

bool dbe::string_attr_text_edit::IsValid ( )

Definition at line 57 of file string_attr_text_edit.cpp.

58{
59 return Valid;
60}

◆ OctChange

void dbe::string_attr_text_edit::OctChange ( )
signal

◆ SetCheckDefault()

void dbe::string_attr_text_edit::SetCheckDefault ( bool Default)

Definition at line 62 of file string_attr_text_edit.cpp.

63{
64 CheckDefault = Default;
65}

◆ SetDefaultValue()

void dbe::string_attr_text_edit::SetDefaultValue ( QString ValueDefault)

Definition at line 67 of file string_attr_text_edit.cpp.

68{
69 DefaultValue = ValueDefault;
70}

◆ SetLoadedDefaultFlag()

void dbe::string_attr_text_edit::SetLoadedDefaultFlag ( bool Loaded)

Definition at line 76 of file string_attr_text_edit.cpp.

77{
78 setProperty ( "loadedDefaults", Loaded );
79}

◆ SetMultiCheck()

void dbe::string_attr_text_edit::SetMultiCheck ( bool IsMulti)

Definition at line 47 of file string_attr_text_edit.cpp.

48{
49 IsMultiValue = IsMulti;
50}

◆ SetNullCheck()

void dbe::string_attr_text_edit::SetNullCheck ( bool IsNull)

Definition at line 37 of file string_attr_text_edit.cpp.

38{
39 NullCheck = IsNull;
40
41 if ( NullCheck == false )
42 {
43 setPalette ( QApplication::palette ( this ) );
44 }
45}

◆ SetPopupMenu()

void dbe::string_attr_text_edit::SetPopupMenu ( )

Definition at line 86 of file string_attr_text_edit.cpp.

87{
88 PopupMenu = true;
89}

◆ SetValidator()

void dbe::string_attr_text_edit::SetValidator ( QValidator * ValidatorSet)

Definition at line 81 of file string_attr_text_edit.cpp.

82{
83 Validator = ValidatorSet;
84}

◆ StringValidated

void dbe::string_attr_text_edit::StringValidated ( )
signal

◆ TryValidate

void dbe::string_attr_text_edit::TryValidate ( )
slot

Definition at line 115 of file string_attr_text_edit.cpp.

116{
117 QString tmp_st = this->toPlainText();
118 int i = 0;
119
120 if ( tmp_st.isEmpty() && NullCheck )
121 {
122 Valid = false;
123
124 if ( !IsMultiValue )
125 {
126 this->setPalette ( StyleUtility::WarningStatusBarPallete );
127 setToolTip ( QString ( "Field cannot be empty!" ) );
128 }
129
130 emit StringValidated(); // it is caught by EditStringAttrWidget
131 }
132 else if ( Validator != 0 )
133 {
134 if ( ( Validator->validate ( tmp_st, i ) ) == QValidator::Acceptable )
135 {
136 Valid = true;
137 this->setPalette ( QApplication::palette ( this ) );
138 setToolTip ( QString ( "This new object ID is unique" ) );
139 }
140 else if ( ( Validator->validate ( tmp_st, i ) ) == QValidator::Intermediate )
141 {
142 Valid = false;
143 this->setPalette ( StyleUtility::AlertStatusBarPallete );
144 setToolTip ( QString ( "This UID is already used" ) );
145 }
146 }
147 else if ( Validator == 0 )
148 {
149 Valid = true;
150 setPalette ( QApplication::palette ( this ) );
151
152 if ( tmp_st == DefaultValue && CheckDefault )
153 {
154 this->setPalette ( StyleUtility::LoadedDefault );
155 }
156 else
157 {
158 this->setPalette ( QApplication::palette ( this ) );
159 }
160
161 emit StringValidated();
162 }
163}
static QPalette AlertStatusBarPallete
static QPalette LoadedDefault
static QPalette WarningStatusBarPallete

◆ ValidateText()

void dbe::string_attr_text_edit::ValidateText ( )

Definition at line 72 of file string_attr_text_edit.cpp.

73{
74}

◆ ValueChanged

void dbe::string_attr_text_edit::ValueChanged ( )
signal

Member Data Documentation

◆ CheckDefault

bool dbe::string_attr_text_edit::CheckDefault
private

Definition at line 42 of file string_attr_text_edit.hpp.

◆ ContextMenu

QMenu* dbe::string_attr_text_edit::ContextMenu
private

Definition at line 45 of file string_attr_text_edit.hpp.

◆ Dec

QAction* dbe::string_attr_text_edit::Dec
private

Definition at line 46 of file string_attr_text_edit.hpp.

◆ DefaultValue

QString dbe::string_attr_text_edit::DefaultValue
private

Definition at line 50 of file string_attr_text_edit.hpp.

◆ Hex

QAction* dbe::string_attr_text_edit::Hex
private

Definition at line 48 of file string_attr_text_edit.hpp.

◆ IsMultiValue

bool dbe::string_attr_text_edit::IsMultiValue
private

Definition at line 44 of file string_attr_text_edit.hpp.

◆ NullCheck

bool dbe::string_attr_text_edit::NullCheck
private

Definition at line 41 of file string_attr_text_edit.hpp.

◆ Oct

QAction* dbe::string_attr_text_edit::Oct
private

Definition at line 47 of file string_attr_text_edit.hpp.

◆ PopupMenu

bool dbe::string_attr_text_edit::PopupMenu
private

Definition at line 43 of file string_attr_text_edit.hpp.

◆ Valid

bool dbe::string_attr_text_edit::Valid
private

Definition at line 40 of file string_attr_text_edit.hpp.

◆ Validator

QValidator* dbe::string_attr_text_edit::Validator
private

Definition at line 49 of file string_attr_text_edit.hpp.


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