8 #include <ff7tkqtwidgets_export.h>
22 inline const QPixmap &
pixmap()
const {
25 void setPixmap(
const QPixmap &pixmap);
26 void setPixmap(
const QPoint &point,
const QPixmap &pixmap);
30 void setPixmapPoint(
const QPoint &point);
34 void setCellSize(
int size);
36 return _groupedCellSize;
38 void setGroupedCellSize(
int size);
39 void setCustomLines(
const QList<QLine> &lines);
41 return _gridSize.isValid() ? _gridSize : (_cellSize == 0 ? QSize() : _pixmap.size() / _cellSize);
44 return _gridSize.isValid() ? _gridSize * _cellSize : _pixmap.size();
46 void setGridSize(
const QSize &gridSize);
47 QPixmap cellPixmap(
const Cell &cell)
const;
49 return _selectedCells;
52 return _selectionMode;
54 void setSelectionMode(SelectionMode mode);
56 void currentSelectionChanged(
const QList<Cell> &cells);
57 void highlighted(
const Cell &cell);
58 void clicked(
const Cell &cell);
61 setSelectedCells(QList<Cell>() << cell);
63 void setSelectedCells(
const QList<Cell> &cells);
65 virtual void paintEvent(QPaintEvent *event)
override;
66 virtual void mouseMoveEvent(QMouseEvent *event)
override;
67 virtual void leaveEvent(QEvent *event)
override;
68 virtual void mousePressEvent(QMouseEvent *event)
override;
69 virtual void mouseReleaseEvent(QMouseEvent *event)
override;
70 virtual void keyPressEvent(QKeyEvent *event)
override;
71 virtual void resizeEvent(QResizeEvent *event)
override;
72 virtual QSize minimumSizeHint()
const override;
73 virtual QSize sizeHint()
const override;
75 QList<QLine> createGrid(
const QSize &gridS,
int cellSize);
76 void drawSelection(QPainter &painter, QPoint selection);
77 inline QPoint scaledPoint(
const Cell &cell)
const {
78 return _scaledRatio * cell;
80 Cell getCell(
const QPoint &pos)
const;
81 bool cellIsInRange(
const Cell &cell)
const;
86 QList<QLine> _gridLines, _groupedGridLines, _customLines;
87 Cell _hoverCell, _startMousePress;
88 QList<Cell> _selectedCells;
89 QPoint _pixmapPoint, _scaledPixmapPoint, _scaledGridPoint;
90 QSize _scaledPixmapSize;
93 SelectionMode _selectionMode;
94 int _cellSize, _groupedCellSize;