SceneOverview.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * 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 this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #include "SceneOverview.h"
25 
27 
28 namespace armarx
29 {
30 
31  SceneOverview::SceneOverview(QWidget* parent) :
32  QGraphicsView(parent),
33  graphicsViewZoomer(NULL)
34 
35  {
36 
37  }
38 
40  {
41  disconnect(this);
42  graphicsViewZoomer = zoomer;
43  connect(graphicsViewZoomer, SIGNAL(moved()), this, SLOT(retrieveUpdate()));
44  connect(graphicsViewZoomer, SIGNAL(zoomed()), this, SLOT(retrieveUpdate()));
45  }
46 
48  {
49  if (!graphicsViewZoomer || !graphicsViewZoomer->getView())
50  {
51  return;
52  }
53 
54  selectionRect = graphicsViewZoomer->getView()->mapToScene(graphicsViewZoomer->getView()->rect()).boundingRect();
55 
56  if (scene())
57  {
58  fitInView(scene()->itemsBoundingRect().adjusted(-30, -30, 30, 30), Qt::KeepAspectRatio);
59  }
60 
61  // ARMARX_INFO_S << "overview update: " << selectionRect;
62  update();
63  }
64 
65 }
66 
67 
68 
69 
70 void armarx::SceneOverview::drawForeground(QPainter* painter, const QRectF& rect)
71 {
72  QPen pen(QBrush(Qt::red), 5);
73  painter->setPen(pen);
74  painter->drawRect(selectionRect);
75  QGraphicsView::drawForeground(painter, rect);
76  // ARMARX_INFO_S << "drawing foreground";
77 }
78 
79 
81 {
82  retrieveUpdate();
83 }
armarx::SceneOverview::SceneOverview
SceneOverview(QWidget *parent=0)
Definition: SceneOverview.cpp:31
armarx::SceneOverview::resizeEvent
void resizeEvent(QResizeEvent *) override
Definition: SceneOverview.cpp:80
armarx::SceneOverview::drawForeground
void drawForeground(QPainter *painter, const QRectF &rect) override
Definition: SceneOverview.cpp:70
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
armarx::red
QColor red()
Definition: StyleSheets.h:76
armarx::Graphics_view_zoom
Definition: GraphicsViewZoom.h:64
SceneOverview.h
armarx::Graphics_view_zoom::getView
QGraphicsView * getView() const
Definition: GraphicsViewZoom.cpp:73
ArmarXWidgetController.h
armarx::SceneOverview::setZoomer
void setZoomer(Graphics_view_zoom *zoomer)
Definition: SceneOverview.cpp:39
armarx::SceneOverview::retrieveUpdate
void retrieveUpdate()
Definition: SceneOverview.cpp:47
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28