LibEngsas
eaction.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010 - 2012 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Lesser General Public
6  License as published by the Free Software Foundation; either
7  version 2.1 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public
15  License along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17  MA 02110-1301 USA.
18 */
19 
20 #ifndef EACTION_H
21 #define EACTION_H
22 
23 #include "eglobal.h"
24 
25 #include <QAction>
26 
27 #include <QPointer>
28 
37 class E_CORE_EXPORT EAction : public QAction
38 {
39  Q_OBJECT
45  Q_PROPERTY(bool showText READ showText WRITE setShowText)
46  public:
52  EAction ( QString standardIconName, QString iconPath, const QString & text, QObject * parent = 0, bool enableText = false );
53  EAction ( const QString & text, QObject * parent = 0 );
54  ~EAction();
61  QAction *actionWithText();
62  void setText ( const QString & text );
63  void setIcon(const QIcon& icon);
64  void setIcon(QString standardIconName, QString iconPath );
68  void setShowText(bool anytime = true);
69  bool showText() const;
70 
71  public slots:
72  void setEnabled ( bool status );
73  void setDisabled ( bool status );
74 
75  private slots:
76  void triggeredByPass();
77 
78  private:
79  void init(bool enableText);
80 
81  QString myText;
82  bool iconsAndText, myShowText;
83  QPointer<QAction> myActionWithText;
84 };
85 
86 #endif // EACTION_H