qt-material-widgets/components/iconmenu.h

60 lines
1.2 KiB
C
Raw Normal View History

2016-04-24 22:26:28 +00:00
#ifndef ICONMENU_H
#define ICONMENU_H
#include <QWidget>
2016-04-26 23:14:39 +00:00
#include <QPoint>
2016-04-24 23:37:59 +00:00
#include "iconbutton.h"
2016-04-24 22:26:28 +00:00
2016-04-24 23:37:59 +00:00
class MenuOverlay : public QWidget
2016-04-24 22:26:28 +00:00
{
Q_OBJECT
public:
2016-04-24 23:37:59 +00:00
explicit MenuOverlay(QWidget *parent = 0);
~MenuOverlay();
};
2016-04-26 23:14:39 +00:00
class QPropertyAnimation;
2016-04-26 23:57:16 +00:00
class ScaleEffect;
2016-04-26 23:14:39 +00:00
class Menu;
2016-04-24 23:37:59 +00:00
class IconMenu : public IconButton
{
Q_OBJECT
2016-04-26 23:14:39 +00:00
Q_PROPERTY(qreal progress WRITE setProgress READ progress NOTIFY progressChanged)
2016-04-24 23:37:59 +00:00
public:
explicit IconMenu(const QIcon &icon, QWidget *parent = 0);
2016-04-24 22:26:28 +00:00
~IconMenu();
2016-04-24 23:37:59 +00:00
2016-04-26 23:14:39 +00:00
void setProgress(qreal progress);
inline qreal progress() const { return _progress; }
void setOverlayParent(QWidget *parent);
2016-04-26 23:14:39 +00:00
protected slots:
void toggleMenu();
void animationFinished();
signals:
void progressChanged(qreal);
2016-04-24 23:37:59 +00:00
protected:
2016-04-26 23:14:39 +00:00
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
2016-04-24 23:37:59 +00:00
bool event(QEvent *event) Q_DECL_OVERRIDE;
2016-04-26 23:14:39 +00:00
void updateOverlayGeometry();
2016-04-24 23:37:59 +00:00
private:
2016-04-26 23:14:39 +00:00
MenuOverlay *const _menuOverlay;
Menu *const _menu;
QPropertyAnimation *const _animation;
2016-04-26 23:57:16 +00:00
ScaleEffect *const _effect;
2016-04-26 23:14:39 +00:00
QPoint _menuPos;
bool _menuVisible;
qreal _progress;
2016-04-24 22:26:28 +00:00
};
#endif // ICONMENU_H