Definition of the VPuzzleLayer class

This commit is contained in:
Ronan Le Tiec 2020-04-18 11:54:34 +02:00
parent 213814f09f
commit cefb643d54
4 changed files with 82 additions and 2 deletions

View File

@ -27,7 +27,53 @@
*************************************************************************/ *************************************************************************/
#include "vpuzzlelayer.h" #include "vpuzzlelayer.h"
VPuzzleLayer::VPuzzleLayer() //---------------------------------------------------------------------------------------------------------------------
VPuzzleLayer::VPuzzleLayer() :
m_name(QString("")),
m_pieces(QList<VPuzzlePiece*>()),
m_isVisible(true)
{ {
} }
//---------------------------------------------------------------------------------------------------------------------
VPuzzleLayer::~VPuzzleLayer()
{
}
//---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayer::AddPiece(VPuzzlePiece *piece)
{
m_pieces.append(piece);
}
//---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayer::RemovePiece(VPuzzlePiece *piece)
{
m_pieces.removeAll(piece);
}
//---------------------------------------------------------------------------------------------------------------------
QString VPuzzleLayer::GetName()
{
return m_name;
}
//---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayer::SetName(QString name)
{
m_name = name;
}
//---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayer::SetIsVisible(bool value)
{
m_isVisible = value;
}
//---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayer::GetIsVisible()
{
return m_isVisible;
}

View File

@ -28,11 +28,34 @@
#ifndef VPUZZLELAYER_H #ifndef VPUZZLELAYER_H
#define VPUZZLELAYER_H #define VPUZZLELAYER_H
#include <QList>
#include "vpuzzlepiece.h"
class VPuzzleLayer class VPuzzleLayer
{ {
public: public:
VPuzzleLayer(); VPuzzleLayer();
~VPuzzleLayer();
void AddPiece(VPuzzlePiece *piece);
void RemovePiece(VPuzzlePiece *piece);
// here add some more function if we want to add/move a piece at a
// certain position in the list
QString GetName();
void SetName(QString name);
void SetIsVisible(bool value);
bool GetIsVisible();
private:
QString m_name;
QList<VPuzzlePiece *> m_pieces;
// control
bool m_isVisible;
}; };
#endif // VPUZZLELAYER_H #endif // VPUZZLELAYER_H

View File

@ -27,7 +27,15 @@
*************************************************************************/ *************************************************************************/
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
//---------------------------------------------------------------------------------------------------------------------
VPuzzlePiece::VPuzzlePiece() VPuzzlePiece::VPuzzlePiece()
{ {
} }
//---------------------------------------------------------------------------------------------------------------------
VPuzzlePiece::~VPuzzlePiece()
{
}

View File

@ -28,11 +28,14 @@
#ifndef VPUZZLEPIECE_H #ifndef VPUZZLEPIECE_H
#define VPUZZLEPIECE_H #define VPUZZLEPIECE_H
class VPuzzlePiece class VPuzzlePiece
{ {
public: public:
VPuzzlePiece(); VPuzzlePiece();
~VPuzzlePiece();
private:
}; };
#endif // VPUZZLEPIECE_H #endif // VPUZZLEPIECE_H