mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-21 20:09:59 +01:00
Improve element query widget
User can now filter each field of the query
This commit is contained in:
@@ -93,23 +93,48 @@ QVector<QStringList> projectDataBase::elementsInfoFromQuery(const QString &query
|
|||||||
QStringList projectDataBase::headersFromElementsInfoQuery(const QString &query)
|
QStringList projectDataBase::headersFromElementsInfoQuery(const QString &query)
|
||||||
{
|
{
|
||||||
QStringList header_string;
|
QStringList header_string;
|
||||||
if (query.startsWith("SELECT ") && query.contains("FROM"))
|
if (!query.startsWith("SELECT ") && !query.contains("FROM")) {
|
||||||
{
|
return header_string;
|
||||||
auto header = query;
|
}
|
||||||
header.remove(0, 7); //Remove SELECT from the string;
|
|
||||||
header.truncate(header.indexOf("FROM")); //Now we only have the string between SELECT and FROM
|
|
||||||
header.replace(" ", ""); //remove white space
|
|
||||||
QStringList list = header.split(",");
|
|
||||||
|
|
||||||
if (!list.isEmpty())
|
auto header = query;
|
||||||
|
header.remove(0, 7); //Remove SELECT from the string;
|
||||||
|
header.truncate(header.indexOf("FROM")); //Now we only have the string between SELECT and FROM
|
||||||
|
header.replace(" ", ""); //remove white space
|
||||||
|
QStringList list = header.split(","); //split each column
|
||||||
|
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return header_string;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i=0 ; i<list.size() ; i++)
|
||||||
|
{
|
||||||
|
auto str = list.at(i);
|
||||||
|
|
||||||
|
if(str == "e.pos") { //Query in element table wich have only pose use in this case
|
||||||
|
header_string.append(tr("Position"));
|
||||||
|
}
|
||||||
|
else if (str.contains("ei.")) //Query in element_info table
|
||||||
{
|
{
|
||||||
for (int i=0 ; i<list.size() ; i++)
|
str.remove(0,3);
|
||||||
{
|
header_string.append(QETApp::elementTranslatedInfoKey(str));
|
||||||
if (list.at(i) == "pos") {
|
}
|
||||||
header_string.append(tr("Position"));
|
else if (str == "d.pos") { //query in diagram table wich have only pos use in this case
|
||||||
} else {
|
header_string.append(tr("Position du folio"));
|
||||||
header_string.append(QETApp::elementTranslatedInfoKey(list.at(i)));
|
}
|
||||||
}
|
else if (str.contains("di.")) //query in diagram_info table
|
||||||
|
{
|
||||||
|
str.remove(0,3);
|
||||||
|
header_string.append(QETApp::diagramTranslatedInfoKey(str));
|
||||||
|
}
|
||||||
|
else //Default case
|
||||||
|
{
|
||||||
|
if (str == "pos") {
|
||||||
|
header_string.append(tr("Position"));
|
||||||
|
} else if (QETApp::elementInfoKeys().contains(str)) {
|
||||||
|
header_string.append(QETApp::elementTranslatedInfoKey(str));
|
||||||
|
} else {
|
||||||
|
header_string.append(QETApp::diagramTranslatedInfoKey(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,10 @@ ElementQueryWidget::ElementQueryWidget(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
m_export_info.insert("pos", tr("Position"));
|
m_export_info.insert("e.pos", tr("Position"));
|
||||||
// m_export_info.insert("folio_title", tr("Titre du folio"));
|
m_export_info.insert("di.title", tr("Titre du folio"));
|
||||||
// m_export_info.insert("folio_pos", tr("Position de folio"));
|
m_export_info.insert("d.pos", tr("Position du folio"));
|
||||||
// m_export_info.insert("folio_num", tr("Numéro de folio"));
|
m_export_info.insert("di.folio", tr("Numéro du folio"));
|
||||||
// m_export_info.insert("designation_qty", tr("Quantité (Numéro d'article)"));
|
|
||||||
|
|
||||||
m_button_group.setExclusive(false);
|
m_button_group.setExclusive(false);
|
||||||
m_button_group.addButton(ui->m_all_cb, 0);
|
m_button_group.addButton(ui->m_all_cb, 0);
|
||||||
@@ -110,6 +109,7 @@ QString ElementQueryWidget::queryStr() const
|
|||||||
|
|
||||||
QString select ="SELECT ";
|
QString select ="SELECT ";
|
||||||
QString order_by = " ORDER BY ";
|
QString order_by = " ORDER BY ";
|
||||||
|
QString filter_;
|
||||||
|
|
||||||
QString column;
|
QString column;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
@@ -122,37 +122,66 @@ QString ElementQueryWidget::queryStr() const
|
|||||||
}
|
}
|
||||||
column += key;
|
column += key;
|
||||||
order_by += key;
|
order_by += key;
|
||||||
|
|
||||||
|
auto f = FilterFor(key);
|
||||||
|
switch (f.first)
|
||||||
|
{
|
||||||
|
case 0: //No filter
|
||||||
|
break;
|
||||||
|
case 1: //Not empty
|
||||||
|
filter_ += QString(" AND ") += key += " IS NOT NULL";
|
||||||
|
break;
|
||||||
|
case 2: //empty
|
||||||
|
filter_ += QString(" AND ") += key += " IS NULL";
|
||||||
|
break;
|
||||||
|
case 3: // contain
|
||||||
|
filter_ += QString(" AND ") += key += QString(" LIKE'%") += f.second += "%'";
|
||||||
|
break;
|
||||||
|
case 4: // not contain
|
||||||
|
filter_ += QString(" AND ") += key += QString(" NOT LIKE'%") += f.second += "%'";
|
||||||
|
break;
|
||||||
|
case 5: // is equal
|
||||||
|
filter_ += QString(" AND ") += key += QString("='") += f.second += "'";
|
||||||
|
break;
|
||||||
|
case 6: // is not equal
|
||||||
|
filter_ += QString(" AND ") += key += QString("!='") += f.second += "'";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString from = " FROM element_info";
|
QString from = " FROM element_info ei, element e, diagram d, diagram_info di";
|
||||||
QString where;
|
QString where = " WHERE ei.element_uuid = e.uuid"
|
||||||
|
" AND di.diagram_uuid = d.uuid"
|
||||||
|
" AND e.diagram_uuid = d.uuid";
|
||||||
|
|
||||||
if (ui->m_all_cb->checkState() == Qt::PartiallyChecked)
|
if (ui->m_all_cb->checkState() == Qt::PartiallyChecked)
|
||||||
{
|
{
|
||||||
if (ui->m_terminal_cb->isChecked()) {
|
if (ui->m_terminal_cb->isChecked()) {where += " AND e.type = 'Terminale'";}
|
||||||
where = " WHERE element_type = 'Terminale'";
|
if (ui->m_simple_cb->isChecked()) {where += " AND e.type = 'Simple'";}
|
||||||
}
|
if (ui->m_button_cb->isChecked()) {where += " AND e.sub_type = 'commutator'";}
|
||||||
if (ui->m_simple_cb->isChecked()) {
|
if (ui->m_coil_cb->isChecked()) {where += " AND e.sub_type = 'coil'";}
|
||||||
auto str = where.isEmpty() ? " WHERE element_type = 'Simple'" : " AND element_type = 'Simple'";
|
if (ui->m_protection_cb->isChecked()) {where += " AND e.sub_type = 'protection'";}
|
||||||
where += str;
|
|
||||||
}
|
|
||||||
if (ui->m_button_cb->isChecked()) {
|
|
||||||
auto str = where.isEmpty() ? " WHERE element_subtype = 'commutator'" : " AND element_subtype = 'commutator'";
|
|
||||||
where += str;
|
|
||||||
}
|
|
||||||
if (ui->m_coil_cb->isChecked()) {
|
|
||||||
auto str = where.isEmpty() ? " WHERE element_subtype = 'coil'" : " AND element_subtype = 'coil'";
|
|
||||||
where += str;
|
|
||||||
}
|
|
||||||
if (ui->m_protection_cb->isChecked()) {
|
|
||||||
auto str = where.isEmpty() ? " WHERE element_subtype = 'protection'" : " AND element_subtype = 'protection'";
|
|
||||||
where += str;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString q(select + column + from + where + order_by);
|
|
||||||
|
QString q(select + column + from + where + filter_ + order_by);
|
||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList ElementQueryWidget::header() const
|
||||||
|
{
|
||||||
|
//Made a string list with the colomns (keys) choosen by the user
|
||||||
|
QStringList headers;
|
||||||
|
int row = 0;
|
||||||
|
while (auto *item = ui->m_choosen_list->item(row))
|
||||||
|
{
|
||||||
|
headers.append(item->data(Qt::DisplayRole).toString());
|
||||||
|
++row;
|
||||||
|
}
|
||||||
|
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementQueryWidget::updateQueryLine
|
* @brief ElementQueryWidget::updateQueryLine
|
||||||
*/
|
*/
|
||||||
@@ -183,10 +212,11 @@ void ElementQueryWidget::setUpItems()
|
|||||||
for(QString key : QETApp::elementInfoKeys())
|
for(QString key : QETApp::elementInfoKeys())
|
||||||
{
|
{
|
||||||
auto item = new QListWidgetItem(QETApp::elementTranslatedInfoKey(key), ui->m_var_list);
|
auto item = new QListWidgetItem(QETApp::elementTranslatedInfoKey(key), ui->m_var_list);
|
||||||
item->setData(Qt::UserRole, key);
|
item->setData(Qt::UserRole, "ei." + key);
|
||||||
m_items_list << item;
|
m_items_list << item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (auto key : m_export_info.keys())
|
for (auto key : m_export_info.keys())
|
||||||
{
|
{
|
||||||
auto item = new QListWidgetItem(m_export_info.value(key), ui->m_var_list);
|
auto item = new QListWidgetItem(m_export_info.value(key), ui->m_var_list);
|
||||||
@@ -195,6 +225,15 @@ void ElementQueryWidget::setUpItems()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ElementQueryWidget::FilterFor
|
||||||
|
* @param key
|
||||||
|
* @return the filter associated to key
|
||||||
|
*/
|
||||||
|
QPair<int, QString> ElementQueryWidget::FilterFor(const QString &key) const {
|
||||||
|
return m_filter.value(key, qMakePair(0, QString()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ElementQueryWidget::on_m_up_pb_clicked
|
* @brief ElementQueryWidget::on_m_up_pb_clicked
|
||||||
*/
|
*/
|
||||||
@@ -272,3 +311,54 @@ void ElementQueryWidget::on_m_edit_sql_query_cb_clicked()
|
|||||||
updateQueryLine();
|
updateQueryLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ElementQueryWidget::on_m_plant_textChanged(const QString &arg1) {
|
||||||
|
Q_UNUSED(arg1)
|
||||||
|
updateQueryLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElementQueryWidget::on_m_location_textChanged(const QString &arg1) {
|
||||||
|
Q_UNUSED(arg1)
|
||||||
|
updateQueryLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElementQueryWidget::on_m_filter_le_textEdited(const QString &arg1)
|
||||||
|
{
|
||||||
|
if (auto item = ui->m_choosen_list->currentItem())
|
||||||
|
{
|
||||||
|
auto key = item->data(Qt::UserRole).toString();
|
||||||
|
auto type = ui->m_filter_type_cb->currentIndex();
|
||||||
|
auto value = arg1;
|
||||||
|
|
||||||
|
m_filter.insert(key, qMakePair(type, value));
|
||||||
|
updateQueryLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElementQueryWidget::on_m_filter_type_cb_activated(int index)
|
||||||
|
{
|
||||||
|
if (auto item = ui->m_choosen_list->currentItem())
|
||||||
|
{
|
||||||
|
auto key = item->data(Qt::UserRole).toString();
|
||||||
|
auto type = index;
|
||||||
|
auto value = ui->m_filter_le->text();
|
||||||
|
|
||||||
|
m_filter.insert(key, qMakePair(type, value));
|
||||||
|
ui->m_filter_le->setDisabled(index <= 2);
|
||||||
|
updateQueryLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ElementQueryWidget::on_m_choosen_list_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
|
{
|
||||||
|
Q_UNUSED(previous)
|
||||||
|
|
||||||
|
if (!current)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto key = current->data(Qt::UserRole).toString();
|
||||||
|
auto p = FilterFor(key);
|
||||||
|
ui->m_filter_type_cb->setCurrentIndex(p.first);
|
||||||
|
ui->m_filter_le->setText(p.second);
|
||||||
|
ui->m_filter_le->setEnabled(p.first>=3);
|
||||||
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class ElementQueryWidget : public QWidget
|
|||||||
~ElementQueryWidget();
|
~ElementQueryWidget();
|
||||||
|
|
||||||
QString queryStr() const;
|
QString queryStr() const;
|
||||||
|
QStringList header() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_m_up_pb_clicked();
|
void on_m_up_pb_clicked();
|
||||||
@@ -48,17 +49,25 @@ class ElementQueryWidget : public QWidget
|
|||||||
void on_m_remove_pb_clicked();
|
void on_m_remove_pb_clicked();
|
||||||
void on_m_down_pb_clicked();
|
void on_m_down_pb_clicked();
|
||||||
void on_m_edit_sql_query_cb_clicked();
|
void on_m_edit_sql_query_cb_clicked();
|
||||||
|
void on_m_plant_textChanged(const QString &arg1);
|
||||||
|
void on_m_location_textChanged(const QString &arg1);
|
||||||
|
void on_m_filter_le_textEdited(const QString &arg1);
|
||||||
|
void on_m_filter_type_cb_activated(int index);
|
||||||
|
|
||||||
void updateQueryLine();
|
void updateQueryLine();
|
||||||
QStringList selectedKeys() const;
|
QStringList selectedKeys() const;
|
||||||
void setUpItems();
|
void setUpItems();
|
||||||
|
QPair<int, QString> FilterFor(const QString &key) const;
|
||||||
|
|
||||||
private:
|
void on_m_choosen_list_currentItemChanged(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
|
|
||||||
|
private:
|
||||||
Ui::ElementQueryWidget *ui;
|
Ui::ElementQueryWidget *ui;
|
||||||
QHash <QString, QString> m_export_info;
|
QHash <QString, QString> m_export_info;
|
||||||
QButtonGroup m_button_group;
|
QButtonGroup m_button_group;
|
||||||
QList <QListWidgetItem *> m_items_list;
|
QList <QListWidgetItem *> m_items_list;
|
||||||
QString m_custom_query;
|
QString m_custom_query;
|
||||||
|
QHash <QString, QPair<int, QString>> m_filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ELEMENTQUERYWIDGET_H
|
#endif // ELEMENTQUERYWIDGET_H
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>341</width>
|
<width>341</width>
|
||||||
<height>457</height>
|
<height>527</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -163,6 +163,61 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget" native="true">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="m_filter_type_cb">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Pas de filtre</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>N'est pas vide</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Est vide</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Contient</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ne contient pas</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Est égal à</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>N'est pas égale à</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLineEdit" name="m_filter_le"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Filtre :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="m_parametre_widget" native="true">
|
<widget class="QWidget" name="m_parametre_widget" native="true">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
|||||||
@@ -412,11 +412,12 @@ void QETDiagramEditor::setUpActions()
|
|||||||
|
|
||||||
/*******ONLY FOR TEST DURING DEVEL*********/
|
/*******ONLY FOR TEST DURING DEVEL*********/
|
||||||
auto model = new NomenclatureModel(this->currentProject(), this->currentProject());
|
auto model = new NomenclatureModel(this->currentProject(), this->currentProject());
|
||||||
QString query("SELECT ei.plant AS plant, ei.location AS location, di.title AS title, ei.label AS label, ei.comment AS comment, e.pos AS pos"
|
QString query("SELECT ei.plant, ei.location, ei.label, ei.comment, e.pos, di.title, di.folio"
|
||||||
" FROM element_info ei, element e, diagram_info di"
|
" FROM element_info ei, element e, diagram_info di"
|
||||||
" WHERE ei.element_uuid = e.uuid AND e.diagram_uuid = di.diagram_uuid"
|
" WHERE ei.element_uuid = e.uuid AND e.diagram_uuid = di.diagram_uuid"
|
||||||
" ORDER BY plant, location, title, label, pos");
|
" ORDER BY ei.plant, ei.location, ei.label");
|
||||||
model->query(query);
|
model->query(query);
|
||||||
|
model->autoHeaders();
|
||||||
model->setData(model->index(0,0), Qt::AlignLeft, Qt::TextAlignmentRole);
|
model->setData(model->index(0,0), Qt::AlignLeft, Qt::TextAlignmentRole);
|
||||||
model->setData(model->index(0,0), QETApp::diagramTextsFont(), Qt::FontRole);
|
model->setData(model->index(0,0), QETApp::diagramTextsFont(), Qt::FontRole);
|
||||||
model->setHeaderData(0, Qt::Horizontal, Qt::AlignHCenter, Qt::TextAlignmentRole);
|
model->setHeaderData(0, Qt::Horizontal, Qt::AlignHCenter, Qt::TextAlignmentRole);
|
||||||
|
|||||||
@@ -165,12 +165,7 @@ QVariant NomenclatureModel::data(const QModelIndex &index, int role) const
|
|||||||
void NomenclatureModel::query(const QString &query)
|
void NomenclatureModel::query(const QString &query)
|
||||||
{
|
{
|
||||||
auto rm_ = m_query != query;
|
auto rm_ = m_query != query;
|
||||||
if (rm_)
|
if (rm_) {
|
||||||
{
|
|
||||||
auto headers = projectDataBase::headersFromElementsInfoQuery(query);
|
|
||||||
for (auto i=0 ; i<headers.size() ; ++i) {
|
|
||||||
this->setHeaderData(i, Qt::Horizontal, headers.at(i));
|
|
||||||
}
|
|
||||||
emit beginResetModel();
|
emit beginResetModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,6 +190,18 @@ QETProject *NomenclatureModel::project() const {
|
|||||||
return m_project.data();
|
return m_project.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief NomenclatureModel::autoHeaders
|
||||||
|
* Try to determine the name of each columns header
|
||||||
|
*/
|
||||||
|
void NomenclatureModel::autoHeaders()
|
||||||
|
{
|
||||||
|
auto headers = projectDataBase::headersFromElementsInfoQuery(m_query);
|
||||||
|
for (auto i=0 ; i<headers.size() ; ++i) {
|
||||||
|
this->setHeaderData(i, Qt::Horizontal, headers.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief NomenclatureModel::dataBaseUpdated
|
* @brief NomenclatureModel::dataBaseUpdated
|
||||||
* slot called when the project database is updated
|
* slot called when the project database is updated
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class NomenclatureModel : public QAbstractTableModel
|
|||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
void query(const QString &query);
|
void query(const QString &query);
|
||||||
QETProject *project() const;
|
QETProject *project() const;
|
||||||
|
void autoHeaders();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dataBaseUpdated();
|
void dataBaseUpdated();
|
||||||
|
|||||||
@@ -70,8 +70,13 @@ void NomenclatureModelPropertiesWidget::on_m_edit_query_pb_clicked()
|
|||||||
connect(button_box, &QDialogButtonBox::accepted, &d, &QDialog::accept);
|
connect(button_box, &QDialogButtonBox::accepted, &d, &QDialog::accept);
|
||||||
connect(button_box, &QDialogButtonBox::rejected, &d, &QDialog::reject);
|
connect(button_box, &QDialogButtonBox::rejected, &d, &QDialog::reject);
|
||||||
|
|
||||||
if (d.exec()) {
|
if (d.exec())
|
||||||
|
{
|
||||||
m_model->query(query_widget->queryStr());
|
m_model->query(query_widget->queryStr());
|
||||||
|
auto headers = query_widget->header();
|
||||||
|
for (auto i=0 ; i<headers.size() ; ++i) {
|
||||||
|
m_model->setHeaderData(i, Qt::Horizontal, headers.at(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user