qt-material-widgets/components/tabs_internal.h

65 lines
1.2 KiB
C
Raw Normal View History

#ifndef TABS_INTERNAL_H
#define TABS_INTERNAL_H
#include <QObject>
#include "flatbutton.h"
class Tabs;
2016-06-05 12:07:56 +00:00
class QPropertyAnimation;
2016-06-05 12:07:56 +00:00
class TabsInkBar : public QWidget
{
Q_OBJECT
2016-06-05 12:07:56 +00:00
Q_PROPERTY(qreal tweenValue WRITE setTweenValue READ tweenValue)
public:
2016-06-05 12:07:56 +00:00
TabsInkBar(Tabs *parent);
~TabsInkBar();
void setTweenValue(qreal value);
inline qreal tweenValue() const { return _tween; }
2016-06-05 12:07:56 +00:00
void refreshGeometry();
void animate();
2016-06-05 12:07:56 +00:00
protected:
bool eventFilter(QObject *obj, QEvent *event);
void paintEvent(QPaintEvent *event);
private:
2016-06-05 12:07:56 +00:00
Q_DISABLE_COPY(TabsInkBar)
2016-06-05 12:07:56 +00:00
Tabs *const tabs;
QPropertyAnimation *_animation;
2016-06-05 12:07:56 +00:00
qreal _tween;
QRect _previousGeometry;
};
class Tab : public FlatButton
{
Q_OBJECT
public:
explicit Tab(QWidget *parent = 0);
explicit Tab(QString text, QWidget *parent = 0);
~Tab();
2016-06-11 15:43:33 +00:00
inline void setActive(bool state) { _active = state; update(); }
inline bool isActive() const { return _active; }
QSize sizeHint() const Q_DECL_OVERRIDE;
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(Tab)
void init();
2016-06-11 15:43:33 +00:00
bool _active;
};
#endif // TABS_INTERNAL_H