VPTissue Reference Manual
QtViewer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
20 #include "viewers/QtViewer.h"
21 
22 #include "gui/MyGraphicsView.h"
23 #include "sim/event/SimEvent.h"
24 
25 using namespace std;
26 using namespace SimPT_Sim;
27 using namespace SimPT_Sim::Event;
28 
29 namespace SimPT_Shell {
30 
31 QtViewer::QtViewer(const std::shared_ptr<SimShell::Ws::MergedPreferences>& p,
32  QWidget* w, std::function<void()> on_close)
33  : SimShell::Gui::ViewerWindow(p, w, on_close),
34  m_preferences(prefs_type::Create(p)),
35  m_canvas(make_shared<QGraphicsScene>()),
36  m_drawer(m_preferences)
37 {
38  setCentralWidget(new SimShell::Gui::MyGraphicsView(m_canvas, this));
39  setWindowTitle("SimPT_Sim: Qt Viewer: " + QString::fromStdString(p->GetPath()));
40 
41  m_canvas->setBackgroundBrush(QBrush(QColor(QString::fromStdString(m_preferences->m_background_color)).rgb()));
42  //string s = std::string("background-color:") + m_preferences->m_background_color + ";";
43  //setStyleSheet(s.c_str());
44 
45  show();
46  raise();
47 }
48 
49 QtViewer::~QtViewer()
50 {
51 }
52 
53 } // namespace
Definition for SimEvent.
STL namespace.
Namespace for SimPT shell package.
Definition: Client.cpp:50
Namespace for the core simulator.
Interface for MyGraphicsView.
see the online Qt documentation
Interface for QtViewer.
Namespace event types raised by the simulator.
Scrollable QGraphicsView with zoom functionality.
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32