Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
868 B
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2015 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef __KIS_DRAGGABLE_TOOL_BUTTON_H
#define __KIS_DRAGGABLE_TOOL_BUTTON_H

#include <QToolButton>


class KisDraggableToolButton : public QToolButton
{
    Q_OBJECT
public:
    KisDraggableToolButton(QWidget *parent);
    ~KisDraggableToolButton() override;

    void mousePressEvent(QMouseEvent *e) override;
    void mouseMoveEvent(QMouseEvent *e) override;

    void beginDrag(const QPoint &pos);
    int continueDrag(const QPoint &pos);
    int movementDelta(const QPoint &pos);

private:
    qreal tangent();

Q_SIGNALS:
    void offsetChanged(int offset);
    void valueChanged(int delta);

private:
    Qt::Orientation m_orientation;
    QPoint m_startPoint;
    QPoint m_lastPosition;
};

#endif /* __KIS_DRAGGABLE_TOOL_BUTTON_H */