MEPP2 Project
SimpleCheckBox.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 
13 #include <QCheckBox>
14 #include <functional>
15 
16 #ifndef Q_MOC_RUN // MT : very important to avoid the error : ' Parse error at
17  // "BOOST_JOIN" ' -> (qt4 pb with boost)
19 #endif
20 
21 namespace FEVV {
22 class SimpleCheckBox : public QCheckBox
23 {
24  Q_OBJECT
25 public:
26  std::string myPluginName;
28 
29  bool *myBoolValue = nullptr;
30 
31  SimpleCheckBox(QWidget *parent = 0) : QCheckBox(parent) {}
32 
33  void setParams(bool *_value, std::string _pluginName, BasePlugin *_plugin)
34  {
35  this->myPluginName = _pluginName;
36  this->myPlugin = _plugin;
37  this->myBoolValue = _value;
38  }
39 private slots:
41  {
42  emit modificationSignal(this->myPluginName, this->myPlugin);
43  *myBoolValue = isChecked();
44  }
45  void resetSlot()
46  {
47  // std::cout << "resetSlot SimpleCheckBox: ";
48 
49  Qt::CheckState state =
50  (*myBoolValue) ? Qt::CheckState::Checked : Qt::CheckState::Unchecked;
51  setCheckState(state);
52 
53  // std::cout << *myBoolValue << std::endl;
54  }
55 signals:
56  void modificationSignal(std::string, BasePlugin *);
57 };
58 
59 } // namespace FEVV
FEVV::SimpleCheckBox::myPluginName
std::string myPluginName
Definition: SimpleCheckBox.h:26
FEVV::SimpleCheckBox::myPlugin
BasePlugin * myPlugin
Definition: SimpleCheckBox.h:27
BasePlugin.h
FEVV::SimpleCheckBox::SimpleCheckBox
SimpleCheckBox(QWidget *parent=0)
Definition: SimpleCheckBox.h:31
FEVV::SimpleCheckBox
Definition: SimpleCheckBox.h:23
FEVV::SimpleCheckBox::myBoolValue
bool * myBoolValue
Definition: SimpleCheckBox.h:29
FEVV
Interfaces for plugins These interfaces will be used for different plugins.
Definition: Assert.h:16
FEVV::SimpleCheckBox::modificationSignal
void modificationSignal(std::string, BasePlugin *)
FEVV::SimpleCheckBox::resetSlot
void resetSlot()
Definition: SimpleCheckBox.h:45
FEVV::SimpleCheckBox::modificationSlot
void modificationSlot()
Definition: SimpleCheckBox.h:40
FEVV::SimpleCheckBox::setParams
void setParams(bool *_value, std::string _pluginName, BasePlugin *_plugin)
Definition: SimpleCheckBox.h:33
FEVV::BasePlugin
Definition: BasePlugin.h:38