-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathQTileSelector.h
More file actions
72 lines (59 loc) · 1.45 KB
/
QTileSelector.h
File metadata and controls
72 lines (59 loc) · 1.45 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef QTILESELECTOR_H
#define QTILESELECTOR_H
#include <QWidget>
#include <QMap>
#include <QSet>
class QDKEdit;
typedef QColor QGBPalette[4];
typedef QMap<QString, QVector<int> > QTileGroups;
struct QSpacings
{
int top;
int bottom;
int left;
int right;
int vSpace;
int hSpace;
int beforeText;
int afterText;
};
class QTileSelector : public QWidget
{
Q_OBJECT
public:
explicit QTileSelector(QWidget *parent = 0);
void getMouse(bool enable);
private:
QSize tileSize;
QSize orgTileSize;
QSize imageDimension;
QSize arrangedTilesDimension;
QPixmap tiles;
QImage arrangedTiles;
QRect selectedTile;
QRect mouseOverTile;
QRect allTilesRect;
QStringList tileNames;
int tileCount;
int selectedTileNumber;
void updateImage();
float scaleFactor;
QTileGroups groups;
QSpacings space;
QMap<int, QRect> tileRects;
QDKEdit *pixSrc;
protected:
void paintEvent(QPaintEvent *);
void mouseMoveEvent(QMouseEvent *e);
void mousePressEvent(QMouseEvent *e);
void resizeEvent(QResizeEvent *e);
bool event(QEvent *e);
signals:
void tileSelected(int tileNumber);
public slots:
void setTilePixmap(QPixmap tilePixmap, QSize size, float scale, int count, QStringList names);
void changeTilePixmap(QPixmap tilePixmap);
void groupTiles(QTileGroups grouping, QSpacings spacings);
void setTilePixSrc(QDKEdit *src);
};
#endif // QTILESELECTOR_H