Refactor specification handling in DocumentSettingsDialog and PDFController. Introduced primary application field for document types, updated export messages for consistency, and improved page number handling in specifications. Cleaned up unnecessary code in preview widgets.

This commit is contained in:
2025-12-23 14:12:50 +03:00
parent 129922e392
commit 80e407e6be
12 changed files with 349 additions and 105 deletions
+15 -3
View File
@@ -113,7 +113,7 @@ bool PDFController::exportPerechenToPdf(const QString &filePath, MainController
int pageNumber = 1;
// Вычисляем общее количество страниц заранее
int totalPages = 2;
int totalPages = 1;
int tempRow = 0;
while (tempRow < totalRows) {
int rowsOnThisPage = (totalPages == 1) ? rowsOnFirstPage : rowsOnOtherPages;
@@ -988,7 +988,18 @@ painter.drawText(mainTableRect.left()+165*mmToPixels, mainTableRect.top()+20*mmT
painter.drawText(60*mmToPixels,0, 60*mmToPixels, 5*mmToPixels, Qt::AlignCenter,"Перв. примен.");
painter.drawText(0,5*mmToPixels, 60*mmToPixels, 7*mmToPixels, Qt::AlignCenter, getInscriptionValueWithProjectParams(model, projectParamModel, 24));
painter.drawText(60*mmToPixels,5*mmToPixels, 60*mmToPixels, 7*mmToPixels, Qt::AlignCenter, getInscriptionValueWithProjectParams(model, projectParamModel, 25));
// Определяем номер поля "Первичное применение" в зависимости от типа документа
int primaryApplicationField = 25; // По умолчанию
if (docType == 1) {
primaryApplicationField = 251; // Перечень
} else if (docType == 2) {
primaryApplicationField = 252; // Спецификация ПП
} else if (docType == 3) {
primaryApplicationField = 253; // Спецификация материалов
} else if (docType == 4) {
primaryApplicationField = 254; // Ведомость
}
painter.drawText(60*mmToPixels,5*mmToPixels, 60*mmToPixels, 7*mmToPixels, Qt::AlignCenter, getInscriptionValueWithProjectParams(model, projectParamModel, primaryApplicationField));
painter.restore();
@@ -1351,7 +1362,8 @@ bool PDFController::addGostFrameA3FirstPage(QPainter &painter, const QRectF &pag
painter.drawText(60*mmToPixels,0, 60*mmToPixels, 5*mmToPixels, Qt::AlignCenter,"Перв. примен.");
painter.drawText(0,5*mmToPixels, 60*mmToPixels, 7*mmToPixels, Qt::AlignCenter, getInscriptionValueWithProjectParams(model, projectParamModel, 24));
painter.drawText(60*mmToPixels,5*mmToPixels, 60*mmToPixels, 7*mmToPixels, Qt::AlignCenter, getInscriptionValueWithProjectParams(model, projectParamModel, 25));
// A3 формат используется только для ведомости, поэтому используем поле 254
painter.drawText(60*mmToPixels,5*mmToPixels, 60*mmToPixels, 7*mmToPixels, Qt::AlignCenter, getInscriptionValueWithProjectParams(model, projectParamModel, 254));
painter.restore();