mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 09:43:24 +00:00
Better handling of the scene size for the dive Plan
Better handling of the scene size for the dive plan, The scene can be resized and a transform will be applied, the handles will not resize however - they are 10x10px and that's it. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
ab6aea73c1
commit
364254ed36
2 changed files with 17 additions and 1 deletions
|
@ -16,7 +16,8 @@ DivePlanner::DivePlanner(QWidget* parent): QGraphicsView(parent)
|
||||||
|
|
||||||
void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event)
|
void DivePlanner::mouseDoubleClickEvent(QMouseEvent* event)
|
||||||
{
|
{
|
||||||
QGraphicsEllipseItem *item = new QGraphicsEllipseItem(-10,-10,20,20);
|
QGraphicsEllipseItem *item = new QGraphicsEllipseItem(-5,-5,10,10);
|
||||||
|
item->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
QPointF mappedPos = mapToScene(event->pos());
|
QPointF mappedPos = mapToScene(event->pos());
|
||||||
|
|
||||||
item->setPos( mappedPos );
|
item->setPos( mappedPos );
|
||||||
|
@ -52,3 +53,15 @@ void DivePlanner::create_deco_stop()
|
||||||
lines << item;
|
lines << item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivePlanner::resizeEvent(QResizeEvent* event)
|
||||||
|
{
|
||||||
|
QGraphicsView::resizeEvent(event);
|
||||||
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DivePlanner::showEvent(QShowEvent* event)
|
||||||
|
{
|
||||||
|
QGraphicsView::showEvent(event);
|
||||||
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@ public:
|
||||||
static DivePlanner *instance();
|
static DivePlanner *instance();
|
||||||
protected:
|
protected:
|
||||||
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
||||||
|
virtual void showEvent(QShowEvent* event);
|
||||||
|
virtual void resizeEvent(QResizeEvent* event);
|
||||||
|
|
||||||
void clear_generated_deco();
|
void clear_generated_deco();
|
||||||
void create_deco_stop();
|
void create_deco_stop();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue