openscenarioview.cpp
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5 *
6 * ArmarX is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ArmarX is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 * @package ArmarXCore::core
19 * @author Cedric Seehausen (usdnr at kit dot edu)
20 * @date 2016
21 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22 * GNU General Public License
23 */
24
25
26#include "openscenarioview.h"
27
28#include <ArmarXGui/gui-plugins/ScenarioManager/gui/ui_openscenarioview.h>
29
31 QDialog(parent),
32 ui(new Ui::OpenScenarioView),
34{
35 ui->setupUi(this);
36 // ui->treeView->setModel(model.get());
37 ui->treeView->setSortingEnabled(true);
38
39 ui->treeView->setItemDelegateForColumn(2, &openButtonDelegate);
40 QObject::connect(&openButtonDelegate,
41 SIGNAL(buttonClicked(int, int, QModelIndex)),
42 this,
43 SLOT(openButtonClicked(int, int, QModelIndex)));
44}
45
50
51void
53{
54 // TODO: this is not handled well, as the same smart_ptr is send back and forth between the View and Controller
55 this->model = model_ptr;
56 ui->treeView->setModel(model_ptr.get());
57 ui->treeView->setColumnWidth(0, 200);
58 ui->treeView->setColumnWidth(1, 300);
59}
60
61void
62OpenScenarioView::openButtonClicked(int row, int column, QModelIndex parent)
63{
64 emit openScenario(row, column, parent);
65 accept();
66}
67
68void
69OpenScenarioView::on_lineEdit_textEdited(const QString& text)
70{
71 model->setFilterRegExp(QRegExp(text, Qt::CaseInsensitive, QRegExp::FixedString));
72 ui->treeView->expandAll();
73}
74
75void
76OpenScenarioView::on_treeView_doubleClicked(const QModelIndex& index)
77{
78 emit openScenario(index.row(), index.column(), index.parent());
79}
80
81void
82OpenScenarioView::on_openPackageButton_clicked()
83{
85}
uint8_t index
void openScenario(int row, int column, QModelIndex parent)
OpenScenarioView(QWidget *parent=0)
Constructor that sets up the UI and delegates.
void showAddPackageDialog()
~OpenScenarioView() override
void setModel(FilterableTreeModelSortFilterProxyModelPtr model)
Sets the model of this view.
std::shared_ptr< FilterableTreeModelSortFilterProxyModel > FilterableTreeModelSortFilterProxyModelPtr
ArmarX Headers.