2016-10-16 15:00:53 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vgraphicsfillitem.cpp
|
|
|
|
** @author Bojan Kverh
|
|
|
|
** @date October 16, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2016-10-16 15:00:53 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2016-10-16 15:00:53 +02:00
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#include "vgraphicsfillitem.h"
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-01-22 13:32:25 +01:00
|
|
|
VGraphicsFillItem::VGraphicsFillItem(QGraphicsItem *parent)
|
|
|
|
:QGraphicsPathItem(parent)
|
2016-10-16 15:00:53 +02:00
|
|
|
{}
|
|
|
|
|
2023-05-02 16:38:02 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VGraphicsFillItem::VGraphicsFillItem(const QPainterPath &path, QGraphicsItem *parent)
|
|
|
|
:QGraphicsPathItem(path, parent)
|
|
|
|
{}
|
|
|
|
|
2016-10-16 15:00:53 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VGraphicsFillItem::~VGraphicsFillItem()
|
|
|
|
{}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VGraphicsFillItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
|
|
|
|
{
|
2016-12-20 20:19:21 +01:00
|
|
|
Q_UNUSED(option)
|
|
|
|
Q_UNUSED(widget)
|
2016-10-16 15:00:53 +02:00
|
|
|
painter->save();
|
2021-01-23 17:54:07 +01:00
|
|
|
|
2023-04-10 11:20:18 +02:00
|
|
|
QPen pen;
|
|
|
|
|
|
|
|
if (m_customPen)
|
|
|
|
{
|
|
|
|
pen = this->pen();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pen = painter->pen();
|
|
|
|
pen.setWidthF(width);
|
2023-05-02 16:38:02 +02:00
|
|
|
pen.setCapStyle(Qt::RoundCap);
|
|
|
|
pen.setJoinStyle(Qt::RoundJoin);
|
2023-04-10 11:20:18 +02:00
|
|
|
}
|
2021-01-23 17:54:07 +01:00
|
|
|
painter->setPen(pen);
|
|
|
|
|
2016-10-16 15:00:53 +02:00
|
|
|
painter->setBrush(painter->pen().color());
|
|
|
|
painter->drawPath(path());
|
|
|
|
painter->restore();
|
|
|
|
}
|