Getters can be const.

This commit is contained in:
Roman Telezhynskyi 2020-04-23 15:50:20 +03:00
parent a0fb0f8ee3
commit ffe8ffa322
4 changed files with 26 additions and 26 deletions

View File

@ -61,7 +61,7 @@ void VPuzzleLayer::RemovePiece(VPuzzlePiece *piece)
}
//---------------------------------------------------------------------------------------------------------------------
QString VPuzzleLayer::GetName()
QString VPuzzleLayer::GetName() const
{
return m_name;
}
@ -79,7 +79,7 @@ void VPuzzleLayer::SetIsVisible(bool value)
}
//---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayer::GetIsVisible()
bool VPuzzleLayer::GetIsVisible() const
{
return m_isVisible;
}

View File

@ -44,11 +44,11 @@ public:
// here add some more function if we want to add/move a piece at a
// certain position in the list
QString GetName();
QString GetName() const;
void SetName(QString name);
void SetIsVisible(bool value);
bool GetIsVisible();
bool GetIsVisible() const;
private:
QString m_name;

View File

@ -83,7 +83,7 @@ void VPuzzleLayout::SetUnit(Unit unit)
}
//---------------------------------------------------------------------------------------------------------------------
Unit VPuzzleLayout::getUnit()
Unit VPuzzleLayout::getUnit() const
{
return m_unit;
}
@ -118,13 +118,13 @@ void VPuzzleLayout::SetLayoutSizeConverted(QSizeF size)
}
//---------------------------------------------------------------------------------------------------------------------
QSizeF VPuzzleLayout::GetLayoutSize()
QSizeF VPuzzleLayout::GetLayoutSize() const
{
return m_size;
}
//---------------------------------------------------------------------------------------------------------------------
QSizeF VPuzzleLayout::GetLayoutSizeConverted()
QSizeF VPuzzleLayout::GetLayoutSizeConverted() const
{
QSizeF convertedSize = QSizeF(
UnitConvertor(m_size.width(), Unit::Px, m_unit),
@ -164,13 +164,13 @@ void VPuzzleLayout::SetLayoutMarginsConverted(QMarginsF margins)
}
//---------------------------------------------------------------------------------------------------------------------
QMarginsF VPuzzleLayout::GetLayoutMargins()
QMarginsF VPuzzleLayout::GetLayoutMargins() const
{
return m_margins;
}
//---------------------------------------------------------------------------------------------------------------------
QMarginsF VPuzzleLayout::GetLayoutMarginsConverted()
QMarginsF VPuzzleLayout::GetLayoutMarginsConverted() const
{
return UnitConvertor(m_margins, Unit::Px, m_unit);
}
@ -200,13 +200,13 @@ void VPuzzleLayout::SetPiecesGapConverted(qreal value)
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPuzzleLayout::GetPiecesGap()
qreal VPuzzleLayout::GetPiecesGap() const
{
return m_piecesGap;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VPuzzleLayout::GetPiecesGapConverted()
qreal VPuzzleLayout::GetPiecesGapConverted() const
{
return UnitConvertor(m_piecesGap, Unit::Px, m_unit);
}
@ -219,7 +219,7 @@ void VPuzzleLayout::SetWarningSuperpositionOfPieces(bool state)
}
//---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayout::GetWarningSuperpositionOfPieces()
bool VPuzzleLayout::GetWarningSuperpositionOfPieces() const
{
return m_warningSuperpositionOfPieces;
}
@ -231,7 +231,7 @@ void VPuzzleLayout::SetWarningPiecesOutOfBound(bool state)
}
//---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayout::GetWarningPiecesOutOfBound()
bool VPuzzleLayout::GetWarningPiecesOutOfBound() const
{
return m_warningPiecesOutOfBound;
}
@ -243,7 +243,7 @@ void VPuzzleLayout::SetStickyEdges(bool state)
}
//---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayout::GetStickyEdges()
bool VPuzzleLayout::GetStickyEdges() const
{
return m_stickyEdges;
}

View File

@ -51,7 +51,7 @@ public:
QList<VPuzzleLayer *> GetLayers();
void SetUnit(Unit unit);
Unit getUnit();
Unit getUnit() const;
/**
* @brief SetLayoutSize sets the size of the layout, the values have to be in Unit::Px
@ -71,24 +71,24 @@ public:
* @brief SetLayoutSize sets the size of the layout, the values have to be in Unit::Px
* @param size
*/
void SetLayoutSize(QSizeF size);
void SetLayoutSize(const QSizeF &size);
/**
* @brief SetLayoutSizeConverted sets the size of the layout, the values have to be in the layout's unit
* @param size
*/
void SetLayoutSizeConverted(QSizeF size);
void SetLayoutSizeConverted(const QSizeF &size);
/**
* @brief GetLayoutSize Returns the size in Unit::Px
* @return
*/
QSizeF GetLayoutSize();
QSizeF GetLayoutSize() const;
/**
* @brief GetLayoutSizeConverted Returns the size in the layout's unit
* @return
*/
QSizeF GetLayoutSizeConverted();
QSizeF GetLayoutSizeConverted() const;
/**
* @brief SetLayoutMargins, set the margins of the layout, the values have to be in Unit::Px
@ -124,13 +124,13 @@ public:
* @brief GetLayoutMargins Returns the size in Unit::Px
* @return
*/
QMarginsF GetLayoutMargins();
QMarginsF GetLayoutMargins() const;
/**
* @brief GetLayoutMarginsConverted Returns the margins in the layout's unit
* @return
*/
QMarginsF GetLayoutMarginsConverted();
QMarginsF GetLayoutMarginsConverted() const;
void SetFollowGrainline(FollowGrainline state);
FollowGrainline SetFollowGrainline();
@ -151,22 +151,22 @@ public:
* @brief GetPiecesGap returns the pieces gap in Unit::Px
* @return
*/
qreal GetPiecesGap();
qreal GetPiecesGap() const;
/**
* @brief GetPiecesGapConverted returns the pieces gap in the layout's unit
* @return
*/
qreal GetPiecesGapConverted();
qreal GetPiecesGapConverted() const;
void SetWarningSuperpositionOfPieces(bool state);
bool GetWarningSuperpositionOfPieces();
bool GetWarningSuperpositionOfPieces() const;
void SetWarningPiecesOutOfBound(bool state);
bool GetWarningPiecesOutOfBound();
bool GetWarningPiecesOutOfBound() const;
void SetStickyEdges(bool state);
bool GetStickyEdges();
bool GetStickyEdges() const;
private:
Q_DISABLE_COPY(VPuzzleLayout)