utils.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
17 * @date 2021
18 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19 * GNU General Public License
20 */
21
22#include "utils.h"
23
24#include <set>
25
26#include <QTableWidget>
27#include <qhashfunctions.h>
28#include <qlist.h>
29
31{
32
33 // <- https://unicode-table.com/de/2190/
34 const QString utils::arrowLeft = QStringLiteral("\u2190");
35 // -> https://unicode-table.com/de/2192/
36 const QString utils::arrowRight = QStringLiteral("\u2192");
37 // <-> https://unicode-table.com/de/21C4/
38 const QString utils::arrowBoth = QStringLiteral("\u21C4");
39
40 QList<QTableWidgetItem*>
41 utils::getSelectedItemsOfColumn(QTableWidget* widget, int column)
42 {
43 std::set<QTableWidgetItem*> set;
44 for (QTableWidgetItem* selected : widget->selectedItems())
45 {
46 if (widget->column(selected) != column)
47 {
48 selected = widget->item(widget->row(selected), 0);
49 }
50 set.insert(selected);
51 }
52
53 QList<QTableWidgetItem*> list;
54 for (auto i : set)
55 {
56 list.append(i);
57 }
58 return list;
59 }
60
61} // namespace armarx::navigation::qt_plugins::location_graph_editor
QList< QTableWidgetItem * > getSelectedItemsOfColumn(QTableWidget *widget, int column)
Definition utils.cpp:41