double_list_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Dave Coleman */
36 
37 #ifndef MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_DOUBLE_LIST_WIDGET_
38 #define MOVEIT_MOVEIT_SETUP_ASSISTANT_WIDGETS_DOUBLE_LIST_WIDGET_
39 
40 #include <QWidget>
41 #include <QLabel>
42 #include <QTableWidget>
43 
44 #ifndef Q_MOC_RUN
46 #endif
47 
48 namespace moveit_setup_assistant
49 {
50 class DoubleListWidget : public QWidget
51 {
52  Q_OBJECT
53 
54  // ******************************************************************************************
55  // Reusable double list widget for selecting and deselecting a subset from a set
56  // ******************************************************************************************
57 public:
58  // ******************************************************************************************
59  // Public Functions
60  // ******************************************************************************************
61 
63  DoubleListWidget(QWidget* parent, moveit_setup_assistant::MoveItConfigDataPtr config_data, QString long_name,
64  QString short_name, bool add_ok_cancel = true);
65 
67  void setAvailable(const std::vector<std::string>& items);
68 
70  void setSelected(const std::vector<std::string>& items);
71 
72  void clearContents(void);
73 
75  void setTable(const std::vector<std::string>& items, QTableWidget* table);
76 
78  void setColumnNames(const QString& col1, const QString& col2);
79 
80  // ******************************************************************************************
81  // Qt Components
82  // ******************************************************************************************
83 
84  QTableWidget* data_table_;
85  QTableWidget* selected_data_table_;
86  QLabel* title_; // specify the title from the parent widget
87  QLabel* column1_label_;
88  QLabel* column2_label_;
89 
91  QString long_name_;
92  QString short_name_;
93 
94 private Q_SLOTS:
95 
96  // ******************************************************************************************
97  // Slot Event Functions
98  // ******************************************************************************************
99 
102 
105 
107  void previewSelectedLeft(const QItemSelection& selected, const QItemSelection& deselected);
108  void previewSelectedRight(const QItemSelection& selected, const QItemSelection& deselected);
109 
110 Q_SIGNALS:
111 
112  // ******************************************************************************************
113  // Emitted Signals
114  // ******************************************************************************************
116  void doneEditing();
117 
119  void cancelEditing();
120 
122  void previewSelected(std::vector<std::string>);
123 
125  void selectionUpdated();
126 
127 private:
128  // ******************************************************************************************
129  // Variables
130  // ******************************************************************************************
131 
133  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
134 
135  // ******************************************************************************************
136  // Private Functions
137  // ******************************************************************************************
138 
140  void previewSelected(const QList<QTableWidgetItem*>& selected);
141 };
142 
143 } // namespace moveit_setup_assistant
144 
145 #endif
void setSelected(const std::vector< std::string > &items)
Set the right box.
void deselectDataButtonClicked()
Move selected data left.
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
void setAvailable(const std::vector< std::string > &items)
Loads the availble data list.
void selectDataButtonClicked()
Move selected data right.
void doneEditing()
Event sent when this widget is done making data changes and parent widget can save.
void previewSelected(std::vector< std::string >)
Signal to highlight parts of robot.
void previewSelectedRight(const QItemSelection &selected, const QItemSelection &deselected)
DoubleListWidget(QWidget *parent, moveit_setup_assistant::MoveItConfigDataPtr config_data, QString long_name, QString short_name, bool add_ok_cancel=true)
Constructor.
void cancelEditing()
Event sent when user presses cancel button.
void setTable(const std::vector< std::string > &items, QTableWidget *table)
Convenience function for reusing set table code.
void selectionUpdated()
When the set of selected items has changed.
void setColumnNames(const QString &col1, const QString &col2)
Set the names of the two columns in the widget.
void previewSelectedLeft(const QItemSelection &selected, const QItemSelection &deselected)
Event when data table is clicked.


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sun Oct 18 2020 13:19:28