2017-06-16 13:53:08 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 14 6, 2017
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2017-06-16 13:53:08 +02:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2017 Valentina project
|
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
|
|
|
**
|
|
|
|
** 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VSCENEPOINT_H
|
|
|
|
#define VSCENEPOINT_H
|
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include <QGraphicsEllipseItem>
|
|
|
|
|
2017-10-23 20:10:48 +02:00
|
|
|
#include "../vmisc/def.h"
|
|
|
|
|
2017-06-16 13:53:08 +02:00
|
|
|
class VGraphicsSimpleTextItem;
|
|
|
|
class VPointF;
|
2017-06-23 11:25:02 +02:00
|
|
|
class VScaledLine;
|
2017-06-16 13:53:08 +02:00
|
|
|
|
|
|
|
class VScenePoint: public QGraphicsEllipseItem
|
|
|
|
{
|
|
|
|
public:
|
2017-06-16 15:44:57 +02:00
|
|
|
explicit VScenePoint(QGraphicsItem *parent = nullptr);
|
2017-06-23 11:25:02 +02:00
|
|
|
virtual ~VScenePoint() = default;
|
2017-06-16 13:53:08 +02:00
|
|
|
|
2017-10-23 20:10:48 +02:00
|
|
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
|
|
|
enum { Type = UserType + static_cast<int>(Vis::ScenePoint)};
|
|
|
|
|
2017-06-23 11:25:02 +02:00
|
|
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget = nullptr) Q_DECL_OVERRIDE;
|
|
|
|
virtual void RefreshPointGeometry(const VPointF &point);
|
2017-06-16 13:53:08 +02:00
|
|
|
|
2017-10-23 20:10:48 +02:00
|
|
|
void RefreshLine();
|
|
|
|
|
2017-06-16 13:53:08 +02:00
|
|
|
protected:
|
|
|
|
/** @brief namePoint point label. */
|
|
|
|
VGraphicsSimpleTextItem *m_namePoint;
|
|
|
|
|
|
|
|
/** @brief lineName line what we see if label moved too away from point. */
|
2017-06-23 11:25:02 +02:00
|
|
|
VScaledLine *m_lineName;
|
2017-06-16 13:53:08 +02:00
|
|
|
|
|
|
|
bool m_onlyPoint;
|
|
|
|
bool m_isHovered;
|
2017-09-17 08:19:13 +02:00
|
|
|
bool m_showLabel;
|
2017-06-16 13:53:08 +02:00
|
|
|
|
|
|
|
/** @brief m_baseColor base color of point. */
|
|
|
|
QColor m_baseColor;
|
|
|
|
|
2017-10-30 07:34:18 +01:00
|
|
|
bool m_selectedFromChild;
|
|
|
|
|
2017-06-16 13:53:08 +02:00
|
|
|
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
|
|
|
|
|
|
|
void SetOnlyPoint(bool value);
|
|
|
|
bool IsOnlyPoint() const;
|
|
|
|
private:
|
|
|
|
Q_DISABLE_COPY(VScenePoint)
|
|
|
|
|
|
|
|
void ScaleMainPenWidth(qreal scale);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VSCENEPOINT_H
|