Skip to content

Commit ca021ea

Browse files
committed
Correct printing
1 parent 22af6e4 commit ca021ea

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

omodsim/formmodsim.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -404,24 +404,18 @@ void FormModSim::print(QPrinter* printer)
404404
const auto textTime = QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat);
405405
auto rcTime = painter.boundingRect(cx, cy, pageWidth, pageHeight, Qt::TextSingleLine, textTime);
406406

407-
const auto textDevId = QString(tr("Device Id: %1")).arg(ui->lineEditDeviceId->text());
408-
auto rcDevId = painter.boundingRect(cx, cy, pageWidth, pageHeight, Qt::TextSingleLine, textDevId);
409-
410-
const auto textAddrLen = QString(tr("Address: %1\nLength: %2")).arg(ui->lineEditAddress->text(), ui->lineEditLength->text());
407+
const auto textAddrLen = QString(tr("Address Base: %1\nStart Address: %2\nLength: %3")).arg(ui->comboBoxAddressBase->currentText(), ui->lineEditAddress->text(), ui->lineEditLength->text());
411408
auto rcAddrLen = painter.boundingRect(cx, cy, pageWidth, pageHeight, Qt::TextWordWrap, textAddrLen);
412409

413-
const auto textType = QString(tr("MODBUS Point Type:\n%1")).arg(ui->comboBoxModbusPointType->currentText());
414-
auto rcType = painter.boundingRect(cx, cy, pageWidth, pageHeight, Qt::TextWordWrap, textType);
410+
const auto textDevIdType = QString(tr("Device Id: %1\nMODBUS Point Type:\n%2")).arg(ui->lineEditDeviceId->text(), ui->comboBoxModbusPointType->currentText());
411+
auto rcDevIdType = painter.boundingRect(cx, cy, pageWidth, pageHeight, Qt::TextWordWrap, textDevIdType);
415412

416413
rcTime.moveTopRight({ pageRect.right(), 10 });
417-
rcDevId.moveLeft(rcAddrLen.right() + 40);
418-
rcAddrLen.moveTop(rcDevId.bottom() + 10);
419-
rcType.moveTopLeft({ rcDevId.left(), rcAddrLen.top() });
414+
rcDevIdType.moveTopLeft({ rcAddrLen.right() + 40, rcAddrLen.top()});
420415

421416
painter.drawText(rcTime, Qt::TextSingleLine, textTime);
422-
painter.drawText(rcDevId, Qt::TextSingleLine, textDevId);
423417
painter.drawText(rcAddrLen, Qt::TextWordWrap, textAddrLen);
424-
painter.drawText(rcType, Qt::TextWordWrap, textType);
418+
painter.drawText(rcDevIdType, Qt::TextWordWrap, textDevIdType);
425419

426420
auto rcOutput = pageRect;
427421
rcOutput.setTop(rcAddrLen.bottom() + 20);

0 commit comments

Comments
 (0)