|
|
@ -1,5 +1,4 @@
|
|
|
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
|
|
|
// Copyright (C) 2010 Winch Gate Property Limited
|
|
|
|
|
|
|
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
|
|
|
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
@ -34,9 +33,10 @@ namespace LandscapeEditor
|
|
|
|
LandscapeView::LandscapeView(QWidget *parent)
|
|
|
|
LandscapeView::LandscapeView(QWidget *parent)
|
|
|
|
: QGraphicsView(parent),
|
|
|
|
: QGraphicsView(parent),
|
|
|
|
m_visibleGrid(true),
|
|
|
|
m_visibleGrid(true),
|
|
|
|
|
|
|
|
m_visibleText(true),
|
|
|
|
m_moveMouse(false)
|
|
|
|
m_moveMouse(false)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
setDragMode(ScrollHandDrag);
|
|
|
|
//setDragMode(ScrollHandDrag);
|
|
|
|
setTransformationAnchor(AnchorUnderMouse);
|
|
|
|
setTransformationAnchor(AnchorUnderMouse);
|
|
|
|
setBackgroundBrush(QBrush(Qt::lightGray));
|
|
|
|
setBackgroundBrush(QBrush(Qt::lightGray));
|
|
|
|
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
|
|
|
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
|
|
@ -62,6 +62,12 @@ void LandscapeView::setVisibleGrid(bool visible)
|
|
|
|
scene()->update();
|
|
|
|
scene()->update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LandscapeView::setVisibleText(bool visible)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_visibleText = visible;
|
|
|
|
|
|
|
|
scene()->update();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LandscapeView::wheelEvent(QWheelEvent *event)
|
|
|
|
void LandscapeView::wheelEvent(QWheelEvent *event)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
double numDegrees = event->delta() / 8.0;
|
|
|
|
double numDegrees = event->delta() / 8.0;
|
|
|
@ -118,6 +124,9 @@ void LandscapeView::drawForeground(QPainter *painter, const QRectF &rect)
|
|
|
|
painter->setPen(QPen(Qt::white, 0, Qt::SolidLine));
|
|
|
|
painter->setPen(QPen(Qt::white, 0, Qt::SolidLine));
|
|
|
|
drawGrid(painter, rect);
|
|
|
|
drawGrid(painter, rect);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!m_visibleText)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (m_numSteps > -m_maxSteps / 4)
|
|
|
|
if (m_numSteps > -m_maxSteps / 4)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
painter->setPen(QPen(Qt::white, 0.5, Qt::SolidLine));
|
|
|
|
painter->setPen(QPen(Qt::white, 0.5, Qt::SolidLine));
|
|
|
|