Cute Chess
0.1
Main Page
Namespaces
Classes
Files
File List
projects
gui
src
boardview
boardview.h
1
/*
2
This file is part of Cute Chess.
3
Copyright (C) 2008-2018 Cute Chess authors
4
5
Cute Chess is free software: you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9
10
Cute Chess is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef BOARDVIEW_H
20
#define BOARDVIEW_H
21
22
#include <QGraphicsView>
23
#include <QPixmap>
24
class
QTimer;
25
33
class
BoardView
:
public
QGraphicsView
34
{
35
Q_OBJECT
36
37
public
:
39
explicit
BoardView
(
QGraphicsScene
* scene,
QWidget
* parent =
nullptr
);
40
41
// Inherited from QGraphicsView
42
virtual
QSize sizeHint()
const
;
43
virtual
int
heightForWidth(
int
width)
const
;
44
45
protected
:
46
// Inherited from QGraphicsView
47
virtual
void
resizeEvent(
QResizeEvent
* event);
48
virtual
void
paintEvent(
QPaintEvent
* event);
49
50
private
slots:
51
void
fitToRect();
52
void
onSceneRectChanged();
53
54
private
:
55
bool
m_initialized;
56
QTimer* m_resizeTimer;
57
QPixmap
m_resizePixmap;
58
};
59
60
#endif // BOARDVIEW_H
QResizeEvent
QWidget
QGraphicsScene
BoardView::BoardView
BoardView(QGraphicsScene *scene, QWidget *parent=nullptr)
Definition:
boardview.cpp:25
QPixmap
BoardView
A view widget for displaying a QGraphicsScene.
Definition:
boardview.h:33
QPaintEvent
QGraphicsView
Generated by
1.8.11