Exemple #1
0
GameView::GameView(QGraphicsScene *scene, QWidget *parent)
	: QGraphicsView(scene, parent), rubberBand(0)
{
	setBackgroundBrush(QBrush(QColor(0, 0, 0)));
	setRenderHints(QPainter::TextAntialiasing | QPainter::Antialiasing/* | QPainter::SmoothPixmapTransform*/);
	setFocusPolicy(Qt::NoFocus);
	setViewportUpdateMode(BoundingRectViewportUpdate);

	connect(scene, SIGNAL(sceneRectChanged(const QRectF &)), this, SLOT(updateSceneRect(const QRectF &)));
	
	connect(scene, SIGNAL(sigStartRubberBand(const QPointF &)), this, SLOT(startRubberBand(const QPointF &)));
	connect(scene, SIGNAL(sigResizeRubberBand(const QPointF &)), this, SLOT(resizeRubberBand(const QPointF &)));
	connect(scene, SIGNAL(sigStopRubberBand()), this, SLOT(stopRubberBand()));

	aCloseMostRecentZoneView = new QAction(this);
	aCloseMostRecentZoneView->setShortcut(tr("Esc"));
	connect(aCloseMostRecentZoneView, SIGNAL(triggered()), scene, SLOT(closeMostRecentZoneView()));
	addAction(aCloseMostRecentZoneView);

	rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
}
Exemple #2
0
void GameScene::stopRubberBand()
{
    emit sigStopRubberBand();
}