reformatted to Mozilla code style
This commit is contained in:
committed by
borgmanJeremy
parent
c0e2e48db4
commit
c8d15205be
@@ -22,51 +22,74 @@ namespace {
|
||||
#define PADDING_VALUE 2
|
||||
}
|
||||
|
||||
RectangleTool::RectangleTool(QObject *parent) : AbstractTwoPointTool(parent) {
|
||||
m_supportsDiagonalAdj = true;
|
||||
RectangleTool::RectangleTool(QObject* parent)
|
||||
: AbstractTwoPointTool(parent)
|
||||
{
|
||||
m_supportsDiagonalAdj = true;
|
||||
}
|
||||
|
||||
QIcon RectangleTool::icon(const QColor &background, bool inEditor) const {
|
||||
Q_UNUSED(inEditor);
|
||||
return QIcon(iconPath(background) + "square.svg");
|
||||
QIcon
|
||||
RectangleTool::icon(const QColor& background, bool inEditor) const
|
||||
{
|
||||
Q_UNUSED(inEditor);
|
||||
return QIcon(iconPath(background) + "square.svg");
|
||||
}
|
||||
QString RectangleTool::name() const {
|
||||
return tr("Rectangle");
|
||||
QString
|
||||
RectangleTool::name() const
|
||||
{
|
||||
return tr("Rectangle");
|
||||
}
|
||||
|
||||
QString RectangleTool::nameID() {
|
||||
return QLatin1String("");
|
||||
QString
|
||||
RectangleTool::nameID()
|
||||
{
|
||||
return QLatin1String("");
|
||||
}
|
||||
|
||||
QString RectangleTool::description() const {
|
||||
return tr("Set the Rectangle as the paint tool");
|
||||
QString
|
||||
RectangleTool::description() const
|
||||
{
|
||||
return tr("Set the Rectangle as the paint tool");
|
||||
}
|
||||
|
||||
CaptureTool* RectangleTool::copy(QObject *parent) {
|
||||
return new RectangleTool(parent);
|
||||
CaptureTool*
|
||||
RectangleTool::copy(QObject* parent)
|
||||
{
|
||||
return new RectangleTool(parent);
|
||||
}
|
||||
|
||||
void RectangleTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) {
|
||||
if (recordUndo) {
|
||||
updateBackup(pixmap);
|
||||
}
|
||||
painter.setPen(QPen(m_color, m_thickness));
|
||||
painter.setBrush(QBrush(m_color));
|
||||
painter.drawRect(QRect(m_points.first, m_points.second));
|
||||
void
|
||||
RectangleTool::process(QPainter& painter,
|
||||
const QPixmap& pixmap,
|
||||
bool recordUndo)
|
||||
{
|
||||
if (recordUndo) {
|
||||
updateBackup(pixmap);
|
||||
}
|
||||
painter.setPen(QPen(m_color, m_thickness));
|
||||
painter.setBrush(QBrush(m_color));
|
||||
painter.drawRect(QRect(m_points.first, m_points.second));
|
||||
}
|
||||
|
||||
void RectangleTool::paintMousePreview(QPainter &painter, const CaptureContext &context) {
|
||||
painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness));
|
||||
painter.drawLine(context.mousePos, context.mousePos);
|
||||
void
|
||||
RectangleTool::paintMousePreview(QPainter& painter,
|
||||
const CaptureContext& context)
|
||||
{
|
||||
painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness));
|
||||
painter.drawLine(context.mousePos, context.mousePos);
|
||||
}
|
||||
|
||||
void RectangleTool::drawStart(const CaptureContext &context) {
|
||||
m_color = context.color;
|
||||
m_thickness = context.thickness + PADDING_VALUE;
|
||||
m_points.first = context.mousePos;
|
||||
m_points.second = context.mousePos;
|
||||
void
|
||||
RectangleTool::drawStart(const CaptureContext& context)
|
||||
{
|
||||
m_color = context.color;
|
||||
m_thickness = context.thickness + PADDING_VALUE;
|
||||
m_points.first = context.mousePos;
|
||||
m_points.second = context.mousePos;
|
||||
}
|
||||
|
||||
void RectangleTool::pressed(const CaptureContext &context) {
|
||||
Q_UNUSED(context);
|
||||
void
|
||||
RectangleTool::pressed(const CaptureContext& context)
|
||||
{
|
||||
Q_UNUSED(context);
|
||||
}
|
||||
|
||||
@@ -19,22 +19,25 @@
|
||||
|
||||
#include "src/tools/abstracttwopointtool.h"
|
||||
|
||||
class RectangleTool : public AbstractTwoPointTool {
|
||||
Q_OBJECT
|
||||
class RectangleTool : public AbstractTwoPointTool
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RectangleTool(QObject *parent = nullptr);
|
||||
explicit RectangleTool(QObject* parent = nullptr);
|
||||
|
||||
QIcon icon(const QColor &background, bool inEditor) const override;
|
||||
QString name() const override;
|
||||
static QString nameID();
|
||||
QString description() const override;
|
||||
QIcon icon(const QColor& background, bool inEditor) const override;
|
||||
QString name() const override;
|
||||
static QString nameID();
|
||||
QString description() const override;
|
||||
|
||||
CaptureTool* copy(QObject *parent = nullptr) override;
|
||||
void process(
|
||||
QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override;
|
||||
void paintMousePreview(QPainter &painter, const CaptureContext &context) override;
|
||||
CaptureTool* copy(QObject* parent = nullptr) override;
|
||||
void process(QPainter& painter,
|
||||
const QPixmap& pixmap,
|
||||
bool recordUndo = false) override;
|
||||
void paintMousePreview(QPainter& painter,
|
||||
const CaptureContext& context) override;
|
||||
|
||||
public slots:
|
||||
void drawStart(const CaptureContext &context) override;
|
||||
void pressed(const CaptureContext &context) override;
|
||||
void drawStart(const CaptureContext& context) override;
|
||||
void pressed(const CaptureContext& context) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user