display_visibility_property.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef RVIZ_DISPLAY_VISIBILITY_PROPERTY_H_
31 #define RVIZ_DISPLAY_VISIBILITY_PROPERTY_H_
32 
33 #include <stdint.h>
34 
35 #include <map>
36 #include <string>
37 
38 #include <QObject>
39 #include <QString>
40 
41 #include "bool_property.h"
42 
43 namespace rviz
44 {
45 class DisplayContext;
46 class Property;
47 class Display;
48 class BoolProperty;
49 class DisplayVisibilityProperty;
50 
51 
52 /*
53  * @brief Changes one visibility bit of a given Display
54  */
56 {
57  Q_OBJECT
58 public:
59  DisplayVisibilityProperty(uint32_t vis_bit,
60  Display* display,
61  const QString& name = QString(),
62  bool default_value = false,
63  const QString& description = QString(),
64  Property* parent = nullptr);
65 
66  template <typename Func, typename R>
67  DisplayVisibilityProperty(uint32_t vis_bit,
68  Display* display,
69  const QString& name,
70  bool default_value,
71  const QString& description,
72  Property* parent,
73  Func&& changed_slot,
74  const R* receiver)
75  : DisplayVisibilityProperty(vis_bit, display, name, default_value, description, parent)
76  {
77  connect(receiver, std::forward<Func>(changed_slot));
78  }
79 
80  // this variant is required to allow omitting the receiver argument
81  template <typename Func, typename P>
82  DisplayVisibilityProperty(uint32_t vis_bit,
83  Display* display,
84  const QString& name,
85  bool default_value,
86  const QString& description,
87  P* parent,
88  Func&& changed_slot)
89  : DisplayVisibilityProperty(vis_bit, display, name, default_value, description, parent)
90  {
91  connect(parent, std::forward<Func>(changed_slot));
92  }
93 
94  ~DisplayVisibilityProperty() override;
95 
96  virtual void update();
97 
98  bool getBool() const override;
99 
100  Qt::ItemFlags getViewFlags(int column) const override;
101 
102 public Q_SLOTS:
103 
104  bool setValue(const QVariant& new_value) override;
105 
106 protected:
107  uint32_t vis_bit_;
110 };
111 
112 } // namespace rviz
113 
114 #endif /* DISPLAY_VISIBILITY_MANAGER_H_ */
rviz::DisplayVisibilityProperty::setValue
bool setValue(const QVariant &new_value) override
Definition: display_visibility_property.cpp:73
rviz::BoolProperty
Property specialized to provide getter for booleans.
Definition: bool_property.h:38
description
description
rviz::DisplayVisibilityProperty::update
virtual void update()
Definition: display_visibility_property.cpp:56
rviz::DisplayVisibilityProperty::DisplayVisibilityProperty
DisplayVisibilityProperty(uint32_t vis_bit, Display *display, const QString &name=QString(), bool default_value=false, const QString &description=QString(), Property *parent=nullptr)
Definition: display_visibility_property.cpp:40
bool_property.h
rviz::Property::connect
QMetaObject::Connection connect(const QObject *receiver, const char *slot, Qt::ConnectionType type=Qt::AutoConnection)
Connect changed() signal to given slot of receiver.
Definition: property.cpp:78
rviz::DisplayVisibilityProperty::DisplayVisibilityProperty
DisplayVisibilityProperty(uint32_t vis_bit, Display *display, const QString &name, bool default_value, const QString &description, P *parent, Func &&changed_slot)
Definition: display_visibility_property.h:82
rviz::Display
Definition: display.h:63
rviz::Property
A single element of a property tree, with a name, value, description, and possibly children.
Definition: property.h:100
rviz::DisplayVisibilityProperty::~DisplayVisibilityProperty
~DisplayVisibilityProperty() override
Definition: display_visibility_property.cpp:52
rviz
Definition: add_display_dialog.cpp:54
rviz::DisplayVisibilityProperty::DisplayVisibilityProperty
DisplayVisibilityProperty(uint32_t vis_bit, Display *display, const QString &name, bool default_value, const QString &description, Property *parent, Func &&changed_slot, const R *receiver)
Definition: display_visibility_property.h:67
rviz::DisplayVisibilityProperty
Definition: display_visibility_property.h:55
rviz::DisplayVisibilityProperty::custom_name_
bool custom_name_
Definition: display_visibility_property.h:109
rviz::DisplayVisibilityProperty::display_
Display * display_
Definition: display_visibility_property.h:108
default_value
def default_value(type_)
rviz::DisplayVisibilityProperty::getBool
bool getBool() const override
Definition: display_visibility_property.cpp:83
rviz::DisplayVisibilityProperty::getViewFlags
Qt::ItemFlags getViewFlags(int column) const override
Return item flags appropriate for the given column (0 or 1) for this Property.
Definition: display_visibility_property.cpp:92
rviz::DisplayVisibilityProperty::vis_bit_
uint32_t vis_bit_
Definition: display_visibility_property.h:107


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Aug 2 2024 08:43:09