HAL
gatelibrary_graphics_view.cpp
Go to the documentation of this file.
3 
4 namespace hal
5 {
7  : QGraphicsView(parent)
8  {;}
9 
11  {
12  float scalef = 1.;
13  int dz = event->angleDelta().y();
14  if (dz > 0)
15  scalef *= 1.1;
16  else if (dz < 0)
17  scalef /= 1.1;
18  else
19  return;
20 
21  scale(scalef, scalef);
22  }
23 
25  {
26  if(g){
28  gg->setLod(1.0);
29  QRectF rect = gg->boundingRect();
30  scene()->clear();
31  scene()->addItem(gg);
32  rect.setTopLeft(rect.topLeft() + QPointF(-50,-50));
33  rect.setBottomRight(rect.bottomRight() + QPointF(50,50));
35  }
36  else
37  {
38  scene()->clear();
39  }
40  }
41 }
Definition: gate.h:58
GatelibraryGraphicsView(QWidget *parent=nullptr)
void wheelEvent(QWheelEvent *event) override
Abstract base class for gates.
Definition: graphics_gate.h:48
static void setLod(const qreal lod)
virtual QRectF boundingRect() const override
GraphicsGate * createGraphicsGate(Gate *g, const int type)
void addItem(QGraphicsItem *item)
void setSceneRect(const QRectF &rect)
void scale(qreal sx, qreal sy)
QGraphicsScene * scene() const const