Version: 9.15.0
QtxActionGroup.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
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 // File: QtxActionGroup.h
21 // Author: Sergey TELKOV
22 //
23 #ifndef QTXACTIONGROUP_H
24 #define QTXACTIONGROUP_H
25 
26 #include "QtxActionSet.h"
27 
28 #ifdef WIN32
29 #pragma warning( disable:4251 )
30 #endif
31 
32 class QtxComboBox;
33 class QActionGroup;
34 
36 {
37  Q_OBJECT
38 
39 public:
40  QtxActionGroup( QObject* = 0 );
41  QtxActionGroup( QObject*, const bool );
42  virtual ~QtxActionGroup();
43 
44  bool isExclusive() const;
45  bool usesDropDown() const;
46 
47  void add( QAction* );
48 
49  void setEnabled( bool );
50 
51 public slots:
52  void setExclusive( const bool );
53  void setUsesDropDown( const bool );
54 
55 signals:
56  void selected( QAction* );
57 
58 private slots:
59  void onActivated( int );
60  void onTriggered( QAction* );
61 
62 protected:
63  virtual void updateAction( QWidget* );
64  virtual void updateAction( QtxComboBox* );
65 
66  virtual QWidget* createWidget( QWidget* );
67 
68  virtual bool isEmptyAction() const;
69  virtual void actionAdded( QAction* );
70  virtual void actionRemoved( QAction* );
71 
72 private:
73  void updateType();
74  QtxComboBox* createdWidget( QWidget* );
75 
76 private:
77  bool myDropDown;
78  QActionGroup* myActionGroup;
79 };
80 
81 #ifdef WIN32
82 #pragma warning( default:4251 )
83 #endif
84 
85 #endif
#define QTX_EXPORT
Definition: Qtx.h:36
For more information see QT documentation.
Definition: SUIT_Application.h:42
The QtxActionGroup class groups actions together.
Definition: QtxActionGroup.h:36
QActionGroup * myActionGroup
Definition: QtxActionGroup.h:78
void selected(QAction *)
Emitted when some child action is toggled by the user.
bool myDropDown
Definition: QtxActionGroup.h:77
An action class which is represented in the menu bar (or toolbar) as a group of items (which can be c...
Definition: QtxActionSet.h:35
virtual void updateAction()
Update action set.
Definition: QtxActionSet.cxx:348
virtual void actionAdded(QAction *)
Notify that action was added.
Definition: QtxActionSet.cxx:317
virtual bool isEmptyAction() const
Check if the action itself should be invisible (only child action are shown)
Definition: QtxActionSet.cxx:393
virtual void actionRemoved(QAction *)
Notify that action was removed.
Definition: QtxActionSet.cxx:324
Enhanced version of Qt combo box class.
Definition: QtxComboBox.h:39