Skip to content

Commit

Permalink
VectorGraphView_fixing_casting
Browse files Browse the repository at this point in the history
  • Loading branch information
szeli1 committed Aug 1, 2024
1 parent bea39c3 commit 823baca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions include/VectorGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected slots:
void processControlWindowPressed(int mouseX, int mouseY, bool isDragging, bool startMoving);
// returns -1 if no control / input was clicked
// returns displayed absolute control / input location based on inputCount
int getPressedControlInput(int mouseX, int mouseY, unsigned int controlCount);
int getPressedControlInput(int mouseX, int mouseY, size_t controlCount);
// returns a float attrib value
float getInputAttribValue(unsigned int controlArrayLocation);
// sets the selected point's attrib (controlArrayLocation) to floatValue
Expand Down Expand Up @@ -208,8 +208,8 @@ protected slots:

unsigned int m_graphHeight;
unsigned int m_controlHeight;
// displayed control count (+1 because of the ">>" button in editing mode)
unsigned int m_controlDisplayCount;
// displayed control count
size_t m_controlDisplayCount;
bool m_isEditingActive;
const std::array<QString, 2> m_controlText =
{
Expand Down
16 changes: 8 additions & 8 deletions src/gui/widgets/VectorGraphView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ void VectorGraphView::paintEditing(QPainter* p)
foreColor = *dataArray->getFillColor();
}

int controlTextCount = m_controlText.size();
size_t controlTextCount = m_controlText.size();

int segmentLength = width() / (m_controlDisplayCount);
// draw inputs
Expand All @@ -730,7 +730,7 @@ void VectorGraphView::paintEditing(QPainter* p)
// draw outline
p->setPen(QPen(*dataArray->getLineColor(), 1));
p->drawLine(0, m_graphHeight, width(), m_graphHeight);
for (unsigned int i = 1; i < m_controlDisplayCount; i++)
for (size_t i = 1; i < m_controlDisplayCount; i++)
{
if (i < controlTextCount || i >= m_controlDisplayCount)
{
Expand Down Expand Up @@ -941,14 +941,14 @@ void VectorGraphView::processControlWindowPressed(int mouseX, int mouseY, bool i
}
}
}
int VectorGraphView::getPressedControlInput(int mouseX, int mouseY, unsigned int controlCount)
int VectorGraphView::getPressedControlInput(int mouseX, int mouseY, size_t controlCount)
{
int output = -1;
if (m_isEditingActive == true && mouseY > m_graphHeight)
if (m_isEditingActive == true && mouseY > static_cast<int>(m_graphHeight))
{
output = mouseX * controlCount / width();
}
if (output > controlCount)
if (output > static_cast<int>(controlCount))
{
output = controlCount;
}
Expand Down Expand Up @@ -1217,7 +1217,7 @@ int VectorGraphView::searchForData(int mouseX, int mouseY, float maxDistance, Ve
{
curvedBefore = 1;
}
if (location - curvedBefore < dataArray->size() - 1)
if (location - curvedBefore < static_cast<int>(dataArray->size()) - 1)
{
PointF curvedDataCoords = mapDataCurvePosF(
dataArray->getX(location - curvedBefore), dataArray->getY(location - curvedBefore),
Expand Down Expand Up @@ -1257,7 +1257,7 @@ int VectorGraphView::searchForData(int mouseX, int mouseY, float maxDistance, Ve
}
}
// getting where the search needs to end
for (int i = location - curvedBefore + 1; i < dataArray->size(); i++)
for (int i = location - curvedBefore + 1; i < static_cast<int>(dataArray->size()); i++)
{
if (std::abs(dataArray->getX(i) - transformedMouse.first) > maxDistance)
{
Expand All @@ -1274,7 +1274,7 @@ int VectorGraphView::searchForData(int mouseX, int mouseY, float maxDistance, Ve
dataY = dataArray->getY(i);
if (isCurved == true && dataArray->size() > 1)
{
if (dataArray->size() - 1 > i)
if (static_cast<int>(dataArray->size()) - 1 > i)
{
PointF curvedDataCoords = mapDataCurvePosF(
dataArray->getX(i), dataArray->getY(i), dataArray->getX(i + 1), dataArray->getY(i + 1),
Expand Down

0 comments on commit 823baca

Please sign in to comment.