ACF $AcfVersion:0$
CFocusDecorator.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ACF-Commercial
2#pragma once
3
4
5// Qt includes
6#include <QtCore/QtGlobal>
7#include <QtCore/QMap>
8#include <QtCore/QEvent>
9#if QT_VERSION >= 0x050000
10#include <QtWidgets/QGraphicsEffect>
11#include <QtWidgets/QWidget>
12#else
13#include <QtGui/QGraphicsEffect>
14#include <QtGui/QWidget>
15#endif
16
17// ACF includes
18#include <istd/IPolymorphic.h>
19
20
21namespace iwidgets
22{
23
24
25/*
26 Helper class for creating widget decorations based on graphics effects, such drop shadow.
27*/
28class CFocusDecorator: public QObject
29{
30 Q_OBJECT
31public:
33 {
34 public:
35 virtual std::unique_ptr<QGraphicsEffect> CreateEffect() const = 0;
36 };
37
38 explicit CFocusDecorator(QObject* parentPtr = NULL);
40
41 bool RegisterWidget(QWidget* widgetPtr, IGraphicsEffectFactory* effectFactoryPtr);
42 void UnregisterWidget(QWidget* widgetPtr);
44
45protected:
46 // reimplemented (QObject)
47 virtual bool eventFilter(QObject* objectPtr, QEvent* eventPtr) override;
48
49private Q_SLOTS:
50 void OnObjectDestroyed(QObject* objectPtr);
51
52private:
53 typedef QMap<QObject*, IGraphicsEffectFactory*> WidgetEffectsMap;
54 WidgetEffectsMap m_widgetEffectsMap;
55};
56
57
58} // namespace iwidgets
59
60
Base interface for all used interfaces and implementations.
virtual std::unique_ptr< QGraphicsEffect > CreateEffect() const =0
CFocusDecorator(QObject *parentPtr=NULL)
virtual bool eventFilter(QObject *objectPtr, QEvent *eventPtr) override
bool RegisterWidget(QWidget *widgetPtr, IGraphicsEffectFactory *effectFactoryPtr)
void UnregisterWidget(QWidget *widgetPtr)
#define NULL
Definition istd.h:74
Namespace contains implementation of Qt widget extensions.