SHAPER 9.16.0
ModuleBase_ChoiceCtrl.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef ModuleBase_ChoiceCtrl_H
21#define ModuleBase_ChoiceCtrl_H
22
23#include "ModuleBase.h"
24
25#include <QWidget>
26#include <QStringList>
27#include <QList>
28
29class QLabel;
30class QComboBox;
31class QGroupBox;
32class QButtonGroup;
33
41class MODULEBASE_EXPORT ModuleBase_ChoiceCtrl: public QWidget
42{
43Q_OBJECT
44public:
45 enum ControlType {
46 RadioButtons,
47 ComboBox
48 };
49
59 const QStringList& theChoiceList,
60 const QStringList& theIconsList,
61 ControlType theType = RadioButtons,
62 Qt::Orientation theButtonsDir = Qt::Horizontal);
63
67 void setLabel(const QString& theText);
68
71 void setLabelIcon(const QString& theIcon);
72
75 void setValue(int theVal);
76
79 void setValue(const QString& theVal);
80
82 void setTooltip(QString theTip);
83
85 int value() const;
86
88 QString textValue() const;
89
91 bool focusTo();
92
94 QList<QWidget*> getControls() const;
95
98 void setChoiceList(const QStringList& theChoiceList);
99
100signals:
102 void valueChanged(int theVal);
103
104private:
106 ControlType myType;
107
109 QLabel* myLabel;
110
112 QComboBox* myCombo;
113
115 QGroupBox* myGroupBox;
116
118 QButtonGroup* myButtons;
119};
120
121#endif
A Choice control.
Definition: ModuleBase_ChoiceCtrl.h:42
void valueChanged(int theVal)
A signal raised on change of current value.