mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-20 19:19:58 +01:00
Add new summary table (WIP)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user