Version: 9.12.0
QDS_RadioBox Class Reference

#include <QDS_RadioBox.h>

Inheritance diagram for QDS_RadioBox:
Inheritance graph

Signals

void activated (int)
 The signal is emitted when any radio button is toggled. More...
 
- Signals inherited from QDS_Datum
void paramChanged ()
 The signal is emitted when the datum value is changed. More...
 
void paramChanged (QString &)
 

Public Member Functions

 QDS_RadioBox (const QString &, QWidget *=0, const int=Control, const QString &=QString())
 Constructor. More...
 
virtual ~QDS_RadioBox ()
 Destructor. More...
 
int count (bool=false) const
 Get number of buttons in radio box. More...
 
void values (QList< int > &, bool=false) const
 Get buttons identifiers. More...
 
int columns () const
 
void setColumns (const int)
 
bool state (const int) const
 Get visibility state of the button specified by id. More...
 
void setState (const bool, const int, const bool=true)
 Set the visibility state of the button specified by id. More...
 
void setState (const bool, const QList< int > &, const bool=true)
 Set the visibility state of buttons specified by ids. More...
 
void setValues (const QList< int > &, const QStringList &)
 Set the custom user buttons into the radio box. More...
 
void setValues (const QStringList &)
 Set the custom user buttons into the radio box. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.User buttons like standard dictionary buttons will be added into the radio box. This function allows user to customize buttons. More...
 
virtual QString getString () const
 Get string from the radio box. More...
 
- Public Member Functions inherited from QDS_Datum
 QDS_Datum (const QString &, QWidget *=0, const int=All, const QString &=QString())
 Constructor. More...
 
virtual ~QDS_Datum ()
 Destructor. More...
 
QString id () const
 Get the datum ID. More...
 
int type () const
 Get the datum value type. More...
 
QString label () const
 Get the datum label text. More...
 
QString units () const
 Get the datum units text. More...
 
QString filter () const
 Get the datum filter string. More...
 
QString format () const
 Get the datum format string. More...
 
QString longDescription () const
 Get the datum long description. More...
 
QString shortDescription () const
 Get the datum short description. More...
 
QString defaultValue () const
 Get the datum default value. More...
 
QString minimumValue () const
 Get the datum minimum value. More...
 
QString maximumValue () const
 Get the datum maximum value. More...
 
QStringList options () const
 Get the datum options names. More...
 
QVariant option (const QString &) const
 Get datum option specified by name as QVariant. More...
 
QString optionString (const QString &) const
 Get datum option specified by name as string. More...
 
double optionDouble (const QString &) const
 Get datum option specified by name as double. More...
 
int optionInteger (const QString &) const
 Get datum option specified by name as integer. More...
 
virtual QVariant value () const
 Get the datum value as QVariant. More...
 
virtual QString stringValue () const
 Get the datum value as string. More...
 
virtual double doubleValue () const
 Get the datum value as double. More...
 
virtual int integerValue () const
 Get the datum value as integer. More...
 
QString text () const
 Get the text data from datum. More...
 
virtual bool isEmpty () const
 Check if the datum is empty. More...
 
virtual void reset ()
 Reset datum state and set default value as current. More...
 
virtual void clear ()
 Clear the control. More...
 
virtual void setValue (const QVariant &)
 Set datum value from QVariant object. More...
 
virtual void setStringValue (const QString &)
 Set datum value from string data. More...
 
virtual void setDoubleValue (const double)
 Set datum value from double data. More...
 
virtual void setIntegerValue (const int)
 Set datum value from integer data. More...
 
virtual bool isEnabled (const int=Control) const
 Get 'enabled' state of the specified subwidget. More...
 
virtual void setEnabled (const bool, const int)
 Enable/disable subwidgets specified by element. More...
 
void show (const int=All)
 Show subwidgets specified by element. More...
 
void hide (const int=All)
 Hide subwidgets specified by element. More...
 
virtual void setShown (const bool, const int=All)
 Show/hide subwidgets specified by flags. More...
 
QWidgetwidget (const int) const
 Get subwidget specified by element. More...
 
void setFocus ()
 Set the input focus to the control widget. More...
 
virtual bool isValid (const bool=true, const QString &=QString(), const QString &=QString()) const
 Check if input data is valid. More...
 
virtual QValidatorvalidator (const bool=false) const
 Create validator according to the datum type of value. More...
 
