Files
flameshot/src/tools/abstractpathtool.h
Haris Gušić 534f05b238 Refactor tool size handling (#1969)
* Add ConfigHandler::toolSize and setToolSize

* Refactor thickness (now toolSize) in CaptureWidget

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix update of tool size while object is drawn

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Rename thickness to tool size across the board

Tool size is the generic term. Depending on the selected tool,
different specialized names are used. This has always been the case
in the config.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Reorder circle count tool

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* clang-format

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-20 00:01:35 +02:00

45 lines
1.2 KiB
C++

// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
#pragma once
#include "capturetool.h"
class AbstractPathTool : public CaptureTool
{
Q_OBJECT
public:
explicit AbstractPathTool(QObject* parent = nullptr);
bool isValid() const override;
bool closeOnButtonPressed() const override;
bool isSelectable() const override;
bool showMousePreview() const override;
QRect mousePreviewRect(const CaptureContext& context) const override;
QRect boundingRect() const override;
void move(const QPoint& mousePos) override;
const QPoint* pos() override;
int size() const override { return m_thickness; };
public slots:
void drawEnd(const QPoint& p) override;
void drawMove(const QPoint& p) override;
void onColorChanged(const QColor& c) override;
void onSizeChanged(int size) override;
protected:
void copyParams(const AbstractPathTool* from, AbstractPathTool* to);
void addPoint(const QPoint& point);
// class members
QRect m_pathArea;
QColor m_color;
QVector<QPoint> m_points;
// use m_padding to extend the area of the backup
int m_padding;
QPoint m_pos;
private:
int m_thickness;
};