27 #include "../../../dataaccess/dataset/DataSetType.h"
28 #include "../../../dataaccess/dataset/Index.h"
29 #include "../utils/DoubleListWidget.h"
31 #include "ui_DoubleListWidgetForm.h"
32 #include "ui_IndexWidgetForm.h"
35 #include <QGridLayout>
36 #include <QMessageBox>
40 m_ui(new Ui::IndexWidgetForm)
56 QGridLayout* layout =
new QGridLayout(
m_ui->m_widget);
64 std::vector<std::string> propValues;
87 if(m_ui->m_nameLineEdit->text().isEmpty())
92 std::string indexName = m_ui->m_nameLineEdit->text().toStdString();
95 int currIndex = m_ui->m_typeComboBox->currentIndex();
96 int indexType = m_ui->m_typeComboBox->itemData(currIndex).toInt();
101 std::vector<std::string> vec = m_doubleListWidget->getOutputValues();
114 for(
size_t t = 0; t < vec.size(); ++t)
127 if(m_ui->m_nameLineEdit->text().isEmpty())
129 QMessageBox::warning(
this, tr(
"Warning"), tr(
"Index name not defined."));
134 std::vector<std::string> vec = m_doubleListWidget->getOutputValues();
138 QMessageBox::warning(
this, tr(
"Warning"), tr(
"No property selected."));
150 m_ui->m_nameLineEdit->setText(idx->
getName().c_str());
152 m_ui->m_typeComboBox->setCurrentIndex(idx->
getIndexType());
154 std::vector<te::dt::Property*> idxProps = idx->
getProperties();
155 std::vector<std::string> idxPropsStr;
156 for(std::size_t i = 0; i < idxProps.size(); ++i)
158 idxPropsStr.push_back(idxProps[i]->getName());
161 std::vector<te::dt::Property*> dtProps = m_dsType->getProperties();
162 std::vector<std::string> dtPropsStr;
163 for(std::size_t i = 0; i < dtProps.size(); ++i)
165 std::string propStr = dtProps[i]->getName();
167 if(std::find(idxPropsStr.begin(), idxPropsStr.end(), propStr) != idxPropsStr.end())
170 dtPropsStr.push_back(propStr);
173 m_doubleListWidget->setInputValues(dtPropsStr);
174 m_doubleListWidget->setOutputValues(idxPropsStr);
Property * getProperty(std::size_t i) const
It returns the i-th property.
A class that models the description of a dataset.
virtual Property * clone() const =0
It returns a clone of the object.
void setIndexType(IndexType t)
It sets the index type.
void add(te::dt::Property *p)
It adds the property to the list of properties of the index.
It models a property definition.
const std::vector< Property * > & getProperties() const
It returns the list of properties describing the CompositeProperty.
const std::vector< te::dt::Property * > & getProperties() const
It returns the properties that take part of the index.
void setName(const std::string &name)
It sets the index name.
IndexType getIndexType() const
It gets the index type.
It describes an index associated to a DataSetType.
const std::string & getName() const
It returns the property name.
const std::string & getName() const
It returns the index name.