major api and quality of life changes
This commit is contained in:
parent
4148d42bfb
commit
67e63561c4
7 changed files with 113 additions and 24 deletions
|
|
@ -1,12 +1,7 @@
|
|||
#include "gridpreview.h"
|
||||
|
||||
GridPreview::GridPreview(QWidget *parent)
|
||||
: QWidget{parent}
|
||||
{
|
||||
colorMap.insert(QString("red"), Qt::red);
|
||||
colorMap.insert(QString("green"), Qt::green);
|
||||
colorMap.insert(QString("blue"), Qt::blue);
|
||||
}
|
||||
: QWidget{parent} {}
|
||||
|
||||
void GridPreview::setSize(int newWidth, int newHeight)
|
||||
{
|
||||
|
|
@ -30,27 +25,32 @@ void GridPreview::removeLine(int index)
|
|||
emit updatedContents();
|
||||
}
|
||||
|
||||
void GridPreview::setLineColor(int index, QString color)
|
||||
void GridPreview::setLineColor(int index, const QString &color)
|
||||
{
|
||||
lines[index].setColor(color);
|
||||
|
||||
emit updatedContents();
|
||||
}
|
||||
|
||||
void GridPreview::setLineStartPoint(int index, QPoint point)
|
||||
void GridPreview::setLineStartPoint(int index, const QPoint &point)
|
||||
{
|
||||
lines[index].setStartPoint(point);
|
||||
|
||||
emit updatedContents();
|
||||
}
|
||||
|
||||
void GridPreview::setLineEndPoint(int index, QPoint point)
|
||||
void GridPreview::setLineEndPoint(int index, const QPoint &point)
|
||||
{
|
||||
lines[index].setEndPoint(point);
|
||||
|
||||
emit updatedContents();
|
||||
}
|
||||
|
||||
void GridPreview::setColorMap(QMap<QString, QColor> &map)
|
||||
{
|
||||
colorMap = map;
|
||||
}
|
||||
|
||||
int GridPreview::getWidth()
|
||||
{
|
||||
return width;
|
||||
|
|
@ -61,12 +61,22 @@ int GridPreview::getHeight()
|
|||
return height;
|
||||
}
|
||||
|
||||
const Line &GridPreview::getLine(int index)
|
||||
const QList<Line> &GridPreview::getLines() const
|
||||
{
|
||||
return lines;
|
||||
}
|
||||
|
||||
const Line &GridPreview::getLine(int index) const
|
||||
{
|
||||
return lines.at(index);
|
||||
}
|
||||
|
||||
const PointProbe &GridPreview::getCapturedProbe()
|
||||
const PointProbe &GridPreview::getCapturedProbe() const
|
||||
{
|
||||
return capturedProbe;
|
||||
}
|
||||
|
||||
PointProbe &GridPreview::getCapturedProbe()
|
||||
{
|
||||
return capturedProbe;
|
||||
}
|
||||
|
|
@ -199,11 +209,15 @@ void GridPreview::mousePressEvent(QMouseEvent *event)
|
|||
|
||||
capturedProbe.ownerIndex = lines.size() - 1;
|
||||
}
|
||||
|
||||
emit updatedContents();
|
||||
}
|
||||
|
||||
void GridPreview::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
mouseCaptured = false;
|
||||
QPoint gridPos = localMousePosition(event);
|
||||
PointProbe probe = probePoint(gridPos);
|
||||
}
|
||||
|
||||
const QPoint GridPreview::localMousePosition(QMouseEvent *event)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue