--HG-- branch : develop
This commit is contained in:
parent
7b3ab26832
commit
d39fea54cd
|
@ -66,7 +66,6 @@ VToolLine::VToolLine(const VToolLineInitData &initData, QGraphicsItem *parent)
|
||||||
firstPoint(initData.firstPoint),
|
firstPoint(initData.firstPoint),
|
||||||
secondPoint(initData.secondPoint),
|
secondPoint(initData.secondPoint),
|
||||||
lineColor(initData.lineColor),
|
lineColor(initData.lineColor),
|
||||||
m_isHovered(false),
|
|
||||||
m_acceptHoverEvents(true)
|
m_acceptHoverEvents(true)
|
||||||
{
|
{
|
||||||
m_isBoldLine = false;
|
m_isBoldLine = false;
|
||||||
|
@ -183,10 +182,11 @@ QString VToolLine::getTagName() const
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void VToolLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
const qreal width = ScaleWidth(m_isHovered ? qApp->Settings()->WidthMainLine() : qApp->Settings()->WidthHairLine(),
|
// Don't set pen width. Parent should take care of it.
|
||||||
SceneScale(scene()));
|
QPen lPen = pen();
|
||||||
|
lPen.setColor(CorrectColor(this, lineColor));
|
||||||
setPen(QPen(CorrectColor(this, lineColor), width, LineStyleToPenStyle(m_lineType)));
|
lPen.setStyle(LineStyleToPenStyle(m_lineType));
|
||||||
|
setPen(lPen);
|
||||||
|
|
||||||
PaintWithFixItemHighlightSelected<VScaledLine>(this, painter, option, widget);
|
PaintWithFixItemHighlightSelected<VScaledLine>(this, painter, option, widget);
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,6 @@ void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
if (m_acceptHoverEvents)
|
if (m_acceptHoverEvents)
|
||||||
{
|
{
|
||||||
m_isHovered = true;
|
|
||||||
m_isBoldLine = true;
|
m_isBoldLine = true;
|
||||||
setToolTip(MakeToolTip());
|
setToolTip(MakeToolTip());
|
||||||
VScaledLine::hoverEnterEvent(event);
|
VScaledLine::hoverEnterEvent(event);
|
||||||
|
@ -311,7 +310,6 @@ void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
{
|
{
|
||||||
if (m_acceptHoverEvents && vis.isNull())
|
if (m_acceptHoverEvents && vis.isNull())
|
||||||
{
|
{
|
||||||
m_isHovered = false;
|
|
||||||
m_isBoldLine = false;
|
m_isBoldLine = false;
|
||||||
VScaledLine::hoverLeaveEvent(event);
|
VScaledLine::hoverLeaveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,6 @@ private:
|
||||||
/** @brief lineColor color of a line. */
|
/** @brief lineColor color of a line. */
|
||||||
QString lineColor;
|
QString lineColor;
|
||||||
|
|
||||||
bool m_isHovered;
|
|
||||||
bool m_acceptHoverEvents;
|
bool m_acceptHoverEvents;
|
||||||
|
|
||||||
VToolLine(const VToolLineInitData &initData, QGraphicsItem *parent = nullptr);
|
VToolLine(const VToolLineInitData &initData, QGraphicsItem *parent = nullptr);
|
||||||
|
|
|
@ -36,13 +36,17 @@
|
||||||
VScaledLine::VScaledLine(QGraphicsItem *parent)
|
VScaledLine::VScaledLine(QGraphicsItem *parent)
|
||||||
: QGraphicsLineItem(parent),
|
: QGraphicsLineItem(parent),
|
||||||
m_isBoldLine(true)
|
m_isBoldLine(true)
|
||||||
{}
|
{
|
||||||
|
QGraphicsItem::setCacheMode(QGraphicsItem::DeviceCoordinateCache); // Fix problem with constant redraw
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VScaledLine::VScaledLine(const QLineF &line, QGraphicsItem *parent)
|
VScaledLine::VScaledLine(const QLineF &line, QGraphicsItem *parent)
|
||||||
: QGraphicsLineItem(line, parent),
|
: QGraphicsLineItem(line, parent),
|
||||||
m_isBoldLine(true)
|
m_isBoldLine(true)
|
||||||
{}
|
{
|
||||||
|
QGraphicsItem::setCacheMode(QGraphicsItem::DeviceCoordinateCache); // Fix problem with constant redraw
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VScaledLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void VScaledLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user