Version: 9.12.0
QtxActionSet.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 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: QtxActionSet.h
21 // Author: Sergey TELKOV
22 //
23 #ifndef QTXACTIONSET_H
24 #define QTXACTIONSET_H
25 
26 #include "QtxAction.h"
27 
28 #include <QList>
29 
30 #ifdef WIN32
31 #pragma warning( disable:4251 )
32 #endif
33 
35 {
36  Q_OBJECT
37 
38 public:
39  QtxActionSet( QObject* = 0 );
40  virtual ~QtxActionSet();
41 
42  QList<QAction*> actions() const;
43  void setActions( const QList<QAction*>& );
44 
45  void insertActions( const QList<QAction*>&, const int = -1 );
46 
47  int insertAction( QAction*, const int id = -1, const int = -1 );
48  int insertAction( const QString&, const int id = -1, const int = -1 );
49  int insertAction( const QString&, const QIcon&, const int id = -1, const int = -1 );
50 
51  void removeAction( QAction* );
52  void removeAction( const int );
53 
54  void clear();
55 
56 signals:
57  void triggered( int );
58  void triggered( QAction* );
59 
60 private slots:
61  void onChanged();
62  void onActionTriggered( bool = false );
63 
64 protected:
65  virtual void addedTo( QWidget* );
66  virtual void removedFrom( QWidget* );
67 
68  virtual void actionAdded( QAction* );
69  virtual void actionRemoved( QAction* );
70 
71  QAction* action( int ) const;
72  int actionId( QAction* ) const;
73  void setActionId( QAction*, const int );
74 
75  virtual bool isEmptyAction() const;
76 
77  virtual void updateAction();
78  virtual void updateAction( QWidget* );
79 
80 private:
81  int generateId() const;
82 
83 private:
85 
86 private:
88 };
89 
90 #ifdef WIN32
91 #pragma warning( default:4251 )
92 #endif
93 
94 #endif
#define QTX_EXPORT
Definition: Qtx.h:36
For more information see QT documentation.
Definition: SUIT_Application.h:42
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
void triggered(QAction *)
Emitted when some child action is activated by the user.
QList< QAction * > ActionList
Definition: QtxActionSet.h:84
void triggered(int)
Emitted when some child action is activated by the user.
ActionList mySet
actions list
Definition: QtxActionSet.h:87
Generic action class.
Definition: QtxAction.h:40
virtual void addedTo(QWidget *)
Called when the action is added to the widget.
Definition: QtxAction.cxx:250
virtual void removedFrom(QWidget *)
Called when the action is removed from the widget.
Definition: QtxAction.cxx:263