-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathfloatingtoolbar.h
65 lines (53 loc) · 1.54 KB
/
floatingtoolbar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
SPDX-FileCopyrightText: 2007-2008 Urs Wolfer <[email protected]>
Parts of this file have been take from okular:
SPDX-FileCopyrightText: 2004-2005 Enrico Ros <[email protected]>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef FLOATINGTOOLBAR_H
#define FLOATINGTOOLBAR_H
#include <QToolBar>
/**
* @short A toolbar widget that slides in from a side.
*
* This is a shaped widget that slides in from a side of the 'anchor widget'
* it's attached to. It can be dragged and docked on {left,top,right,bottom}
* sides and contains actions.
*/
class FloatingToolBar : public QToolBar
{
Q_OBJECT
public:
FloatingToolBar(QWidget *parent, QWidget *anchorWidget);
~FloatingToolBar() override;
enum Side {
Left = 0,
Top = 1,
Right = 2,
Bottom = 3,
};
Q_ENUM(Side)
void addAction(QAction *action);
void setSide(Side side);
Q_SIGNALS:
void orientationChanged(int side);
public Q_SLOTS:
void setSticky(bool sticky);
void showAndAnimate();
void hideAndDestroy();
protected:
bool eventFilter(QObject *o, QEvent *e) override;
void paintEvent(QPaintEvent *) override;
void mousePressEvent(QMouseEvent *e) override;
void mouseMoveEvent(QMouseEvent *e) override;
void enterEvent(QEnterEvent *event) override;
void leaveEvent(QEvent *e) override;
void mouseReleaseEvent(QMouseEvent *e) override;
void wheelEvent(QWheelEvent *e) override;
private:
class FloatingToolBarPrivate *d;
private Q_SLOTS:
void animate();
void hide();
};
#endif