void addTo (QVBoxLayout *)
 Add widgets to the vertical box layout. More...
 
void addTo (QHBoxLayout *)
 Add widgets to the horizontal box layout. More...
 
void addTo (QGridLayout *, const int, const int, const bool=false)
 Add widgets to the grid layout. More...
 
virtual void setAlignment (const int, const int=Label)
 Set the aligment for QDS::Label and/or QDS::Units subwidgets. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Event filter. More...
 
 operator QWidget * () const
 Overloaded operator used to retrieve main subwidget named QDS::Control. More...
 
bool isCustomTr () const
 Return state of custom translation. More...
 
void enableCustomTr (const bool)
 Change state of custom translation. More...
 

Protected Slots

virtual void onToggled (bool)
 Called when user toggles any radio button. More...
 
- Protected Slots inherited from QDS_Datum
virtual void onParamChanged ()
 Called when datum value is changed. More...
 

Protected Member Functions

QButtonGroup * buttonGroup () const
 Get internal button group. More...
 
QGroupBoxgroupBox () const
 Get internal group box widget. More...
 
virtual QWidgetcreateControl (QWidget *)
 Get radio button group box widget. More...
 
void buttons (QList< QRadioButton * > &) const
 Get all the radio buttons from the radio box. More...
 
virtual void setString (const QString &)
 Set the string value to the radio box widget. More...
 
virtual void unitSystemChanged (const QString &)
 Process notification about active units system changing. More...
 
- Protected Member Functions inherited from QDS_Datum
QLabellabelWidget () const
 Get QDS::Label widget. More...
 
QLabelunitsWidget () const
 Get QDS::Units widget. More...
 
QWidgetcontrolWidget () const
 Get QDS::Control widget. More...
 
 Handle (DDS_DicItem) dicItem() const
 
void setDicItem (const Handle(DDS_DicItem)&)
 
int flags () const
 Get datum flags. More...
 
void invalidateCache ()
 Reset the numeric value cache. More...
 
virtual QLabelcreateLabel (QWidget *)
 Create QDS::Label widget. More...
 
virtual QLabelcreateUnits (QWidget *)
 Create QDS::Units widget. More...
 
virtual bool validate (const QString &) const
 Validate the specified string. More...
 
QString prefix () const
 Get prefix string from format. More...
 
QString suffix () const
 Get suffix string from format. More...
 
virtual QString minValue () const
 Get minimum value. More...
 
virtual QString maxValue () const
 Get maximum value. More...
 
void initDatum () const
 Perform initialization if it needed. More...
 

Private Types

typedef QMap< int, QString > IdValueMap
 
typedef QMap< int, bool > IdStateMap
 

Private Member Functions

void updateRadioBox ()
 Update radio box. More...
 

Private Attributes

IdValueMap myValue
 
IdStateMap myState
 
QIntList myDataIds
 
QIntList myUserIds
 
QStringList myUserNames
 
QButtonGroup * myButtonGroup
 

Additional Inherited Members

- Public Types inherited from QDS
enum  DatumFlags {
  None = 0x00 , Label = 0x01 , Control = 0x02 , Units = 0x04 ,
  NotFormat = 0x08 , NotAccel = 0x10 , NotConvert = 0x20 , UnitsWithLabel = 0x40 ,
  All = Label | Control | Units
}
 Enum describes bit flags of the Qt datum view and behaviour. More...
 
- Public Slots inherited from QDS_Datum
void setEnabled (bool)
 Enable/disable main control subwidget (QDS::Control). More...
 
- Static Public Member Functions inherited from QDS_Datum
static QString unitsToText (const QString &)
 Convert units into text presentation. More...
 
static QString textToUnits (const QString &)
 Convert text presentation into internal units format. More...
 
static QString format (const QString &, const QString &, const bool=false)
 Format the specified string as dictionary item value. More...
 
static QString format (const int, const QString &, const bool=false)
 Format the specified integer as dictionary item value. More...
 
static QString format (const double, const QString &, const bool=false)
 Format the specified double as dictionary item value. More...
 
static QString units (const QString &)
 Get displayable units string for specified data dictionary item. More...
 
- Static Public Member Functions inherited from QDS
static bool load (const QString &)
 Load datum definitions from XML file dictPath to the dictionary. More...
 
static QString unitSystemLabel (const QString &, const QString &=QString())
 Get the label of unit system sys. More...
 
