CFocusDecorator.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 // Qt includes
5 #include <QtCore/QtGlobal>
6 #include <QtCore/QMap>
7 #include <QtCore/QEvent>
8 #if QT_VERSION >= 0x050000
9 #include <QtWidgets/QGraphicsEffect>
10 #include <QtWidgets/QWidget>
11 #else
12 #include <QtGui/QGraphicsEffect>
13 #include <QtGui/QWidget>
14 #endif
15 
16 // ACF includes
17 #include <istd/TIFactory.h>
18 
19 
20 namespace iwidgets
21 {
22 
23 
24 /*
25  Helper class for creating widget decorations based on graphics effects, such drop shadow.
26 */
27 class CFocusDecorator: public QObject
28 {
29  Q_OBJECT
30 public:
32 
33  explicit CFocusDecorator(QObject* parentPtr = NULL);
34  virtual ~CFocusDecorator();
35 
36  bool RegisterWidget(QWidget* widgetPtr, GraphicsEffectFactory* effectFactoryPtr);
37  void UnregisterWidget(QWidget* widgetPtr);
38  void UnregisterAllWidgets();
39 
40 protected:
41  // reimplemented (QObject)
42  virtual bool eventFilter(QObject* objectPtr, QEvent* eventPtr);
43 
44 private Q_SLOTS:
45  void OnObjectDestroyed(QObject* objectPtr);
46 
47 private:
48  typedef QMap<QObject*, GraphicsEffectFactory*> WidgetEffectsMap;
49  WidgetEffectsMap m_widgetEffectsMap;
50 };
51 
52 
53 } // namespace iwidgets
54 
55 
bool RegisterWidget(QWidget *widgetPtr, GraphicsEffectFactory *effectFactoryPtr)
Generic interface for a factory.
Definition: TIFactory.h:17
void UnregisterWidget(QWidget *widgetPtr)
#define NULL
Definition: istd.h:64
CFocusDecorator(QObject *parentPtr=NULL)
istd::TIFactory< QGraphicsEffect > GraphicsEffectFactory
virtual bool eventFilter(QObject *objectPtr, QEvent *eventPtr)

© 2007-2017 Witold Gantzke and Kirill Lepskiy