优化井壁取心文本位置
This commit is contained in:
parent
b67acd9513
commit
fcca5c49f3
|
|
@ -295,8 +295,9 @@ void TransparentDraggableSwallCore::setRange(double left_Low, double right_Hight
|
||||||
|
|
||||||
drawOil(left_Low2, right_Hight2, lY1, lY2);
|
drawOil(left_Low2, right_Hight2, lY1, lY2);
|
||||||
|
|
||||||
mItemTitle->position->setCoords(mPlot->xAxis->pixelToCoord(x2+8),
|
int textLength = mstrTitle.size() * m_textWidth;
|
||||||
mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+12));
|
mItemTitle->position->setCoords(mPlot->xAxis->pixelToCoord(x2+2),
|
||||||
|
mPlot->yAxis->pixelToCoord(y1+(m_fLeftSpace+m_fTriangleLen)+m_fImageWidth+2+textLength/2.0));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -430,10 +431,12 @@ void TransparentDraggableSwallCore::initRect()
|
||||||
// mPixmap_Color->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 KeepAspectRatio
|
// mPixmap_Color->setScaled(true, Qt::IgnoreAspectRatio); // 设置缩放方式 KeepAspectRatio
|
||||||
// mPixmap_Color->setLayer("overlay"); // 确保在最上层
|
// mPixmap_Color->setLayer("overlay"); // 确保在最上层
|
||||||
|
|
||||||
|
QFont font(QFont("Arial", 6, QFont::Light));
|
||||||
|
|
||||||
mItemTitle = new QCPItemText(mPlot);
|
mItemTitle = new QCPItemText(mPlot);
|
||||||
mItemTitle->setText(mstrTitle);
|
mItemTitle->setText(mstrTitle);
|
||||||
//mItemTitle->setBrush(QBrush(Qt::red));
|
//mItemTitle->setBrush(QBrush(Qt::red));
|
||||||
mItemTitle->setFont(QFont("Arial", 6, QFont::Light));
|
mItemTitle->setFont(font);
|
||||||
mItemTitle->setColor(Qt::black);
|
mItemTitle->setColor(Qt::black);
|
||||||
mItemTitle->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
mItemTitle->setPositionAlignment(Qt::AlignTop | Qt::AlignHCenter);
|
||||||
mItemTitle->position->setType(QCPItemPosition::ptPlotCoords);
|
mItemTitle->position->setType(QCPItemPosition::ptPlotCoords);
|
||||||
|
|
@ -441,6 +444,11 @@ void TransparentDraggableSwallCore::initRect()
|
||||||
mItemTitle->position->setCoords(0.5, 0);
|
mItemTitle->position->setCoords(0.5, 0);
|
||||||
mItemTitle->setLayer("overlay");
|
mItemTitle->setLayer("overlay");
|
||||||
|
|
||||||
|
//字体宽度
|
||||||
|
QFontMetrics metrics(font);
|
||||||
|
QString text = "1";
|
||||||
|
m_textWidth = metrics.width(text); // 获取文本宽度
|
||||||
|
|
||||||
//三角形2边
|
//三角形2边
|
||||||
m_qcpItemLine1 = new QCPItemLine(mPlot);
|
m_qcpItemLine1 = new QCPItemLine(mPlot);
|
||||||
m_qcpItemLine1->setPen(QPen(QColor(0, 0, 0, 200)));
|
m_qcpItemLine1->setPen(QPen(QColor(0, 0, 0, 200)));
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,8 @@ public:
|
||||||
//
|
//
|
||||||
float m_fColorWordLen=30;//颜色文字长度
|
float m_fColorWordLen=30;//颜色文字长度
|
||||||
|
|
||||||
|
int m_textWidth = 0;
|
||||||
|
|
||||||
//鼠标形状
|
//鼠标形状
|
||||||
bool m_bArrow = false;
|
bool m_bArrow = false;
|
||||||
bool m_bMoveRect = false;
|
bool m_bMoveRect = false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user