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 #include <ArmarXGui/gui-plugins/ScenarioManager/gui/ui_openscenarioview.h>
28 
30  QDialog(parent),
32 {
33  ui->setupUi(this);
34  // ui->treeView->setModel(model.get());
35  ui->treeView->setSortingEnabled(true);
36 
37  ui->treeView->setItemDelegateForColumn(2, &openButtonDelegate);
38  QObject::connect(&openButtonDelegate, SIGNAL(buttonClicked(int, int, QModelIndex)),
39  this, SLOT(openButtonClicked(int, int, QModelIndex)));
40 }
41 
43 {
44  delete ui;
45 }
46 
48 {
49  // TODO: this is not handled well, as the same smart_ptr is send back and forth between the View and Controller
50  this->model = model_ptr;
51  ui->treeView->setModel(model_ptr.get());
52  ui->treeView->setColumnWidth(0, 200);
53  ui->treeView->setColumnWidth(1, 300);
54 }
55 
56 void OpenScenarioView::openButtonClicked(int row, int column, QModelIndex parent)
57 {
58  emit openScenario(row, column, parent);
59  accept();
60 }
61 
62 void OpenScenarioView::on_lineEdit_textEdited(const QString& text)
63 {
64  model->setFilterRegExp(QRegExp(text, Qt::CaseInsensitive, QRegExp::FixedString));
65  ui->treeView->expandAll();
66 }
67 
68 void OpenScenarioView::on_treeView_doubleClicked(const QModelIndex& index)
69 {
70  emit openScenario(index.row(), index.column(), index.parent());
71 }
72 
73 void OpenScenarioView::on_openPackageButton_clicked()
74 {
75  emit showAddPackageDialog();
76 }
index
uint8_t index
Definition: EtherCATFrame.h:59
OpenScenarioView::OpenScenarioView
OpenScenarioView(QWidget *parent=0)
Constructor that sets up the UI and delegates.
Definition: openscenarioview.cpp:29
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:54
FilterableTreeModelSortFilterProxyModelPtr
std::shared_ptr< FilterableTreeModelSortFilterProxyModel > FilterableTreeModelSortFilterProxyModelPtr
Definition: filterabletreemodelsortfilterproxymodel.h:65
FilterableTreeModelSortFilterProxyModel
Model of the FilterableTreeView.
Definition: filterabletreemodelsortfilterproxymodel.h:41
OpenScenarioView::openScenario
void openScenario(int row, int column, QModelIndex parent)
OpenScenarioView::~OpenScenarioView
~OpenScenarioView() override
Definition: openscenarioview.cpp:42
OpenScenarioView::setModel
void setModel(FilterableTreeModelSortFilterProxyModelPtr model)
Sets the model of this view.
Definition: openscenarioview.cpp:47
OpenScenarioView::showAddPackageDialog
void showAddPackageDialog()
armarx::RemoteGui::buttonClicked
bool buttonClicked(RemoteGui::ValueMap const &newValues, RemoteGui::ValueMap const &oldValues, std::string const &name)
Definition: Storage.cpp:6
openscenarioview.h
OpenScenarioView
View that allows to open a previously saved scenario.
Definition: openscenarioview.h:42