Version: 9.15.0
QtxNotify.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 #ifndef QTXNOTIFY_H
24 #define QTXNOTIFY_H
25 
26 #include "Qtx.h"
27 
28 #include <QWidget>
29 
30 #include <QList>
31 #include <QAbstractAnimation>
32 
33 class QTimer;
34 
36 {
37  Q_OBJECT
38 
39  class NotifyWidget;
40 
41 public:
42  typedef enum {
44  BottomToTop
45  } PlacementPolicy;
46 
47  Q_ENUM(PlacementPolicy)
48 
49 public:
50  QtxNotify(QObject* = 0);
51  QtxNotify(QWidget*, QObject* = 0);
52  virtual ~QtxNotify();
53 
54  int showNotification(const QString&, const QString&, int timeout = -1);
55  void hideNotification(const QString& = QString());
56  void hideNotification(const int);
57 
58  QWidget* window() const;
59  void setWindow(QWidget* window);
60 
61  double notificationSize() const;
62  void setNotificationSize(const double);
63 
64  int animationTime() const;
65  void setAnimationTime(const int);
66 
67  PlacementPolicy placementPolicy() const;
68  void setPlacementPolicy(const PlacementPolicy&);
69 
70  int alignment() const;
71  void setAlignment(const int);
72 
73  virtual bool eventFilter(QObject*, QEvent*);
74 
75 private Q_SLOTS:
76  void onArrangeTimeout();
77  void onAnimationDestroyed(QObject*);
78 
79 private:
80  void triggerArrange();
81  void updateArrangement();
82  void arrangeNotifications(bool = true);
83 
84  NotifyWidget* notification(const int);
85  NotifyWidget* notification(const QString&);
86  void removeNotification(NotifyWidget*);
87 
88  int generateId() const;
89 
90  bool isAnimated() const;
91 
92  bool hasAcitveAnimation() const;
93  void startAnimation(QAbstractAnimation*);
94  void stopAnimation(QAbstractAnimation*);
95 
96  QPoint referencePoint() const;
97  int notificationWidth() const;
98 
99 private:
102 
103 private:
104  double mySize;
108  QTimer* myArrangeTimer;
109 
113 
115 
117 };
118 
119 #endif // QTXNOTIFY_H
#define QTX_EXPORT
Definition: Qtx.h:36
For more information see QT documentation.
Definition: SUIT_Application.h:42
QtxNotify::NotifyWidget Class represented notification widget.
Definition: QtxNotify.cxx:41
Definition: QtxNotify.h:36
PlacementPolicy myPlacement
Definition: QtxNotify.h:106
bool myAnimBlock
Definition: QtxNotify.h:111
QTimer * myArrangeTimer
Definition: QtxNotify.h:108
QList< QAbstractAnimation * > AnimationList
Definition: QtxNotify.h:101
int myAlignment
Definition: QtxNotify.h:107
QList< QtxNotify::NotifyWidget * > NotifyList
Definition: QtxNotify.h:100
PlacementPolicy
Definition: QtxNotify.h:42
@ TopToBottom
Definition: QtxNotify.h:43
AnimationList myAnimations
Definition: QtxNotify.h:112
QWidget * myWindow
Definition: QtxNotify.h:105
double mySize
Definition: QtxNotify.h:104
NotifyList myNotifications
Definition: QtxNotify.h:114
int myAnimTime
Definition: QtxNotify.h:110