27 #include "../../../dataaccess/query/OrderByItem.h"
28 #include "../../../dataaccess/query/PropertyName.h"
30 #include "ui_OrderByWidgetForm.h"
35 #include <QMessageBox>
39 m_ui(new
Ui::OrderByWidgetForm)
47 std::map<std::string, int>::iterator it =
m_orderTypes.begin();
51 m_ui->m_orderComboBox->addItem(it->first.c_str());
57 m_ui->m_addOrderPushButton->setIcon(QIcon::fromTheme(
"list-add"));
58 m_ui->m_removeOrderPushButton->setIcon(QIcon::fromTheme(
"list-remove"));
76 std::vector<std::pair<std::string, std::string> > vec;
85 for(
size_t t = 0; t < vec.size(); ++t)
87 std::map<std::string, int>::iterator it = m_orderTypes.find(vec[t].second);
89 if(it != m_orderTypes.end())
102 m_ui->m_orderPropertyComboBox->clear();
104 for(
size_t t = 0; t <vec.size(); ++t)
106 m_ui->m_orderPropertyComboBox->addItem(vec[t].c_str());
112 int row = m_ui->m_orderTableWidget->rowCount();
115 for(
int i = 0; i < row; ++i)
118 QTableWidgetItem* itemType = m_ui->m_orderTableWidget->item(i, 1);
119 std::string type = itemType->text().toStdString();
122 QTableWidgetItem* itemName = m_ui->m_orderTableWidget->item(i, 0);
123 std::string name = itemName->text().toStdString();
125 list.push_back(std::pair<std::string, std::string> (name, type));
131 if(m_ui->m_orderPropertyComboBox->currentText().isEmpty())
133 QMessageBox::warning(
this, tr(
"Query Builder"), tr(
"Property value not defined."));
137 int newrow = m_ui->m_orderTableWidget->rowCount();
139 std::string propertyValue = m_ui->m_orderPropertyComboBox->currentText().toStdString();
140 std::string order = m_ui->m_orderComboBox->currentText().toStdString();
143 m_ui->m_orderTableWidget->insertRow(newrow);
145 QTableWidgetItem* itemProperty =
new QTableWidgetItem(QString::fromStdString(propertyValue));
146 m_ui->m_orderTableWidget->setItem(newrow, 0, itemProperty);
148 QTableWidgetItem* itemOrder =
new QTableWidgetItem(QString::fromStdString(order));
149 m_ui->m_orderTableWidget->setItem(newrow, 1, itemOrder);
151 m_ui->m_orderTableWidget->resizeColumnsToContents();
156 int row = m_ui->m_orderTableWidget->currentRow();
159 m_ui->m_orderTableWidget->removeRow(row);
161 m_ui->m_orderTableWidget->resizeColumnsToContents();
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
SortOrder
Sort order type: asc or desc.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.