static QString activeUnitSystem (const QString &=QString())
 Get the name of active unit system from the specified component comp. More...
 
static void setActiveUnitSystem (const QString &, const QString &=QString())
 Set the active unit system. More...
 
static QString toQString (const TCollection_AsciiString &)
 Convert the OpenCascade ASCII string to Qt string. More...
 
static QString toQString (const TCollection_ExtendedString &)
 Convert the OpenCascade Unicode string to Qt string. More...
 
static QString toQString (const Handle(TCollection_HAsciiString)&)
 Convert the OpenCascade ASCII string to Qt string. More...
 
static QString toQString (const Handle(TCollection_HExtendedString)&)
 Convert the OpenCascade Unicode string to Qt string. More...
 
static TCollection_AsciiString toAsciiString (const QString &)
 Convert the Qt string to OpenCascade ASCII string. More...
 
static TCollection_AsciiString toAsciiString (const TCollection_ExtendedString &)
 Convert the OpenCascade Unicode string to OpenCascade ASCII string. More...
 
static TCollection_AsciiString toAsciiString (const Handle(TCollection_HExtendedString)&)
 Convert the OpenCascade Unicode string to OpenCascade ASCII string. More...
 
static TCollection_ExtendedString toExtString (const QString &)
 Convert the Qt string to OpenCascade Unicode string. More...
 
static TCollection_ExtendedString toExtString (const TCollection_AsciiString &)
 Convert the OpenCascade ASCII string to OpenCascade Unicode string. More...
 
- Static Protected Member Functions inherited from QDS_Datum
static QString format (const QString &, const int, const int)
 Format the given value according to the data dictionary item type. More...
 
static QString format (const QString &, const int, const double)
 Format the given value according to the data dictionary item type. More...
 
static QString format (const QString &, const int, const QString &)
 Format the given value according to the data dictionary item type. More...
 
static QString sprintf (const QString &, const int)
 Wrapper around the standard sprintf() function. More...
 
static QString sprintf (const QString &, const double)
 Wrapper around the standard sprintf() function. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Process some non standard flags from format string. More...
 
static QString sprintf (const QString &, const QString &)
 Wrapper around the standard sprintf() function. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Process some non standard flags from format string. More...
 
- Static Protected Member Functions inherited from QDS
static void insertDatum (QDS_Datum *)
 Register given datum datum in the global list. More...
 
static void removeDatum (QDS_Datum *)
 Remove given datum datum from the global list. More...
 

Member Typedef Documentation

◆ IdStateMap

typedef QMap<int, bool> QDS_RadioBox::IdStateMap
private

◆ IdValueMap

typedef QMap<int, QString> QDS_RadioBox::IdValueMap
private

Constructor & Destructor Documentation

◆ QDS_RadioBox()

QDS_RadioBox::QDS_RadioBox ( const QString &  id,
QWidget parent = 0,
const int  flags = Control,
const QString &  comp = QString() 
)

Constructor.

Create radio button box datum object with datum identifier id and parent widget parent.

Parameter flags defines behaviour of datum and set of created subwidgets. Default value of this parameter is QDS::All.

Parameter comp specifies the component name which will be used when searching the dictionary item.

Parameters
iddatum identifier
parentparent widget
flagsdatum flags
compcomponent

◆ ~QDS_RadioBox()

QDS_RadioBox::~QDS_RadioBox ( )
virtual

Destructor.

Member Function Documentation

◆ activated

void QDS_RadioBox::activated ( int  id)
signal

The signal is emitted when any radio button is toggled.

Parameters
idbutton ID

◆ buttonGroup()

QButtonGroup * QDS_RadioBox::buttonGroup ( ) const
protected

Get internal button group.

Returns
pointer to the QButtonGroup object

References myButtonGroup.

◆ buttons()

void QDS_RadioBox::buttons ( QList< QRadioButton * > &  lst) const
protected

Get all the radio buttons from the radio box.

Parameters
lstreturned list of radio buttons

References buttonGroup().

◆ columns()

int QDS_RadioBox::columns ( ) const

◆ count()

int QDS_RadioBox::count ( bool  total = false) const

Get number of buttons in radio box.

If total is false, only visible buttons are taken into account; otherwise total number of buttons is returned

Parameters
totalget number of visible buttons if true and total number of buttons if false
Returns
requested number of items

References buttons(), and myValue.

◆ createControl()

QWidget * QDS_RadioBox::createControl ( QWidget parent)
protectedvirtual

