|
qavrg 0.0.28
|
#include <qavrgmeasurer.h>
Public Slots | |
| void | onAppended (const QPointF &pt) |
| void | onSelected (const QVector< QPointF > &poly) |
Signals | |
| void | printMessage (QString msg) |
Public Member Functions | |
| QavrgMeasurer (int xAxis, int yAxis, QWidget *canvas) | |
| void | connections () |
| QwtText | trackerText (const QPointF &pos) const |
Private Attributes | |
| QPointF | m_StartPoint |
| bool | m_Started |
Definition at line 7 of file qavrgmeasurer.h.
| QavrgMeasurer::QavrgMeasurer | ( | int | xAxis, |
| int | yAxis, | ||
| QWidget * | canvas | ||
| ) |
Definition at line 5 of file qavrgmeasurer.cpp.
References connections().
: QwtPlotPicker(xAxis, yAxis, canvas),
m_StartPoint(),
m_Started(false)
{
connections();
}
| void QavrgMeasurer::connections | ( | ) |
Definition at line 13 of file qavrgmeasurer.cpp.
References onAppended(), and onSelected().
Referenced by QavrgMeasurer().
{
connect(this, SIGNAL(appended(const QPointF&)),
this, SLOT(onAppended(const QPointF&)));
connect(this, SIGNAL(selected(const QVector<QPointF>&)),
this, SLOT(onSelected(const QVector<QPointF>&)));
}
| void QavrgMeasurer::onAppended | ( | const QPointF & | pt | ) | [slot] |
Definition at line 50 of file qavrgmeasurer.cpp.
References m_Started, and m_StartPoint.
Referenced by connections().
{
// printf("appended %g,%g\n", pt.x(), pt.y());
m_StartPoint = pt;
m_Started = true;
}
| void QavrgMeasurer::onSelected | ( | const QVector< QPointF > & | poly | ) | [slot] |
Definition at line 57 of file qavrgmeasurer.cpp.
References m_Started, m_StartPoint, and printMessage().
Referenced by connections().
{
// printf("selected\n");
m_Started = false;
QPointF pos = poly[1];
emit printMessage(tr("Start (%1,%2) End (%3,%4) Delta (%5,%6)")
.arg(m_StartPoint.x())
.arg(m_StartPoint.y())
.arg(pos.x())
.arg(pos.y())
.arg(pos.x()-m_StartPoint.x())
.arg(pos.y()-m_StartPoint.y()));
}
| void QavrgMeasurer::printMessage | ( | QString | msg | ) | [signal] |
Referenced by onSelected().
| QwtText QavrgMeasurer::trackerText | ( | const QPointF & | pos | ) | const |
Definition at line 22 of file qavrgmeasurer.cpp.
References m_Started, and m_StartPoint.
{
QwtText res;
if (m_Started) {
res = QwtText(tr("Start %1,%2\nEnd %3,%4\nDelta %5,%6")
.arg(m_StartPoint.x())
.arg(m_StartPoint.y())
.arg(pos.x())
.arg(pos.y())
.arg(pos.x()-m_StartPoint.x())
.arg(pos.y()-m_StartPoint.y()));
} else {
res = QwtText(tr("%1,%2")
.arg(pos.x())
.arg(pos.y()));
}
res.setColor(Qt::black);
// res.setBackgroundPen(QPen(Qt::white));
res.setBackgroundBrush(QBrush(Qt::white, Qt::SolidPattern));
// QFont font;
// font.setPointSize(7);
// res.setFont(font);
return res;
}
bool QavrgMeasurer::m_Started [private] |
Definition at line 26 of file qavrgmeasurer.h.
Referenced by onAppended(), onSelected(), and trackerText().
QPointF QavrgMeasurer::m_StartPoint [private] |
Definition at line 25 of file qavrgmeasurer.h.
Referenced by onAppended(), onSelected(), and trackerText().
1.7.4