-
Notifications
You must be signed in to change notification settings - Fork 0
/
puzzle_item.cpp
35 lines (29 loc) · 919 Bytes
/
puzzle_item.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "puzzle_item.h"
#include <QFont>
PuzzleItem::PuzzleItem(QWidget *widget, QPoint startAbsPos, QPoint _startRelPos, unsigned int sideSize):
QPushButton(widget), startRelPos(_startRelPos), isEmpty(true), number(0)
{
move(startAbsPos);
resize(sideSize, sideSize);
mCurrentRelPos = startRelPos;
}
PuzzleItem::PuzzleItem(QWidget *widget, QPoint startAbsPos, QPoint _startRelPos, unsigned int sideSize, unsigned int _number):
QPushButton(widget), startRelPos(_startRelPos), isEmpty(false), number(_number)
{
move(startAbsPos);
resize(sideSize, sideSize);
mCurrentRelPos = startRelPos;
setText(QString::number(_number));
QFont currentFont = font();
currentFont.setPixelSize(50);
setFont(currentFont);
setStyleSheet("background-color: #FFFCA5;");
}
QPoint PuzzleItem::currentRelPos() const
{
return mCurrentRelPos;
}
void PuzzleItem::setRelPos(QPoint newPosition)
{
mCurrentRelPos = newPosition;
}