MEPP2 Project
BaseAdapterVisuQt.h
Go to the documentation of this file.
1 // Copyright (c) 2012-2019 University of Lyon and CNRS (France).
2 // All rights reserved.
3 //
4 // This file is part of MEPP2; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published
6 // by the Free Software Foundation; either version 3 of the License,
7 // or (at your option) any later version.
8 //
9 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
10 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11 #pragma once
12 
15 
16 #include <QWidget>
17 #include <QGridLayout>
18 
19 namespace FEVV {
20 
21 class BaseAdapterVisuQt : public QWidget, public BaseAdapterVisu
22 {
23 public:
25 
28 
29 public:
40  BaseAdapterVisuQt(QWidget *_parent = 0, Qt::WindowFlags _f = Qt::Widget)
41  : QWidget(_parent, _f), BaseAdapterVisu()
42  {
43 #ifdef DEBUG_VISU2
44  std::cout << "*** this=" << this << " entering " << __func__ << std::endl;
45 #endif
46 
47  layout = new QGridLayout(this);
48  layout->setObjectName(QString::fromUtf8("WidgetLayout"));
49 
50 #ifdef DEBUG_VISU2
51  std::cout << "*** this=" << this << " leaving " << __func__ << std::endl;
52 #endif
53  }
54 
56  {
57 #ifdef DEBUG_VISU2
58  std::cout << "*** this=" << this << " entering " << __func__ << std::endl;
59 #endif
60 
61  delete layout;
62 
63 #ifdef DEBUG_VISU2
64  std::cout << "*** this=" << this << " leaving " << __func__ << std::endl;
65 #endif
66  }
67 
68  void attach(Viewer *_viewer) override
69  {
70  ViewerOSG *viewer = dynamic_cast< ViewerOSG * >(_viewer);
71 
72  if(viewer)
73  {
74  attach(viewer);
75  }
76  else
77  {
78 
79  Assert::check(false,
80  "is not implemented. See attach(ViewerOSG) instead",
81  "BaseAdapterVisuQt::attach(Viewer)");
82  }
83  }
84 
85  virtual void attach(ViewerOSG *_viewer)
86  {
87  Assert::check(_viewer != nullptr,
88  "The given viewer is null",
89  "BaseAdapterVisuQt::attach(ViewerOSG)");
90  myViewer = _viewer;
91  _viewer->attach(this);
92  }
93 
94 protected:
95  QGridLayout *layout;
96 };
97 
98 } // namespace FEVV
FEVV::BaseAdapterVisu::setSelected
virtual void setSelected(const bool _isSelected)
Definition: BaseAdapterVisu.h:106
BaseViewerOSG.h
FEVV::BaseViewer
Definition: BaseViewer.h:43
FEVV::BaseViewerOSG
Definition: BaseViewerOSG.h:47
FEVV::BaseAdapterVisu
Definition: BaseAdapterVisu.h:27
FEVV::BaseViewer::attach
void attach(Window *_window)
Definition: BaseViewer.h:131
FEVV::BaseAdapterVisuQt::attach
virtual void attach(ViewerOSG *_viewer)
Definition: BaseAdapterVisuQt.h:85
FEVV::BaseAdapterVisuQt::layout
QGridLayout * layout
Definition: BaseAdapterVisuQt.h:95
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::BaseAdapterVisuQt::~BaseAdapterVisuQt
virtual ~BaseAdapterVisuQt()
Definition: BaseAdapterVisuQt.h:55
BaseAdapterVisu.h
FEVV::BaseAdapterVisuQt::attach
void attach(Viewer *_viewer) override
Definition: BaseAdapterVisuQt.h:68
FEVV::Assert::check
static bool check(const bool _check, const std::string &_message, const std::string &_where="")
Definition: Assert.h:70
FEVV::BaseAdapterVisuQt
Definition: BaseAdapterVisuQt.h:22
FEVV::BaseAdapterVisu::myViewer
Viewer * myViewer
Definition: BaseAdapterVisu.h:173
FEVV::BaseAdapterVisu::isSelected
virtual bool isSelected() const
Definition: BaseAdapterVisu.h:91
FEVV::BaseAdapterVisuQt::BaseAdapterVisuQt
BaseAdapterVisuQt(QWidget *_parent=0, Qt::WindowFlags _f=Qt::Widget)
Definition: BaseAdapterVisuQt.h:40