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 #pragma once
38 
39 #include <QWidget>
40 class QLabel;
41 class QTableWidget;
42 class QTableWidgetItem;
43 class QItemSelection;
44 
45 #ifndef Q_MOC_RUN
47 #endif
48 
49 namespace moveit_setup_assistant
50 {
51 class DoubleListWidget : public QWidget
52 {
53  Q_OBJECT
54 
55  // ******************************************************************************************
56  // Reusable double list widget for selecting and deselecting a subset from a set
57  // ******************************************************************************************
58 public:
59  // ******************************************************************************************
60  // Public Functions
61  // ******************************************************************************************
62 
64  DoubleListWidget(QWidget* parent, const MoveItConfigDataPtr& config_data, const QString& long_name,
65  const QString& short_name, bool add_ok_cancel = true);
66 
68  void setAvailable(const std::vector<std::string>& items);
69 
71  void setSelected(const std::vector<std::string>& items);
72 
73  void clearContents();
74 
76  void setTable(const std::vector<std::string>& items, QTableWidget* table);
77 
79  void setColumnNames(const QString& col1, const QString& col2);
80 
81  // ******************************************************************************************
82  // Qt Components
83  // ******************************************************************************************
84 
85  QTableWidget* data_table_;
86  QTableWidget* selected_data_table_;
87  QLabel* title_; // specify the title from the parent widget
88  QLabel* column1_label_;
89  QLabel* column2_label_;
90 
92  QString long_name_;
93  QString short_name_;
94 
95 private Q_SLOTS:
96 
97  // ******************************************************************************************
98  // Slot Event Functions
99  // ******************************************************************************************
100 
103 
106 
108  void previewSelectedLeft(const QItemSelection& selected, const QItemSelection& deselected);
109  void previewSelectedRight(const QItemSelection& selected, const QItemSelection& deselected);
110 
111 Q_SIGNALS:
112 
113  // ******************************************************************************************
114  // Emitted Signals
115  // ******************************************************************************************
117  void doneEditing();
118 
120  void cancelEditing();
121 
123  void previewSelected(std::vector<std::string> /*_t1*/);
124 
126  void selectionUpdated();
127 
128 private:
129  // ******************************************************************************************
130  // Variables
131  // ******************************************************************************************
132 
134  moveit_setup_assistant::MoveItConfigDataPtr config_data_;
135 
136  // ******************************************************************************************
137  // Private Functions
138  // ******************************************************************************************
139 
141  void previewSelected(const QList<QTableWidgetItem*>& selected);
142 };
143 
144 } // namespace moveit_setup_assistant
moveit_setup_assistant::DoubleListWidget::DoubleListWidget
DoubleListWidget(QWidget *parent, const MoveItConfigDataPtr &config_data, const QString &long_name, const QString &short_name, bool add_ok_cancel=true)
Constructor.
Definition: double_list_widget.cpp:87
moveit_setup_assistant::DoubleListWidget::selectDataButtonClicked
void selectDataButtonClicked()
Move selected data right.
Definition: double_list_widget.cpp:276
moveit_setup_assistant::DoubleListWidget::setSelected
void setSelected(const std::vector< std::string > &items)
Set the right box.
Definition: double_list_widget.cpp:216
moveit_setup_assistant::DoubleListWidget::data_table_
QTableWidget * data_table_
Definition: double_list_widget.h:85
moveit_setup_assistant::DoubleListWidget
Definition: double_list_widget.h:51
moveit_setup_assistant::DoubleListWidget::selected_data_table_
QTableWidget * selected_data_table_
Definition: double_list_widget.h:86
moveit_setup_assistant::DoubleListWidget::previewSelectedLeft
void previewSelectedLeft(const QItemSelection &selected, const QItemSelection &deselected)
Event when data table is clicked.
Definition: double_list_widget.cpp:334
moveit_setup_assistant::DoubleListWidget::cancelEditing
void cancelEditing()
Event sent when user presses cancel button.
moveit_setup_assistant::DoubleListWidget::column2_label_
QLabel * column2_label_
Definition: double_list_widget.h:89
moveit_config_data.h
moveit_setup_assistant::DoubleListWidget::selectionUpdated
void selectionUpdated()
When the set of selected items has changed.
moveit_setup_assistant::DoubleListWidget::config_data_
moveit_setup_assistant::MoveItConfigDataPtr config_data_
Contains all the configuration data for the setup assistant.
Definition: double_list_widget.h:134
moveit_setup_assistant::DoubleListWidget::setColumnNames
void setColumnNames(const QString &col1, const QString &col2)
Set the names of the two columns in the widget.
Definition: double_list_widget.cpp:227
moveit_setup_assistant::DoubleListWidget::setAvailable
void setAvailable(const std::vector< std::string > &items)
Loads the availble data list.
Definition: double_list_widget.cpp:204
moveit_setup_assistant
Definition: compute_default_collisions.h:46
moveit_setup_assistant::DoubleListWidget::previewSelected
void previewSelected(std::vector< std::string >)
Signal to highlight parts of robot.
moveit_setup_assistant::DoubleListWidget::long_name_
QString long_name_
Name of datatype.
Definition: double_list_widget.h:92
moveit_setup_assistant::DoubleListWidget::short_name_
QString short_name_
Definition: double_list_widget.h:93
moveit_setup_assistant::DoubleListWidget::setTable
void setTable(const std::vector< std::string > &items, QTableWidget *table)
Convenience function for reusing set table code.
Definition: double_list_widget.cpp:236
moveit_setup_assistant::DoubleListWidget::doneEditing
void doneEditing()
Event sent when this widget is done making data changes and parent widget can save.
moveit_setup_assistant::DoubleListWidget::clearContents
void clearContents()
Definition: double_list_widget.cpp:221
moveit_setup_assistant::DoubleListWidget::previewSelectedRight
void previewSelectedRight(const QItemSelection &selected, const QItemSelection &deselected)
Definition: double_list_widget.cpp:343
moveit_setup_assistant::DoubleListWidget::title_
QLabel * title_
Definition: double_list_widget.h:87
moveit_setup_assistant::DoubleListWidget::deselectDataButtonClicked
void deselectDataButtonClicked()
Move selected data left.
Definition: double_list_widget.cpp:317
moveit_setup_assistant::DoubleListWidget::column1_label_
QLabel * column1_label_
Definition: double_list_widget.h:88


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sat May 3 2025 02:28:04