summary refs log tree commit diff
path: root/src/ui/FloatingButton.h
blob: df14dd2cefaa6db1a780ee18ee58ac68457784d1 (plain) (blame)
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
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

#pragma once

#include "RaisedButton.h"

constexpr int DIAMETER  = 40;
constexpr int ICON_SIZE = 18;

constexpr int OFFSET_X = 30;
constexpr int OFFSET_Y = 20;

class FloatingButton : public RaisedButton
{
    Q_OBJECT

public:
    FloatingButton(const QIcon &icon, QWidget *parent = nullptr);

    QSize sizeHint() const override { return QSize(DIAMETER, DIAMETER); };
    QRect buttonGeometry() const;

protected:
    bool event(QEvent *event) override;
    bool eventFilter(QObject *obj, QEvent *event) override;

    void paintEvent(QPaintEvent *event) override;
};