Version: 9.12.0
QtxMenu.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: QtxMenu.h
21 // Author: Sergey TELKOV
22 //
23 #ifndef QTXMENU_H
24 #define QTXMENU_H
25 
26 #include "Qtx.h"
27 
28 #include <QMenu>
29 
30 class QWidgetAction;
31 
32 class QTX_EXPORT QtxMenu : public QMenu
33 {
34  Q_OBJECT
35 
36  class Title;
37 
38 public:
40  typedef enum {
43  TitleOff
44  } TitleMode;
45 
46 public:
47  QtxMenu( QWidget* = 0 );
48  virtual ~QtxMenu();
49 
50  QIcon titleIcon() const;
51  QString titleText() const;
52 
53  TitleMode titleMode() const;
54  Qt::Alignment titleAlignment() const;
55 
56  virtual void setTitleIcon( const QIcon& );
57  virtual void setTitleText( const QString& );
58 
59  virtual void setTitleMode( const TitleMode );
60  virtual void setTitleAlignment( const Qt::Alignment );
61 
62  virtual void addGroup( const QString& );
63  virtual void addGroup( const QIcon&, const QString& );
64 
65 public slots:
66  virtual void setVisible( bool );
67 
68 private:
69  void updateTitle();
70  void insertTitle();
71  void removeTitle();
72 
73 private:
77 };
78 
79 #endif // QTXMENU_H
#define QTX_EXPORT
Definition: Qtx.h:36
Popup menu title item.
Definition: QtxMenu.cxx:41
The class QtxMenu represents the popup menu with the title.
Definition: QtxMenu.h:33
TitleMode myMode
Definition: QtxMenu.h:74
QWidgetAction * myAction
Definition: QtxMenu.h:76
Title * myTitle
Definition: QtxMenu.h:75
TitleMode
Popup menu title mode.
Definition: QtxMenu.h:40
@ TitleAuto
auto mode
Definition: QtxMenu.h:41
@ TitleOn
always on (display title)
Definition: QtxMenu.h:42