Add new summary table (WIP)

This commit is contained in:
Claveau Joshua
2020-06-18 18:52:29 +02:00
parent 80b5029cd1
commit ec5f537da4
21 changed files with 1079 additions and 524 deletions

View File

@@ -15,48 +15,48 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nomenclaturemodelpropertieswidget.h"
#include "ui_nomenclaturemodelpropertieswidget.h"
#include "nomenclaturemodel.h"
#include "projectdbmodelpropertieswidget.h"
#include "ui_projectdbmodelpropertieswidget.h"
#include "projectdbmodel.h"
#include "qetproject.h"
#include "elementquerywidget.h"
#include <QDialogButtonBox>
/**
* @brief NomenclatureModelPropertiesWidget::NomenclatureModelPropertiesWidget
* @brief projectDBModelPropertiesWidget::projectDBModelPropertiesWidget
* @param model
* @param parent
*/
NomenclatureModelPropertiesWidget::NomenclatureModelPropertiesWidget(NomenclatureModel *model, QWidget *parent) :
ProjectDBModelPropertiesWidget::ProjectDBModelPropertiesWidget(ProjectDBModel *model, QWidget *parent) :
PropertiesEditorWidget(parent),
ui(new Ui::NomenclatureModelPropertiesWidget)
ui(new Ui::ProjectDBModelPropertiesWidget)
{
ui->setupUi(this);
setModel(model);
}
/**
* @brief NomenclatureModelPropertiesWidget::~NomenclatureModelPropertiesWidget
* @brief projectDBModelPropertiesWidget::~projectDBModelPropertiesWidget
*/
NomenclatureModelPropertiesWidget::~NomenclatureModelPropertiesWidget() {
ProjectDBModelPropertiesWidget::~ProjectDBModelPropertiesWidget() {
delete ui;
}
/**
* @brief NomenclatureModelPropertiesWidget::setModel
* @brief projectDBModelPropertiesWidget::setModel
* @param model
*/
void NomenclatureModelPropertiesWidget::setModel(NomenclatureModel *model) {
void ProjectDBModelPropertiesWidget::setModel(ProjectDBModel *model) {
m_model = model;
ui->m_edit_query_pb->setEnabled(m_model);
ui->m_refresh_pb->setEnabled(m_model);
}
/**
* @brief NomenclatureModelPropertiesWidget::on_m_edit_query_pb_clicked
* @brief projectDBModelPropertiesWidget::on_m_edit_query_pb_clicked
*/
void NomenclatureModelPropertiesWidget::on_m_edit_query_pb_clicked()
void ProjectDBModelPropertiesWidget::on_m_edit_query_pb_clicked()
{
QDialog d(this);
auto l = new QVBoxLayout;
@@ -73,7 +73,7 @@ void NomenclatureModelPropertiesWidget::on_m_edit_query_pb_clicked()
if (d.exec())
{
m_model->query(query_widget->queryStr());
m_model->setQuery(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));
@@ -81,7 +81,7 @@ void NomenclatureModelPropertiesWidget::on_m_edit_query_pb_clicked()
}
}
void NomenclatureModelPropertiesWidget::on_m_refresh_pb_clicked() {
void ProjectDBModelPropertiesWidget::on_m_refresh_pb_clicked() {
if (m_model && m_model->project()) {
m_model->project()->dataBase()->updateDB();
}

View File

@@ -15,38 +15,39 @@
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NOMENCLATUREMODELPROPERTIESWIDGET_H
#define NOMENCLATUREMODELPROPERTIESWIDGET_H
#ifndef PROJECTDBMODELPROPERTIESWIDGET_H
#define PROJECTDBMODELPROPERTIESWIDGET_H
#include "PropertiesEditor/propertieseditorwidget.h"
class NomenclatureModel;
class ProjectDBModel;
namespace Ui {
class NomenclatureModelPropertiesWidget;
class ProjectDBModelPropertiesWidget;
}
/**
* @brief The NomenclatureModelPropertiesWidget class
* @brief The projectDBModelPropertiesWidget class
* This class is an editor for a NomenclatureModel
*/
class NomenclatureModelPropertiesWidget : public PropertiesEditorWidget
class ProjectDBModelPropertiesWidget : public PropertiesEditorWidget
{
Q_OBJECT
public:
explicit NomenclatureModelPropertiesWidget(NomenclatureModel *model = nullptr, QWidget *parent = nullptr);
~NomenclatureModelPropertiesWidget();
explicit ProjectDBModelPropertiesWidget(ProjectDBModel *model = nullptr, QWidget *parent = nullptr);
~ProjectDBModelPropertiesWidget();
void setModel(NomenclatureModel *model);
void setModel(ProjectDBModel *model);
private slots:
void on_m_edit_query_pb_clicked();
void on_m_refresh_pb_clicked();
private:
Ui::NomenclatureModelPropertiesWidget *ui;
NomenclatureModel *m_model = nullptr;
Ui::ProjectDBModelPropertiesWidget *ui;
ProjectDBModel *m_model = nullptr;
};
#endif // NOMENCLATUREMODELPROPERTIESWIDGET_H
#endif // PROJECTDBMODELPROPERTIESWIDGET_H

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NomenclatureModelPropertiesWidget</class>
<widget class="QWidget" name="NomenclatureModelPropertiesWidget">
<class>ProjectDBModelPropertiesWidget</class>
<widget class="QWidget" name="ProjectDBModelPropertiesWidget">
<property name="geometry">
<rect>
<x>0</x>