Disable label if pattern piece disabled.
--HG-- branch : feature
This commit is contained in:
parent
4d6fae5840
commit
8aa8438064
|
@ -50,9 +50,7 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte
|
|||
namePoint = new VGraphicsSimpleTextItem(this);
|
||||
connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu);
|
||||
connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolPoint::DeleteFromLabel);
|
||||
namePoint->setBrush(Qt::black);
|
||||
lineName = new QGraphicsLineItem(this);
|
||||
lineName->setPen(QPen(Qt::black));
|
||||
connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition);
|
||||
this->setBrush(QBrush(Qt::NoBrush));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
|
@ -136,9 +134,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName)
|
|||
{
|
||||
VDrawTool::ChangedActivDraw(newName);
|
||||
this->setEnabled(nameActivDraw == newName);
|
||||
namePoint->setBrush(QBrush(currentColor));
|
||||
lineName->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
namePoint->setEnabled(nameActivDraw == newName);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -83,6 +83,21 @@ void VGraphicsSimpleTextItem::paint(QPainter *painter, const QStyleOptionGraphic
|
|||
QGraphicsSimpleTextItem::paint(painter, &myOption, widget);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VGraphicsSimpleTextItem::setEnabled(bool enabled)
|
||||
{
|
||||
QGraphicsSimpleTextItem::setEnabled(enabled);
|
||||
const QPalette palet = this->scene()->palette();
|
||||
if (enabled)
|
||||
{
|
||||
setBrush(palet.brush(QPalette::Active, QPalette::Text));
|
||||
}
|
||||
else
|
||||
{
|
||||
setBrush(palet.brush(QPalette::Disabled, QPalette::Text));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief itemChange handle item change.
|
||||
|
|
|
@ -47,6 +47,8 @@ public:
|
|||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Vis::GraphicsSimpleTextItem)};
|
||||
|
||||
void setEnabled(bool enabled);
|
||||
signals:
|
||||
/**
|
||||
* @brief NameChangePosition emit when label change position.
|
||||
|
|
Loading…
Reference in New Issue
Block a user