Vespucci  1.0.0
matrixselectiondialog.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  Copyright (C) 2014-2016 Wright State University - All Rights Reserved
3  Daniel P. Foose - Maintainer/Lead Developer
4 
5  This file is part of Vespucci.
6 
7  Vespucci is free software: you can redistribute it and/or modify
8  it under the terms of the GNU General Public License as published by
9  the Free Software Foundation, either version 3 of the License, or
10  (at your option) any later version.
11 
12  Vespucci is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with Vespucci. If not, see <http://www.gnu.org/licenses/>.
19 *******************************************************************************/
20 #include "matrixselectiondialog.h"
21 #include "ui_matrixselectiondialog.h"
22 
24  QDialog(parent),
25  ui(new Ui::MatrixSelectionDialog)
26 {
27  ui->setupUi(this);
28  tree_model_ = model;
29  accepted_ = false;
30  ui->treeView->setModel(tree_model_);
31 }
32 
34 {
35  delete ui;
36 }
37 
39 {
40  tree_model_ = model;
41 }
42 
44 {
45  return selected_item_;
46 }
47 
49 {
50  return data_keys_;
51 }
52 
54 {
55  return accepted_;
56 }
57 
58 void MatrixSelectionDialog::on_buttonBox_accepted()
59 {
60  selected_item_ = tree_model_->getItem(ui->treeView->currentIndex());
61  data_keys_ = selected_item_->keys();
62  accepted_ = true;
63  emit ItemSelected(selected_item_);
64  if (selected_item_->type() == TreeItem::ItemType::Matrix)
65  emit MatrixSelected(data_keys_);
66  close();
67 }
68 
69 void MatrixSelectionDialog::on_buttonBox_rejected()
70 {
71  accepted_ = false;
72  close();
73 }
QStringList keys() const
Definition: treeitem.cpp:98
Definition: ahcadialog.h:26
TreeItem::ItemType type() const
Definition: treeitem.cpp:93
MatrixSelectionDialog(QWidget *parent, DatasetTreeModel *model)
void SetModel(DatasetTreeModel *model)
TreeItem * getItem(const QModelIndex &index) const
void MatrixSelected(QStringList keys)
void ItemSelected(TreeItem *item)