Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Application/THP/thpwidgets/thp_pdf_widget.cpp
T
torsten 45eb8ee689 Add Lts/Application module with Qt6 CMakeLists updates
- Copy Lts/Application from qt5-before (AarApp, OpApp, THP submodules)
- Update all CMakeLists.txt to use Qt6::Core, Qt6::Widgets, Qt6::Xml, Qt6::Network, Qt6::PrintSupport, Qt6::Svg, Qt6::WebEngineCore, Qt6::WebEngineWidgets
- No SIGNAL/SLOT, QRegExp, QDesktopWidget, or QTextCodec issues found in Application source code
- Module ready for Qt6 build validation
2026-08-25 13:28:58 +02:00

68 lines
1.3 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Handle PDF output for thp
* $Id$
* $HeadURL$
* $Author$
*/
#include "thp_pdf_widget.h"
#include "ui_thp_pdf_widget.h"
namespace THP
{
PdfWidget::PdfWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::PdfWidget)
{
ui->setupUi(this);
connect(ui->previousPage, &QToolButton::clicked, this, &PdfWidget::onPreviousPage);
connect(ui->nextPage, &QToolButton::clicked, this, &PdfWidget::onNextPage);
connect(ui->pdfDocument, &NGL::PDFDocument::currentPageChanged, this, &PdfWidget::pageChanged);
}
PdfWidget::~PdfWidget()
{
delete ui;
}
bool PdfWidget::showPDF(const QUrl &pdf)
{
return ui->pdfDocument->showPDF(pdf);
}
void PdfWidget::setZoomFactor(double newZoomFactor)
{
ui->pdfDocument->setZoomFactor(newZoomFactor);
}
void PdfWidget::onPreviousPage()
{
ui->pdfDocument->previousPage();
}
void PdfWidget::onNextPage()
{
ui->pdfDocument->nextPage();
}
QVector<QImage> PdfWidget::getPrintableImages(int resolution)
{
return ui->pdfDocument->getPrintableImages(resolution);
}
void PdfWidget::resizePdfToWidth()
{
ui->pdfDocument->resizePdfToWidth();
}
void PdfWidget::pageChanged(int cur, int max)
{
ui->pageLabel->setText(tr("Page %1 of %2").arg(cur).arg(max));
ui->nextPage->setEnabled(cur < max);
ui->previousPage->setEnabled(cur > 1);
}
} // namespace THP