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"));
74 std::vector<std::pair<std::string, std::string> > vec;
83 for(
size_t t = 0; t < vec.size(); ++t)
85 std::map<std::string, int>::iterator it =
m_orderTypes.find(vec[t].second);
100 m_ui->m_orderPropertyComboBox->clear();
102 for(
size_t t = 0; t <vec.size(); ++t)
104 m_ui->m_orderPropertyComboBox->addItem(vec[t].c_str());
110 int row =
m_ui->m_orderTableWidget->rowCount();
113 for(
int i = 0; i < row; ++i)
116 QTableWidgetItem* itemType =
m_ui->m_orderTableWidget->item(i, 1);
117 std::string type = itemType->text().toUtf8().data();
120 QTableWidgetItem* itemName =
m_ui->m_orderTableWidget->item(i, 0);
121 std::string name = itemName->text().toUtf8().data();
123 list.push_back(std::pair<std::string, std::string> (name, type));
129 if(
m_ui->m_orderPropertyComboBox->currentText().isEmpty())
131 QMessageBox::warning(
this, tr(
"Query Builder"), tr(
"Property value not defined."));
135 int newrow =
m_ui->m_orderTableWidget->rowCount();
137 std::string propertyValue =
m_ui->m_orderPropertyComboBox->currentText().toUtf8().data();
138 std::string order =
m_ui->m_orderComboBox->currentText().toUtf8().data();
141 m_ui->m_orderTableWidget->insertRow(newrow);
143 QTableWidgetItem* itemProperty =
new QTableWidgetItem(QString::fromUtf8(propertyValue.c_str()));
144 m_ui->m_orderTableWidget->setItem(newrow, 0, itemProperty);
146 QTableWidgetItem* itemOrder =
new QTableWidgetItem(QString::fromUtf8(order.c_str()));
147 m_ui->m_orderTableWidget->setItem(newrow, 1, itemOrder);
149 m_ui->m_orderTableWidget->resizeColumnsToContents();
154 int row =
m_ui->m_orderTableWidget->currentRow();
157 m_ui->m_orderTableWidget->removeRow(row);
159 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.