Get radio button group box widget.

Returns
internal group box widget

Implements QDS_Datum.

References myButtonGroup.

◆ getString()

QString QDS_RadioBox::getString ( ) const
virtual

Get string from the radio box.

String which contains identifier of the currently selected button is returned.

Returns
identifier of the current button converted to string

Implements QDS_Datum.

References buttonGroup().

◆ groupBox()

QGroupBox * QDS_RadioBox::groupBox ( ) const
protected

Get internal group box widget.

Returns
pointer to the QGroupBox widget

References QDS_Datum::controlWidget().

◆ onToggled

void QDS_RadioBox::onToggled ( bool  on)
protectedvirtualslot

Called when user toggles any radio button.

Parameters
onnew radio button state

References getString(), QDS_Datum::onParamChanged(), and QDS_Datum::paramChanged().

◆ setColumns()

void QDS_RadioBox::setColumns ( const int  )

◆ setState() [1/2]

void QDS_RadioBox::setState ( const bool  on,
const int  id,
const bool  append = true 
)

Set the visibility state of the button specified by id.

If id is -1 then specified state will be set to all buttons.

If append is set to true, keep current status for other buttons, otherwise status of other buttons is cleared.

Parameters
onnew visibility state
idbutton ID
appendif true, keep original status for other buttons

References myState.

◆ setState() [2/2]

void QDS_RadioBox::setState ( const bool  on,
const QList< int > &  ids,
const bool  append = true 
)

Set the visibility state of buttons specified by ids.

If append is set to true, keep the current status for other buttons, otherwise status of other buttons is cleared.

Parameters
onnew visibility state
idsbuttons IDs list
appendif true, keep original status for other buttons

References myState, and updateRadioBox().

◆ setString()

void QDS_RadioBox::setString ( const QString &  txt)
protectedvirtual

Set the string value to the radio box widget.

Button with the identifier from specified string txt becomes selected in the radio box.

Parameters
txtstring value

Implements QDS_Datum.

References activated(), buttonGroup(), buttons(), getString(), QDS_Datum::onParamChanged(), and QDS_Datum::paramChanged().

◆ setValues() [1/2]

void QDS_RadioBox::setValues ( const QList< int > &  ids,
const QStringList &  names 
)

Set the custom user buttons into the radio box.

User items like standard dictionary buttons will be added into the radio box. This function allows user to customize buttons.

Parameters
idsbuttons IDs
namesbuttons names

References myUserIds, and myUserNames.

◆ setValues() [2/2]

void QDS_RadioBox::setValues ( const QStringList &  names)

Set the custom user buttons into the radio box. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.User buttons like standard dictionary buttons will be added into the radio box. This function allows user to customize buttons.

Uses (0, 1, 2 ... ) as buttons IDs.

Parameters
namesbuttons names

References setValues().

◆ state()

bool QDS_RadioBox::state ( const int  id) const

Get visibility state of the button specified by id.

Parameters
idbutton ID
Returns
item visibility state

References QDS_Datum::id(), and myState.

◆ unitSystemChanged()

void QDS_RadioBox::unitSystemChanged ( const QString &  system)
protectedvirtual

Process notification about active units system changing.

Update radio box contents.

Parameters
systemnew active units system

Reimplemented from QDS_Datum.

References groupBox(), QDS_Datum::Handle(), QDS_Datum::id(), QDS_Datum::label(), myDataIds, myState, myUserIds, myUserNames, myValue, QDS::toQString(), QDS_Datum::unitSystemChanged(), and updateRadioBox().

◆ updateRadioBox()

void QDS_RadioBox::updateRadioBox ( )
private

◆ values()

void QDS_RadioBox::values ( QList< int > &  ids,
bool  total = false 
) const

Get buttons identifiers.

Parameters
idsreturned list of buttons IDs
totaltake into account only visible buttons if true and all buttons if false

References myDataIds, and myState.

Member Data Documentation

◆ myButtonGroup

QButtonGroup* QDS_RadioBox::myButtonGroup
private

◆ myDataIds

QIntList QDS_RadioBox::myDataIds
private

◆ myState

IdStateMap QDS_RadioBox::myState
private

◆ myUserIds

QIntList QDS_RadioBox::myUserIds
private

◆ myUserNames

QStringList QDS_RadioBox::myUserNames
private

◆ myValue

IdValueMap QDS_RadioBox::myValue
private

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