Version: 9.16.0
QDS_RadioBox.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23#ifndef QDS_RADIOBOX_H
24#define QDS_RADIOBOX_H
25
26#include "QDS_Datum.h"
27
28#include <Qtx.h>
29
30#include <QMap>
31#include <QStringList>
32
33#ifdef WIN32
34#pragma warning( disable:4251 )
35#endif
36
37class QButtonGroup;
38class QGroupBox;
39class QRadioButton;
40
42{
43 Q_OBJECT
44
45public:
46 QDS_RadioBox( const QString&, QWidget* = 0, const int = Control, const QString& = QString() );
47 virtual ~QDS_RadioBox();
48
49 int count( bool = false ) const;
50 void values( QList<int>&, bool = false ) const;
51
52 int columns() const;
53 void setColumns( const int );
54
55 bool state( const int ) const;
56 void setState( const bool, const int, const bool = true );
57 void setState( const bool, const QList<int>&, const bool = true );
58 void setValues( const QList<int>&, const QStringList& );
59 void setValues( const QStringList& );
60
61 virtual QString getString() const;
62
63signals:
64 void activated( int );
65
66protected slots:
67 virtual void onToggled( bool );
68
69protected:
70 QButtonGroup* buttonGroup() const;
71 QGroupBox* groupBox() const;
72 virtual QWidget* createControl( QWidget* );
73 void buttons( QList<QRadioButton*>& ) const;
74
75 virtual void setString( const QString& );
76
77 virtual void unitSystemChanged( const QString& );
78
79private:
80 void updateRadioBox();
81
82private:
83 typedef QMap<int, QString> IdValueMap;
84 typedef QMap<int, bool> IdStateMap;
85
86private:
89
92 QStringList myUserNames;
93
94 QButtonGroup* myButtonGroup;
95};
96
97#ifdef WIN32
98#pragma warning( default:4251 )
99#endif
100
101#endif
#define QDS_EXPORT
Definition: QDS.h:33
QList< int > QIntList
list of int values
Definition: Qtx.h:57
Base class for all controls using the data dictionary.
Definition: QDS_Datum.h:41
virtual QWidget * createControl(QWidget *)=0
Create QDS::Control widget.
virtual void unitSystemChanged(const QString &)
Process notification about active units system changing.
Definition: QDS_Datum.cxx:1425
virtual void setString(const QString &)=0
virtual QString getString() const =0
Get string value from datum.
Definition: QDS_RadioBox.h:42
QIntList myDataIds
Definition: QDS_RadioBox.h:90
QIntList myUserIds
Definition: QDS_RadioBox.h:91
QMap< int, bool > IdStateMap
Definition: QDS_RadioBox.h:84
QButtonGroup * myButtonGroup
Definition: QDS_RadioBox.h:94
int columns() const
QStringList myUserNames
Definition: QDS_RadioBox.h:92
QMap< int, QString > IdValueMap
Definition: QDS_RadioBox.h:83
IdValueMap myValue
Definition: QDS_RadioBox.h:87
IdStateMap myState
Definition: QDS_RadioBox.h:88
void setColumns(const int)
void activated(int)
The signal is emitted when any radio button is toggled.