Fix include paths, compilation errors, linker errors for insertRow/insertChild/removeRow, and DbUtils include path. BudgetPro now builds successfully.

This commit is contained in:
Javi
2026-06-01 10:02:36 +02:00
parent 3437103c28
commit bf57c455cd
15 changed files with 286 additions and 258 deletions
+18 -5
View File
@@ -18,6 +18,7 @@
#include <QFile>
#include <QAction>
#include <QtSql>
#include "utils/dbutils.h"
formBudget::formBudget(QString aID, int amEditMode, QWidget *parent) :
formBase(aID, amEditMode, parent),
@@ -73,7 +74,6 @@ formBudget::formBudget(QString aID, int amEditMode, QWidget *parent) :
// Combobox:
ItemComboboxDelegate *ComboboxEditor = new ItemComboboxDelegate(this);
ui->treeView->setItemDelegateForColumn(6, ComboboxEditor);
connect(model, &TreeModel::dataChanged, this, &formBudget::on_ModelSetData);
// Prueba:
@@ -166,13 +166,13 @@ void formBudget::setupDelegates()
void formBudget::setupConnections()
{
connect(ui->buttonInsertRow, &QPushButton::released,
this, &formBudget::insertRow);
this, &formBudget::on_buttonInsertRow_released);
connect(ui->buttonInsertChild, &QPushButton::released,
this, &formBudget::insertChild);
this, &formBudget::on_buttonInsertChild_released);
connect(ui->buttonRemoveRow, &QPushButton::released,
this, &formBudget::removeRow);
this, &formBudget::on_buttonRemoveRow_released);
// ... otras conexiones ...
}
@@ -361,6 +361,7 @@ static void save_to_db(const QString & tablename, QTreeWidgetItem* parent, int p
void formBudget::saveModel(QSqlQuery qry, QString aCommand, QAbstractItemModel *aModel, int aLevel)
{
Q_UNUSED(aLevel);
//QObjectList list = aModel->parent()->children();
//for (auto aChil : list)
@@ -576,7 +577,7 @@ void formBudget::on_buttonSave_released()
save();
}
void formBudget::on_ModelSetData(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles)
void formBudget::onModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
if(mEditMode)
return;
@@ -589,8 +590,20 @@ void formBudget::on_ModelSetData(const QModelIndex &topLeft, const QModelIndex &
InsertElement(topLeft.data().toString(), topLeft);
}
}
void formBudget::insertRow()
{
ui->treeView->insertRow();
}
void formBudget::insertChild()
{
ui->treeView->insertChild();
}
void formBudget::removeRow()
{
ui->treeView->removeRow();
}
void formBudget::focusInEvent(QFocusEvent *event)
{
+7 -2
View File
@@ -3,6 +3,7 @@
#include "formbase.h"
#include "dbutils.h"
#include <QWidget>
@@ -43,12 +44,12 @@ private slots:
void on_buttonManpower_released();
void on_buttonValidate_released();
void on_buttonSave_released();
void on_ModelSetData(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
void on_tabWidget_currentChanged(int index);
private:
private:
TreeModel *m_treeModel;
Ui::formBudget *ui;
DbUtils m_dbUtils;
void setLineType(QString type, QModelIndex index);
void setCellText(QString val, QModelIndex index, int col);
@@ -58,6 +59,10 @@ private:
void setupDelegates();
void setupConnections();
void initializeDocument();
void onModelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
void insertRow();
void insertChild();
void removeRow();
protected:
+1 -1
View File
@@ -2,7 +2,7 @@
#define FORMBUDGETLIST_H
#include <QWidget>
#include <gui/formbaselist.h>
#include "formbaselist.h"
namespace Ui {
class FormBudgetList;
+2 -5
View File
@@ -2,11 +2,11 @@
#include "qpainter.h"
#include "ui_formelementlist.h"
#include "formproduct.h"
#include "mainwindow.h"
#include "../mainwindow.h"
#include "mapplication.h"
#include "msqlquerymodel.h"
#include "utils/filtertableheader.h"
#include "gui/formbaselist.h"
#include "formbaselist.h"
#include <QDrag>
@@ -94,9 +94,6 @@ void formElementList::on_buttonDelete_released()
QSqlQuery qry = QSqlQuery(dApp->Enterprise());
// Check if it's a composed element (TYPE1 = 0) and delete its composition first
QModelIndex parentIndex = index.parent();
QModelIndex childIndex = model->index(index.row(), 2, parentIndex); // Obtén el índice del hijo
int type = childIndex.data().toInt(); // Accede al dato
if (type == 0) // ElementType::Composed
{
+2 -2
View File
@@ -8,7 +8,7 @@
#include "itemtextpopupdelegate.h"
#include "itemcomboboxdelegate.h"
#include "QtSql"
#include <QtSql>
formProduct::formProduct(QString aID, int aEditMode, QWidget *parent) :
@@ -323,7 +323,7 @@ void formProduct::save()
qDebug() << "Error ejecutando el query: " << qry.lastError().text() << "\n";
dApp->Enterprise().close();
return;
}}
}
}
}
+2 -1
View File
@@ -43,6 +43,7 @@ private slots:
private:
Ui::formProduct *ui;
bool editMode;
QStringList insertedElementCodes;
void CalculatePrice();
bool InsertElement(QString ID, QModelIndex index);
@@ -52,4 +53,4 @@ private:
void setComposeElement(bool val);
};
#endif // FORMPRODUCT_H
#endif // FORMPRODUCT_H
+1
View File
@@ -2,6 +2,7 @@
#define FORMTHIRD_H
#include <QWidget>
#include <QMap>
#include "formbase.h"
namespace Ui {
+1 -1
View File
@@ -1,7 +1,7 @@
#include "formthirdlist.h"
#include "ui_formthirdlist.h"
#include "mapplication.h"
#include "mainwindow.h"
#include "../mainwindow.h"
#include "formthird.h"
#include "utils/filtertableheader.h"