|
|
|
|
|
#include "MyQGraphicsTextItem.h"
|
|
|
|
|
|
|
|
|
|
|
|
MyQGraphicsTextItem::~MyQGraphicsTextItem()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MyQGraphicsTextItem::SetTextAttr(double x1, double y1)
|
|
|
|
|
|
{
|
|
|
|
|
|
//<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0>λ<EFBFBD><CEBB>
|
|
|
|
|
|
setPos(QPointF(x1, y1));
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ID
|
|
|
|
|
|
//m_id = GlobalDefine::GetInstance()->GetItemId();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ˮƽ<CBAE><C6BD>
|
|
|
|
|
|
m_levelLine.setP1(QPointF(x1, y1));
|
|
|
|
|
|
m_levelLine.setP2(QPointF(x1 + 100, y1));
|
|
|
|
|
|
|
|
|
|
|
|
m_translteType = NONE;
|
|
|
|
|
|
|
|
|
|
|
|
//QFont font = this->font(); // <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
|
|
|
|
|
|
//font.setPointSize(40); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>СΪ24
|
|
|
|
|
|
//this->setFont(font); // Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MyQGraphicsTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
|
|
|
|
|
{
|
|
|
|
|
|
QGraphicsTextItem::paint(painter, option, widget);
|
|
|
|
|
|
|
|
|
|
|
|
/*QPen pen;
|
|
|
|
|
|
pen.setWidth(FEATURE_POINT_LINE_WIDTH);
|
|
|
|
|
|
pen.setColor(RECT_COLOR);
|
|
|
|
|
|
painter->setPen(pen);
|
|
|
|
|
|
painter->drawRect(this->boundingRect());*/
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void MyQGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_textItemIsSelect = !m_textItemIsSelect;
|
|
|
|
|
|
if (m_textItemIsSelect)
|
|
|
|
|
|
{
|
|
|
|
|
|
setDefaultTextColor(CUR_SELECT_DIE);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
setDefaultTextColor(RECT_COLOR);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (event->button() == Qt::LeftButton)
|
|
|
|
|
|
{
|
|
|
|
|
|
emit signal_select(m_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|