RvizFileProperty.cpp
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Robot Operating System code by the University of Osnabrück
5  * Copyright (c) 2021, University of Osnabrück
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above
13  * copyright notice, this list of conditions and the following
14  * disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  *
21  * 3. Neither the name of the copyright holder nor the names of its
22  * contributors may be used to endorse or promote products derived
23  * from this software without specific prior written permission.
24  *
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
30  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
33  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  *
38  *
39  *
40  * RvizFileProperty.cpp
41  *
42  *
43  * authors:
44  *
45  * Malte kleine Piening <malte@klpiening.de>
46  */
47 
48 #include "RvizFileProperty.hpp"
49 
50 #include <QFileDialog>
51 
52 namespace rviz
53 {
54 FileProperty::FileProperty(const QString& name, const QString& default_value, const QString& description,
55  Property* parent, const char* changed_slot, QObject* receiver)
56  : Property(name, default_value, description, parent, changed_slot, receiver)
57 {
58 }
59 
60 QWidget* FileProperty::createEditor(QWidget* parent, const QStyleOptionViewItem&)
61 {
62  QFileDialog* editor = new QFileDialog(nullptr);
63 
64  QStringList filenameFilters;
65  filenameFilters << tr("*.h5");
66  #if defined(WITH_ASSIMP)
67  filenameFilters << tr("*.ply");
68  filenameFilters << tr("*.obj");
69  filenameFilters << tr("*.dae");
70  filenameFilters << tr("*.stl");
71  filenameFilters << tr("*.3d");
72  filenameFilters << tr("*.3ds");
73  filenameFilters << tr("*.fbx");
74  filenameFilters << tr("*.blend");
75  #endif
76  filenameFilters << tr("*");
77  editor->setNameFilters(filenameFilters);
78 
79  editor->setViewMode(QFileDialog::Detail);
80 
81  if (editor->exec())
82  {
83  QStringList fileNames = editor->selectedFiles();
84  if (fileNames.size() == 0)
85  {
86  setStdFilename("");
87  }
88  else
89  {
90  setFilename(fileNames.at(0));
91  }
92  }
93 
94  return nullptr;
95 }
96 
97 } // namespace rviz
rviz::FileProperty::FileProperty
FileProperty(const QString &name=QString(), const QString &default_value=QString(), const QString &description=QString(), Property *parent=nullptr, const char *changed_slot=nullptr, QObject *receiver=nullptr)
Definition: RvizFileProperty.cpp:54
description
description
rviz::Property
rviz
rviz::FileProperty::setStdFilename
bool setStdFilename(const std::string &std_str)
Definition: RvizFileProperty.hpp:76
RvizFileProperty.hpp
rviz::FileProperty::createEditor
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &)
Definition: RvizFileProperty.cpp:60
default_value
def default_value(type_)
rviz::FileProperty::setFilename
bool setFilename(const QString &str)
Definition: RvizFileProperty.hpp:72
tr
__kf_device__ Vec3f tr(const float4 &v)


rviz_map_plugin
Author(s): Sebastian Pütz , Kristin Schmidt , Jan Philipp Vogtherr , Malte kleine Piening
autogenerated on Sun Jan 21 2024 04:06:25