Pencil2D Animation
Download Community News Docs Contribute
  • Overview
  • Articles
  • Code
  •  
  • Class List
  • Class Index
  • Class Hierarchy
  • Class Members
  • File List
Loading...
Searching...
No Matches
  • app
  • src
buttonappearancewatcher.h
1/*
2
3Pencil2D - Traditional Animation Software
4Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5Copyright (C) 2012-2020 Matthew Chiawen Chang
6
7This program is free software; you can redistribute it and/or
8modify it under the terms of the GNU General Public License
9as published by the Free Software Foundation; version 2 of the License.
10
11This program is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16*/
17#ifndef BUTTONAPPEARANCEWATCHER_H
18#define BUTTONAPPEARANCEWATCHER_H
19
20enum class AppearanceEventType
21{
22 NONE,
23 LIGHT_APPEARANCE,
24 DARK_APPEARANCE,
25 ICON_NORMAL,
26 ICON_ACTIVE
27};
28
29#include "appearance.h"
30
31class ButtonAppearanceWatcher : public QObject
32{
33 Q_OBJECT
34
35public:
36 explicit ButtonAppearanceWatcher(IconResource normalIconResource,
37 IconResource hoverIconResource,
38 QObject * parent = nullptr);
39 virtual bool eventFilter(QObject * watched, QEvent * event) override;
40
41private:
42 bool shouldUpdateResource(QEvent* event, AppearanceEventType appearanceType) const;
43 AppearanceEventType determineAppearanceEvent(QEvent* event) const;
44
45 const IconResource mNormalIconResource;
46 const IconResource mHoverIconResource;
47
48 AppearanceEventType mOldAppearanceType = AppearanceEventType::NONE;
49};
50
51#endif // BUTTONAPPEARANCEWATCHER_H
ButtonAppearanceWatcher
Definition: buttonappearancewatcher.h:32
QEvent
QObject
QObject::Q_OBJECT
Q_OBJECTQ_OBJECT
QObject::event
virtual bool event(QEvent *e)
QObject::parent
QObject * parent() const const
IconResource
Definition: appearance.h:24
Generated on Thu Jun 5 2025 14:06:43 for Pencil2D by doxygen 1.9.6 based on revision 4c63407997b2c03e5048716586dec6fbbb755173