Merge remote-tracking branch 'remotes/origin/qt6_cmake'

This commit is contained in:
Jakub Melka 2022-10-18 19:00:40 +02:00
commit 3a5f7cdabe
224 changed files with 2601 additions and 3034 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.pro.user
*.qbs.user
*.txt.user

177
CMakeLists.txt Normal file
View File

@ -0,0 +1,177 @@
# Copyright (C) 2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.16)
set(PDF4QT_VERSION 1.2.2)
project(PDF4QT VERSION ${PDF4QT_VERSION} LANGUAGES CXX)
option(PDF4QT_INSTALL_DEPENDENCIES "Install dependencies" ON)
option(PDF4QT_INSTALL_QT_DEPENDENCIES "Install Qt dependencies" ON)
add_compile_definitions(PDF4QT_PROJECT_VERSION="${PDF4QT_VERSION}")
add_compile_definitions(QT_NO_EMIT)
if(WIN32 AND MSVC)
option(PDF4QT_INSTALL_MSVC_REDISTRIBUTABLE "Install MSVC redistributable package" ON)
option(PDF4QT_INSTALL_PREPARE_WIX_INSTALLER "Prepare Wix installer for Windows" ON)
endif()
set(PDF4QT_QT_ROOT "" CACHE PATH "Qt root directory")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Installation directory" FORCE)
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(GNUInstallDirs)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Svg Xml PrintSupport TextToSpeech OpenGL OpenGLWidgets Multimedia Network Test)
qt_standard_project_setup()
find_package(OpenSSL REQUIRED)
find_package(lcms REQUIRED)
find_package(ZLIB REQUIRED)
find_package(freetype CONFIG REQUIRED)
find_package(OpenJPEG CONFIG REQUIRED)
find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTORCC_OPTIONS "--threshold;0;--compress;9")
if (MSVC)
add_compile_options(/bigobj /W4 /wd5054 /wd4127 /wd4702)
endif()
if (MINGW)
add_compile_options("-Wa,-mbig-obj")
endif()
if (UNIX AND NOT APPLE AND CMAKE_COMPILER_IS_GNUCXX)
set(LINUX_GCC ON)
endif()
add_subdirectory(Pdf4QtLib)
add_subdirectory(CodeGenerator)
add_subdirectory(JBIG2_Viewer)
add_subdirectory(PdfExampleGenerator)
add_subdirectory(PdfTool)
add_subdirectory(UnitTests)
add_subdirectory(Pdf4QtViewer)
add_subdirectory(Pdf4QtViewerPlugins)
add_subdirectory(Pdf4QtViewerProfi)
add_subdirectory(Pdf4QtViewerLite)
add_subdirectory(Pdf4QtDocPageOrganizer)
add_subdirectory(Pdf4QtDocDiff)
add_subdirectory(WixInstaller)
message("CMAKE_PREFIX_PATH = " ${CMAKE_PREFIX_PATH})
message("CMAKE_TOOLCHAIN_FILE = " ${CMAKE_TOOLCHAIN_FILE})
if(PDF4QT_INSTALL_DEPENDENCIES)
install(DIRECTORY ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/
TYPE BIN
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.so"
PATTERN "*.dylib"
)
if("${PDF4QT_QT_ROOT}" STREQUAL "")
message(WARNING "Set variable PDF4QT_QT_ROOT to Qt6 root directory")
endif()
if(PDF4QT_INSTALL_QT_DEPENDENCIES)
install(DIRECTORY ${PDF4QT_QT_ROOT}/bin/
RUNTIME DESTINATION bin/
FILES_MATCHING
REGEX "(Qt6Core|Qt6Gui|Qt6PrintSupport|Qt6Svg|Qt6TextToSpeech|Qt6Widgets|Qt6Xml|Qt6OpenGL|Qt6OpenGLWidgets|Qt6Multimedia|Qt6Network)\\..*"
PATTERN "Debug" EXCLUDE
)
install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/platforms/
RUNTIME DESTINATION bin/platforms/
FILES_MATCHING
PATTERN "qwindows.dll"
PATTERN "*.so"
PATTERN "*.dylib"
)
install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/iconengines/
RUNTIME DESTINATION bin/iconengines/
FILES_MATCHING
REGEX "qsvgicon\\..*"
)
install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/imageformats/
RUNTIME DESTINATION bin/imageformats/
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.so"
PATTERN "*.dylib"
REGEX "d\\..*" EXCLUDE
)
install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/styles/
RUNTIME DESTINATION bin/styles/
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.so"
PATTERN "*.dylib"
REGEX "d\\..*" EXCLUDE
)
install(DIRECTORY ${PDF4QT_QT_ROOT}/plugins/texttospeech/
RUNTIME DESTINATION bin/texttospeech/
FILES_MATCHING
PATTERN "*.dll"
PATTERN "*.so"
PATTERN "*.dylib"
REGEX "d\\..*" EXCLUDE
)
endif()
if(WIN32 AND MSVC AND PDF4QT_INSTALL_MSVC_REDISTRIBUTABLE)
get_filename_component(MSVC_REDISTRIBUTABLES_PATH $ENV{VCToolsRedistDir}/$ENV{VSCMD_ARG_TGT_ARCH}/Microsoft.VC${MSVC_TOOLSET_VERSION}.CRT/ ABSOLUTE)
message(STATUS "MSVC Redistributable Package Path = ${MSVC_REDISTRIBUTABLES_PATH}")
install(DIRECTORY ${MSVC_REDISTRIBUTABLES_PATH}/
RUNTIME DESTINATION bin/
FILES_MATCHING
PATTERN "*.dll"
)
endif()
endif()
#macro(dump_variables)
# message(STATUS "dump_variables------------------------------------------{")
# get_cmake_property(_variableNames VARIABLES)
# foreach (_variableName ${_variableNames})
# message(STATUS "${_variableName}=${${_variableName}}")
# endforeach()
# message(STATUS "dump_variables------------------------------------------}")
#endmacro()
#
#dump_variables()

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2021 Jakub Melka
# Copyright (C) 2022 Jakub Melka
#
# This file is part of PDF4QT.
#
@ -15,25 +15,16 @@
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
QT += testlib
add_executable(CodeGenerator
codegenerator.cpp
main.cpp
generatormainwindow.cpp
generatormainwindow.ui
)
CONFIG += qt console warn_on depend_includepath testcase
CONFIG -= app_bundle
target_link_libraries(CodeGenerator PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6::Gui Qt6::Xml)
TEMPLATE = app
include(../Pdf4Qt.pri)
INCLUDEPATH += $$PWD/../Pdf4QtLib/Sources
DESTDIR = $$OUT_PWD/..
LIBS += -L$$OUT_PWD/..
LIBS += -lPdf4QtLib
SOURCES += \
tst_lexicalanalyzertest.cpp
target.path = $$DESTDIR/install
INSTALLS += target
set_target_properties(CodeGenerator PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)

View File

@ -1,49 +0,0 @@
# Copyright (C) 2018-2021 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
QT += core gui xml widgets
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
include(../Pdf4Qt.pri)
DESTDIR = $$OUT_PWD/..
LIBS += -L$$OUT_PWD/..
SOURCES += \
codegenerator.cpp \
main.cpp \
generatormainwindow.cpp
HEADERS += \
codegenerator.h \
generatormainwindow.h
FORMS += \
generatormainwindow.ui

View File

@ -1,9 +0,0 @@
Pdf4QtApp {
name: "CodeGenerator"
files: [
"*.cpp",
"*.h",
"*.ui",
]
Depends { name: "Qt"; submodules: ["xml"] }
}

View File

@ -86,8 +86,7 @@ void GeneratedCodeStorage::generateCode(QTextStream& stream, CodeGeneratorParame
QObject* Serializer::load(const QDomElement& element, QObject* parent)
{
QString className = element.attribute("class");
const int metaTypeId = QMetaType::type(className.toLatin1());
const QMetaObject* metaObject = QMetaType::metaObjectForType(metaTypeId);
const QMetaObject* metaObject = QMetaType::fromName(QByteArrayView(className.toLatin1())).metaObject();
if (metaObject)
{
@ -306,7 +305,7 @@ QString CodeGenerator::generateHeader(int indent) const
QByteArray ba;
{
QTextStream stream(&ba, QIODevice::WriteOnly);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream.setRealNumberPrecision(3);
stream.setRealNumberNotation(QTextStream::FixedNotation);
@ -324,7 +323,7 @@ QString CodeGenerator::generateSource(QString className, int indent) const
QByteArray ba;
{
QTextStream stream(&ba, QIODevice::WriteOnly);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream.setRealNumberPrecision(3);
stream.setRealNumberNotation(QTextStream::FixedNotation);
@ -1647,7 +1646,7 @@ QString XFACodeGenerator::generateSource() const
QByteArray ba;
{
QTextStream stream(&ba, QIODevice::WriteOnly);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream.setRealNumberPrecision(3);
stream.setRealNumberNotation(QTextStream::FixedNotation);
@ -1898,7 +1897,7 @@ QString XFACodeGenerator::generateHeader() const
QByteArray ba;
{
QTextStream stream(&ba, QIODevice::WriteOnly);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
stream.setRealNumberPrecision(3);
stream.setRealNumberNotation(QTextStream::FixedNotation);

View File

@ -73,7 +73,7 @@ void GeneratorMainWindow::load(const QString& fileName)
if (file.open(QFile::ReadOnly | QFile::Truncate))
{
QTextStream stream(&file);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
QDomDocument document;
document.setContent(stream.readAll());
@ -370,7 +370,7 @@ void GeneratorMainWindow::save(const QString& fileName)
if (file.open(QFile::WriteOnly | QFile::Truncate))
{
QTextStream stream(&file);
stream.setCodec("UTF-8");
stream.setEncoding(QStringConverter::Utf8);
QDomDocument document;
m_generator->store(document);

View File

@ -0,0 +1,29 @@
# Copyright (C) 2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
add_executable(JBIG2_VIEWER
mainwindow.ui
mainwindow.cpp
main.cpp
)
target_link_libraries(JBIG2_VIEWER PRIVATE Pdf4QtLib Qt6::Core Qt6::Widgets Qt6::Gui)
set_target_properties(JBIG2_VIEWER PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)

View File

@ -1,34 +0,0 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
include(../Pdf4Qt.pri)
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
DESTDIR = $$OUT_PWD/..
LIBS += -L$$OUT_PWD/..
LIBS += -lPDF4QtLib
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui

View File

@ -1,9 +0,0 @@
Pdf4QtApp {
name: "JBIG2_Viewer"
files: [
"*.cpp",
"*.h",
"*.ui",
]
Depends { name: "Qt"; submodules: ["widgets"] }
}

View File

@ -1,44 +0,0 @@
# Copyright (C) 2018-2021 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
TEMPLATE = subdirs
SUBDIRS += \
Pdf4QtLib \
CodeGenerator \
JBIG2_Viewer \
PdfExampleGenerator \
PdfTool \
UnitTests \
Pdf4QtViewer \
Pdf4QtViewerPlugins \
Pdf4QtViewerProfi \
Pdf4QtViewerLite \
Pdf4QtDocPageOrganizer \
Pdf4QtDocDiff
CodeGenerator.depends = Pdf4QtLib
JBIG2_Viewer.depends = Pdf4QtLib
PdfExampleGenerator.depends = Pdf4QtLib
PdfTool.depends = Pdf4QtLib
UnitTests.depends = Pdf4QtLib
Pdf4QtViewer.depends = Pdf4QtLib
Pdf4QtViewerPlugins.depends = Pdf4QtLib
Pdf4QtViewerProfi.depends = Pdf4QtViewer
Pdf4QtViewerLite.depends = Pdf4QtViewer
Pdf4QtDocPageOrganizer.depends = Pdf4QtLib
Pdf4QtDocDiff.depends = Pdf4QtLib

View File

@ -1,56 +0,0 @@
import qbs
import qbs.FileInfo
import qbs.Probes
Project {
name: "Pdf4Qt"
qbsSearchPaths: ["qbs"]
property string conanLibDirectory: FileInfo.joinPaths(conan.generatedFilesPath, "lib")
Probes.ConanfileProbe {
id: conan
conanfilePath: project.sourceDirectory + "/conanfile.txt"
generators: "qbs"
}
references: {
var ref = ["Pdf4QtLib/Pdf4QtLib.qbs",
"Pdf4QtViewer/Pdf4QtViewer.qbs",
"Pdf4QtViewerPlugins/AudioBookPlugin/AudioBookPlugin.qbs",
"Pdf4QtViewerPlugins/DimensionsPlugin/DimensionsPlugin.qbs",
"Pdf4QtViewerPlugins/OutputPreviewPlugin/OutputPreviewPlugin.qbs",
"Pdf4QtViewerPlugins/RedactPlugin/RedactPlugin.qbs",
"Pdf4QtViewerPlugins/SoftProofingPlugin/SoftProofingPlugin.qbs",
"Pdf4QtViewerPlugins/SignaturePlugin/SignaturePlugin.qbs",
];
ref.push(conan.generatedFilesPath + "/conanbuildinfo.qbs");
return ref;
}
SubProject {
filePath: "Pdf4QtViewerProfi/Pdf4QtViewerProfi.qbs"
}
SubProject {
filePath: "CodeGenerator/CodeGenerator.qbs"
}
SubProject {
filePath: "JBIG2_Viewer/JBIG2_Viewer.qbs"
}
SubProject {
filePath: "Pdf4QtDocPageOrganizer/Pdf4QtDocPageOrganizer.qbs"
}
SubProject {
filePath: "Pdf4QtViewerLite/Pdf4QtViewerLite.qbs"
}
SubProject {
filePath: "Pdf4QtDocDiff/Pdf4QtDocDiff.qbs"
}
SubProject {
filePath: "PdfExampleGenerator/PdfExampleGenerator.qbs"
}
SubProject {
filePath: "PdfTool/PdfTool.qbs"
}
SubProject {
filePath: "UnitTests/UnitTests.qbs"
}
}

View File

@ -0,0 +1,40 @@
# Copyright (C) 2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
add_executable(Pdf4QtDocDiff
aboutdialog.cpp
differencesdockwidget.cpp
main.cpp
mainwindow.cpp
settingsdockwidget.cpp
utils.cpp
aboutdialog.ui
differencesdockwidget.ui
mainwindow.ui
settingsdockwidget.ui
resources.qrc
icon.rc
)
target_link_libraries(Pdf4QtDocDiff PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets Qt6::OpenGLWidgets)
set_target_properties(Pdf4QtDocDiff PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)
install(TARGETS Pdf4QtDocDiff)

View File

@ -1,66 +0,0 @@
# Copyright (C) 2021-2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
QT += core gui widgets winextras
TARGET = Pdf4QtDocDiff
TEMPLATE = app
include(../Pdf4Qt.pri)
RC_ICONS = $$PWD/app-icon.ico
QMAKE_TARGET_DESCRIPTION = "PDF Document Diff"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2022"
DEFINES += QT_DEPRECATED_WARNINGS
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
DESTDIR = $$OUT_PWD/..
LIBS += -L$$OUT_PWD/..
LIBS += -lPDF4QtLib
CONFIG += force_debug_info no_check_exist
application.files = $$DESTDIR/Pdf4QtDocDiff.exe
application.path = $$DESTDIR/install
application.CONFIG += no_check_exist
INSTALLS += application
SOURCES += \
aboutdialog.cpp \
differencesdockwidget.cpp \
main.cpp \
mainwindow.cpp \
settingsdockwidget.cpp \
utils.cpp
FORMS += \
aboutdialog.ui \
differencesdockwidget.ui \
mainwindow.ui \
settingsdockwidget.ui
HEADERS += \
aboutdialog.h \
differencesdockwidget.h \
mainwindow.h \
settings.h \
settingsdockwidget.h \
utils.h
RESOURCES += \
resources.qrc

View File

@ -1,12 +0,0 @@
Pdf4QtApp {
name: "Pdf4QtDocDiff"
files: [
"*.cpp",
"*.h",
"*.ui",
"resources.qrc",
]
cpp.includePaths: ["."]
Depends { name: "Qt"; submodules: ["widgets"] }
Depends { name: "Qt.winextras"; condition: qbs.hostOS.contains("windows") }
}

1
Pdf4QtDocDiff/icon.rc Normal file
View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "app-icon.ico"

View File

@ -24,7 +24,6 @@
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
QApplication application(argc, argv);

View File

@ -30,12 +30,13 @@
#include "pdfdocumentwriter.h"
#include <QToolBar>
#include <QDesktopWidget>
#include <QDesktopServices>
#include <QMessageBox>
#include <QInputDialog>
#include <QFileDialog>
#include <QVBoxLayout>
#include <QActionGroup>
#include <QScreen>
namespace pdfdocdiff
{
@ -44,7 +45,7 @@ MainWindow::MainWindow(QWidget* parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_progress(new pdf::PDFProgress(this)),
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
m_taskbarButton(new QWinTaskbarButton(this)),
m_progressTaskbarIndicator(nullptr),
#endif
@ -64,7 +65,7 @@ MainWindow::MainWindow(QWidget* parent) :
setMinimumSize(pdf::PDFWidgetUtils::scaleDPI(this, QSize(800, 600)));
// Initialize task bar progress
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
m_progressTaskbarIndicator = m_taskbarButton->progress();
#endif
@ -190,7 +191,7 @@ MainWindow::~MainWindow()
void MainWindow::showEvent(QShowEvent* event)
{
Q_UNUSED(event);
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
m_taskbarButton->setWindow(windowHandle());
#endif
}
@ -311,7 +312,7 @@ void MainWindow::loadSettings()
QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
if (geometry.isEmpty())
{
QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
QRect availableGeometry = QApplication::primaryScreen()->availableGeometry();
QRect windowRect(0, 0, availableGeometry.width() / 2, availableGeometry.height() / 2);
windowRect = windowRect.translated(availableGeometry.center() - windowRect.center());
setGeometry(windowRect);
@ -845,7 +846,7 @@ std::optional<pdf::PDFDocument> MainWindow::openDocument()
void MainWindow::onProgressStarted(pdf::ProgressStartupInfo info)
{
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
m_progressTaskbarIndicator->setRange(0, 100);
m_progressTaskbarIndicator->reset();
m_progressTaskbarIndicator->show();
@ -862,7 +863,7 @@ void MainWindow::onProgressStep(int percentage)
}
pdf::PDFTemporaryValueChange guard(&m_isChangingProgressStep, true);
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
m_progressTaskbarIndicator->setValue(percentage);
#else
Q_UNUSED(percentage);
@ -871,7 +872,7 @@ void MainWindow::onProgressStep(int percentage)
void MainWindow::onProgressFinished()
{
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
m_progressTaskbarIndicator->hide();
#endif
}

View File

@ -27,7 +27,7 @@
#include <QMainWindow>
#include <QSignalMapper>
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
#include <QWinTaskbarButton>
#include <QWinTaskbarProgress>
#endif
@ -123,7 +123,7 @@ private:
Ui::MainWindow* ui;
pdf::PDFProgress* m_progress;
#ifdef Q_OS_WIN
#ifdef WIN_TASKBAR_BUTTON
QWinTaskbarButton* m_taskbarButton;
QWinTaskbarProgress* m_progressTaskbarIndicator;
#endif

View File

@ -143,7 +143,7 @@ void SettingsDockWidget::onEditColorChanged()
if (isChanged)
{
emit colorsChanged();
Q_EMIT colorsChanged();
}
}

View File

@ -301,7 +301,7 @@ void DifferencesDrawInterface::drawPage(QPainter* painter,
pdf::PDFInteger pageIndex,
const pdf::PDFPrecompiledPage* compiledPage,
pdf::PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<pdf::PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -490,7 +490,7 @@ void DifferencesDrawInterface::drawAnnotations(const pdf::PDFDocument* document,
}
void DifferencesDrawInterface::drawRectangle(QPainter* painter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const QRectF& rect,
QColor color) const
{
@ -501,7 +501,7 @@ void DifferencesDrawInterface::drawRectangle(QPainter* painter,
}
void DifferencesDrawInterface::drawMarker(QPainter* painter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const QRectF& rect,
QColor color,
bool isLeft) const

View File

@ -94,7 +94,7 @@ public:
virtual void drawPage(QPainter* painter, pdf::PDFInteger pageIndex,
const pdf::PDFPrecompiledPage* compiledPage,
pdf::PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<pdf::PDFRenderError>& errors) const override;
virtual void drawPostRendering(QPainter* painter, QRect rect) const override;
@ -106,12 +106,12 @@ public:
private:
void drawRectangle(QPainter* painter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const QRectF& rect,
QColor color) const;
void drawMarker(QPainter* painter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const QRectF& rect,
QColor color,
bool isLeft) const;

View File

@ -0,0 +1,41 @@
# Copyright (C) 2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
add_executable(Pdf4QtDocPageOrganizer
aboutdialog.cpp
assembleoutputsettingsdialog.cpp
main.cpp
mainwindow.cpp
pageitemdelegate.cpp
pageitemmodel.cpp
selectbookmarkstoregroupdialog.cpp
aboutdialog.ui
assembleoutputsettingsdialog.ui
mainwindow.ui
selectbookmarkstoregroupdialog.ui
resources.qrc
icon.rc
)
target_link_libraries(Pdf4QtDocPageOrganizer PRIVATE Pdf4QtLib Qt6::Core Qt6::Gui Qt6::Widgets)
set_target_properties(Pdf4QtDocPageOrganizer PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)
install(TARGETS Pdf4QtDocPageOrganizer)

View File

@ -1,67 +0,0 @@
# Copyright (C) 2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
QT += core gui widgets winextras
TARGET = Pdf4QtDocPageOrganizer
TEMPLATE = app
include(../Pdf4Qt.pri)
RC_ICONS = $$PWD/app-icon.ico
QMAKE_TARGET_DESCRIPTION = "PDF Document Page Organizer"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2022"
DEFINES += QT_DEPRECATED_WARNINGS
INCLUDEPATH += $$PWD/../PDF4QtLib/Sources
DESTDIR = $$OUT_PWD/..
LIBS += -L$$OUT_PWD/..
LIBS += -lPDF4QtLib
CONFIG += force_debug_info no_check_exist
application.files = $$DESTDIR/Pdf4QtDocPageOrganizer.exe
application.path = $$DESTDIR/install
application.CONFIG += no_check_exist
INSTALLS += application
SOURCES += \
aboutdialog.cpp \
assembleoutputsettingsdialog.cpp \
main.cpp \
mainwindow.cpp \
pageitemdelegate.cpp \
pageitemmodel.cpp \
selectbookmarkstoregroupdialog.cpp
FORMS += \
aboutdialog.ui \
assembleoutputsettingsdialog.ui \
mainwindow.ui \
selectbookmarkstoregroupdialog.ui
HEADERS += \
aboutdialog.h \
assembleoutputsettingsdialog.h \
mainwindow.h \
pageitemdelegate.h \
pageitemmodel.h \
selectbookmarkstoregroupdialog.h
RESOURCES += \
resources.qrc

View File

@ -1,11 +0,0 @@
Pdf4QtApp {
name: "Pdf4QtDocPageOrganizer"
files: [
"*.cpp",
"*.h",
"*.ui",
"resources.qrc",
]
cpp.includePaths: ["."]
Depends { name: "Qt"; submodules: ["widgets"] }
}

View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "app-icon.ico"

View File

@ -24,7 +24,6 @@
int main(int argc, char *argv[])
{
QApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents, true);
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
QApplication application(argc, argv);

View File

@ -30,7 +30,6 @@
#include <QFileDialog>
#include <QMessageBox>
#include <QInputDialog>
#include <QDesktopWidget>
#include <QClipboard>
#include <QToolBar>
#include <QDesktopServices>
@ -259,7 +258,7 @@ void MainWindow::loadSettings()
QByteArray geometry = settings.value("geometry", QByteArray()).toByteArray();
if (geometry.isEmpty())
{
QRect availableGeometry = QApplication::desktop()->availableGeometry(this);
QRect availableGeometry = QApplication::primaryScreen()->availableGeometry();
QRect windowRect(0, 0, availableGeometry.width() / 2, availableGeometry.height() / 2);
windowRect = windowRect.translated(availableGeometry.center() - windowRect.center());
setGeometry(windowRect);

View File

@ -95,7 +95,7 @@ void PageItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& opti
if (option.state.testFlag(QStyle::State_Selected))
{
QColor selectedColor = option.palette.color(QPalette::Active, QPalette::Highlight);
selectedColor.setAlphaF(0.3);
selectedColor.setAlphaF(0.3f);
painter->fillRect(rect, selectedColor);
}
@ -135,7 +135,7 @@ void PageItemDelegate::setPageImageSize(QSize pageImageSize)
if (m_pageImageSize != pageImageSize)
{
m_pageImageSize = pageImageSize;
emit sizeHintChanged(QModelIndex());
Q_EMIT sizeHintChanged(QModelIndex());
}
}
@ -211,7 +211,7 @@ QPixmap PageItemDelegate::getPageImagePixmap(const PageGroupItem* item, QRect re
QRect drawRect(QPoint(0, 0), rect.size());
QRect mediaBox(QPoint(0, 0), image.size());
QRectF rotatedMediaBox = pdf::PDFPage::getRotatedBox(mediaBox, groupItem.pageAdditionalRotation);
QMatrix matrix = pdf::PDFRenderer::createMediaBoxToDevicePointMatrix(rotatedMediaBox, drawRect, groupItem.pageAdditionalRotation);
QTransform matrix = pdf::PDFRenderer::createMediaBoxToDevicePointMatrix(rotatedMediaBox, drawRect, groupItem.pageAdditionalRotation);
QPainter painter(&pixmap);
painter.setWorldTransform(QTransform(matrix));

View File

@ -494,7 +494,7 @@ void PageItemModel::rotateLeft(const QModelIndexList& list)
rowMin = qMax(rowMin, 0);
rowMax = qMin(rowMax, rowCount(QModelIndex()) - 1);
emit dataChanged(index(rowMin, 0, QModelIndex()), index(rowMax, 0, QModelIndex()));
Q_EMIT dataChanged(index(rowMin, 0, QModelIndex()), index(rowMax, 0, QModelIndex()));
}
void PageItemModel::rotateRight(const QModelIndexList& list)
@ -523,7 +523,7 @@ void PageItemModel::rotateRight(const QModelIndexList& list)
rowMin = qMax(rowMin, 0);
rowMax = qMin(rowMax, rowCount(QModelIndex()) - 1);
emit dataChanged(index(rowMin, 0, QModelIndex()), index(rowMax, 0, QModelIndex()));
Q_EMIT dataChanged(index(rowMin, 0, QModelIndex()), index(rowMax, 0, QModelIndex()));
}
PageItemModel::SelectionInfo PageItemModel::getSelectionInfo(const QModelIndexList& list) const

134
Pdf4QtLib/CMakeLists.txt Normal file
View File

@ -0,0 +1,134 @@
# Copyright (C) 2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
add_library(Pdf4QtLib SHARED
sources/pdfaction.cpp
sources/pdfadvancedtools.cpp
sources/pdfalgorithmlcs.cpp
sources/pdfannotation.cpp
sources/pdfblendfunction.cpp
sources/pdfccittfaxdecoder.cpp
sources/pdfcertificatemanager.cpp
sources/pdfcertificatemanagerdialog.cpp
sources/pdfcms.cpp
sources/pdfcompiler.cpp
sources/pdfcreatecertificatedialog.cpp
sources/pdfdiff.cpp
sources/pdfdocumentbuilder.cpp
sources/pdfdocumentmanipulator.cpp
sources/pdfdocumenttextflow.cpp
sources/pdfdocumenttextfloweditormodel.cpp
sources/pdfdocumentwriter.cpp
sources/pdfexecutionpolicy.cpp
sources/pdffile.cpp
sources/pdfform.cpp
sources/pdficontheme.cpp
sources/pdfitemmodels.cpp
sources/pdfjavascriptscanner.cpp
sources/pdfjbig2decoder.cpp
sources/pdfmultimedia.cpp
sources/pdfobject.cpp
sources/pdfobjecteditormodel.cpp
sources/pdfobjecteditorwidget.cpp
sources/pdfobjectutils.cpp
sources/pdfoptimizer.cpp
sources/pdfoptionalcontent.cpp
sources/pdfoutline.cpp
sources/pdfpagecontenteditorstylesettings.cpp
sources/pdfpagecontenteditortools.cpp
sources/pdfpagecontenteditorwidget.cpp
sources/pdfpagecontentelements.cpp
sources/pdfpagenavigation.cpp
sources/pdfpagetransition.cpp
sources/pdfpainterutils.cpp
sources/pdfparser.cpp
sources/pdfdocument.cpp
sources/pdfdocumentreader.cpp
sources/pdfpattern.cpp
sources/pdfplugin.cpp
sources/pdfprogress.cpp
sources/pdfredact.cpp
sources/pdfsecurityhandler.cpp
sources/pdfselectpagesdialog.cpp
sources/pdfsignaturehandler.cpp
sources/pdfsnapper.cpp
sources/pdfstructuretree.cpp
sources/pdftexteditpseudowidget.cpp
sources/pdftextlayout.cpp
sources/pdftransparencyrenderer.cpp
sources/pdfutils.cpp
sources/pdfwidgettool.cpp
sources/pdfwidgetutils.cpp
sources/pdfxfaengine.cpp
sources/pdfxreftable.cpp
sources/pdfvisitor.cpp
sources/pdfencoding.cpp
sources/pdfcatalog.cpp
sources/pdfpage.cpp
sources/pdfstreamfilters.cpp
sources/pdfdrawspacecontroller.cpp
sources/pdfdrawwidget.cpp
sources/pdfcolorspaces.cpp
sources/pdfrenderer.cpp
sources/pdfpagecontentprocessor.cpp
sources/pdfpainter.cpp
sources/pdfrenderingerrorswidget.cpp
sources/pdffunction.cpp
sources/pdfnametounicode.cpp
sources/pdffont.cpp
sources/pdfimage.cpp
sources/pdfcertificatemanagerdialog.ui
sources/pdfcreatecertificatedialog.ui
sources/pdfpagecontenteditorstylesettings.ui
sources/pdfpagecontenteditorwidget.ui
sources/pdfrenderingerrorswidget.ui
sources/pdfselectpagesdialog.ui
sources/pdfobjecteditorwidget_impl.h
cmaps.qrc
)
include(GenerateExportHeader)
GENERATE_EXPORT_HEADER(Pdf4QtLib
EXPORT_MACRO_NAME
PDF4QTLIBSHARED_EXPORT
EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR}/pdf4qtlib_export.h")
target_link_libraries(Pdf4QtLib PRIVATE Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Xml Qt6::Svg Qt6::OpenGLWidgets)
target_link_libraries(Pdf4QtLib PRIVATE lcms2::lcms2)
target_link_libraries(Pdf4QtLib PRIVATE OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(Pdf4QtLib PRIVATE ZLIB::ZLIB)
target_link_libraries(Pdf4QtLib PRIVATE freetype)
target_link_libraries(Pdf4QtLib PRIVATE openjp2)
target_link_libraries(Pdf4QtLib PRIVATE JPEG::JPEG)
if(LINUX_GCC)
target_link_libraries(Pdf4QtLib PRIVATE tbb)
endif()
if(MINGW)
target_link_libraries(Pdf4QtLib PRIVATE Secur32 Mscms Gdi32 User32 crypt32)
endif()
target_include_directories(Pdf4QtLib INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/sources)
target_include_directories(Pdf4QtLib PUBLIC ${CMAKE_BINARY_DIR}/${INSTALL_INCLUDEDIR})
set_target_properties(Pdf4QtLib PROPERTIES
VERSION ${PDF4QT_VERSION}
SOVERSION ${PDF4QT_VERSION})
install(TARGETS Pdf4QtLib)

View File

@ -1,338 +0,0 @@
# Copyright (C) 2018-2022 Jakub Melka
#
# This file is part of PDF4QT.
#
# PDF4QT is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# with the written consent of the copyright owner, any later version.
#
# PDF4QT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
QT += gui widgets xml svg
TARGET = Pdf4QtLib
TEMPLATE = lib
include(../Pdf4Qt.pri)
QMAKE_TARGET_DESCRIPTION = "PDF rendering / editing library for Qt"
QMAKE_TARGET_COPYRIGHT = "(c) Jakub Melka 2018-2022"
DEFINES += PDF4QTLIB_LIBRARY
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
DESTDIR = $$OUT_PWD/..
SOURCES += \
sources/pdfaction.cpp \
sources/pdfadvancedtools.cpp \
sources/pdfalgorithmlcs.cpp \
sources/pdfannotation.cpp \
sources/pdfblendfunction.cpp \
sources/pdfccittfaxdecoder.cpp \
sources/pdfcertificatemanager.cpp \
sources/pdfcertificatemanagerdialog.cpp \
sources/pdfcms.cpp \
sources/pdfcompiler.cpp \
sources/pdfcreatecertificatedialog.cpp \
sources/pdfdiff.cpp \
sources/pdfdocumentbuilder.cpp \
sources/pdfdocumentmanipulator.cpp \
sources/pdfdocumenttextflow.cpp \
sources/pdfdocumenttextfloweditormodel.cpp \
sources/pdfdocumentwriter.cpp \
sources/pdfexecutionpolicy.cpp \
sources/pdffile.cpp \
sources/pdfform.cpp \
sources/pdficontheme.cpp \
sources/pdfitemmodels.cpp \
sources/pdfjavascriptscanner.cpp \
sources/pdfjbig2decoder.cpp \
sources/pdfmultimedia.cpp \
sources/pdfobject.cpp \
sources/pdfobjecteditormodel.cpp \
sources/pdfobjecteditorwidget.cpp \
sources/pdfobjectutils.cpp \
sources/pdfoptimizer.cpp \
sources/pdfoptionalcontent.cpp \
sources/pdfoutline.cpp \
sources/pdfpagecontenteditorstylesettings.cpp \
sources/pdfpagecontenteditortools.cpp \
sources/pdfpagecontenteditorwidget.cpp \
sources/pdfpagecontentelements.cpp \
sources/pdfpagenavigation.cpp \
sources/pdfpagetransition.cpp \
sources/pdfpainterutils.cpp \
sources/pdfparser.cpp \
sources/pdfdocument.cpp \
sources/pdfdocumentreader.cpp \
sources/pdfpattern.cpp \
sources/pdfplugin.cpp \
sources/pdfprogress.cpp \
sources/pdfredact.cpp \
sources/pdfsecurityhandler.cpp \
sources/pdfselectpagesdialog.cpp \
sources/pdfsignaturehandler.cpp \
sources/pdfsnapper.cpp \
sources/pdfstructuretree.cpp \
sources/pdftexteditpseudowidget.cpp \
sources/pdftextlayout.cpp \
sources/pdftransparencyrenderer.cpp \
sources/pdfutils.cpp \
sources/pdfwidgettool.cpp \
sources/pdfwidgetutils.cpp \
sources/pdfxfaengine.cpp \
sources/pdfxreftable.cpp \
sources/pdfvisitor.cpp \
sources/pdfencoding.cpp \
sources/pdfcatalog.cpp \
sources/pdfpage.cpp \
sources/pdfstreamfilters.cpp \
sources/pdfdrawspacecontroller.cpp \
sources/pdfdrawwidget.cpp \
sources/pdfcolorspaces.cpp \
sources/pdfrenderer.cpp \
sources/pdfpagecontentprocessor.cpp \
sources/pdfpainter.cpp \
sources/pdfrenderingerrorswidget.cpp \
sources/pdffunction.cpp \
sources/pdfnametounicode.cpp \
sources/pdffont.cpp \
sources/pdfimage.cpp
HEADERS += \
sources/pdfaction.h \
sources/pdfadvancedtools.h \
sources/pdfalgorithmlcs.h \
sources/pdfannotation.h \
sources/pdfblendfunction.h \
sources/pdfccittfaxdecoder.h \
sources/pdfcertificatemanager.h \
sources/pdfcertificatemanagerdialog.h \
sources/pdfcms.h \
sources/pdfcompiler.h \
sources/pdfcreatecertificatedialog.h \
sources/pdfdbgheap.h \
sources/pdfdiff.h \
sources/pdfdocumentbuilder.h \
sources/pdfdocumentdrawinterface.h \
sources/pdfdocumentmanipulator.h \
sources/pdfdocumenttextflow.h \
sources/pdfdocumenttextfloweditormodel.h \
sources/pdfdocumentwriter.h \
sources/pdfexecutionpolicy.h \
sources/pdffile.h \
sources/pdfform.h \
sources/pdficontheme.h \
sources/pdfitemmodels.h \
sources/pdfjavascriptscanner.h \
sources/pdfjbig2decoder.h \
sources/pdfmeshqualitysettings.h \
sources/pdfmultimedia.h \
sources/pdfnametreeloader.h \
sources/pdfobject.h \
sources/pdfobjecteditormodel.h \
sources/pdfobjecteditorwidget.h \
sources/pdfobjecteditorwidget_impl.h \
sources/pdfobjectutils.h \
sources/pdfoperationcontrol.h \
sources/pdfoptimizer.h \
sources/pdfoptionalcontent.h \
sources/pdfoutline.h \
sources/pdfpagecontenteditorstylesettings.h \
sources/pdfpagecontenteditortools.h \
sources/pdfpagecontenteditorwidget.h \
sources/pdfpagecontentelements.h \
sources/pdfpagenavigation.h \
sources/pdfpagetransition.h \
sources/pdfpainterutils.h \
sources/pdfparser.h \
sources/pdfglobal.h \
sources/pdfconstants.h \
sources/pdfdocument.h \
sources/pdfdocumentreader.h \
sources/pdfpattern.h \
sources/pdfplugin.h \
sources/pdfprogress.h \
sources/pdfredact.h \
sources/pdfsecurityhandler.h \
sources/pdfselectpagesdialog.h \
sources/pdfsignaturehandler.h \
sources/pdfsignaturehandler_impl.h \
sources/pdfsnapper.h \
sources/pdfstructuretree.h \
sources/pdftexteditpseudowidget.h \
sources/pdftextlayout.h \
sources/pdftransparencyrenderer.h \
sources/pdfwidgettool.h \
sources/pdfwidgetutils.h \
sources/pdfxfaengine.h \
sources/pdfxreftable.h \
sources/pdfflatmap.h \
sources/pdfvisitor.h \
sources/pdfencoding.h \
sources/pdfcatalog.h \
sources/pdfnumbertreeloader.h \
sources/pdfpage.h \
sources/pdfstreamfilters.h \
sources/pdfdrawspacecontroller.h \
sources/pdfdrawwidget.h \
sources/pdfflatarray.h \
sources/pdfcolorspaces.h \
sources/pdfrenderer.h \
sources/pdfpagecontentprocessor.h \
sources/pdfpainter.h \
sources/pdfutils.h \
sources/pdfrenderingerrorswidget.h \
sources/pdffunction.h \
sources/pdfnametounicode.h \
sources/pdffont.h \
sources/pdfexception.h \
sources/pdfimage.h
FORMS += \
sources/pdfcertificatemanagerdialog.ui \
sources/pdfcreatecertificatedialog.ui \
sources/pdfpagecontenteditorstylesettings.ui \
sources/pdfpagecontenteditorwidget.ui \
sources/pdfrenderingerrorswidget.ui \
sources/pdfselectpagesdialog.ui
RESOURCES += cmaps.qrc
Pdf4Qt_DEPENDENCIES_PATH = $$absolute_path(../../PdfforQt-Dependencies, $$PWD)
Pdf4Qt_OPENSSL_PATH = $$absolute_path(../../Tools, $$[QT_INSTALL_PREFIX])
CONFIG(debug, debug|release) {
SUFFIX = d
}
win32-msvc*: {
# Link to freetype library
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/FreeType/ -lfreetype$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/FreeType/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/FreeType/include
# Link to OpenJPEG library
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/OpenJPEG/lib/ -lopenjp2$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/OpenJPEG/include/openjpeg-2.3
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/OpenJPEG/include/openjpeg-2.3
DEFINES += OPJ_STATIC
# Link to Independent JPEG Groups libjpeg
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/libjpeg/bin/ -ljpeg$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/libjpeg/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/libjpeg/include
# Link OpenSSL
LIBS += -L$$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/bin -L$$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/lib -llibcrypto -llibssl
INCLUDEPATH += $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/include
DEPENDPATH += $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/include
# Add OpenSSL to installations
openssl_lib.files = $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/bin/libcrypto-1_1-x64.dll $$Pdf4Qt_OPENSSL_PATH/OpenSSL/Win_x64/bin/libssl-1_1-x64.dll
openssl_lib.path = $$DESTDIR/install
INSTALLS += openssl_lib
# Link zlib
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/zlib/bin/ -lzlibstatic$${SUFFIX}
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/zlib/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/zlib/include
# Link lcms2
LIBS += -L$$Pdf4Qt_DEPENDENCIES_PATH/lcms2/bin$${SUFFIX}/ -llcms2_static
INCLUDEPATH += $$Pdf4Qt_DEPENDENCIES_PATH/lcms2/include
DEPENDPATH += $$Pdf4Qt_DEPENDENCIES_PATH/lcms2/include
}
win32-*g++|unix: {
PKGCONFIG += freetype2 libopenjp2 libjpeg lcms2 libssl libcrypto zlib
LIBS += -ltbb
win32: {
LIBS += -lmscms -lcrypt32 -lsecur32
}
}
# ensure debug info even for RELEASE build
CONFIG += force_debug_info
QMAKE_RESOURCE_FLAGS += -threshold 0 -compress 9
PdfforQt_library.files = $$DESTDIR/Pdf4QtLib.dll
PdfforQt_library.path = $$DESTDIR/install
PdfforQt_library.CONFIG += no_check_exist
INSTALLS += PdfforQt_library
qt_libraries.files = $$[QT_INSTALL_BINS]/Qt?Widgets$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Gui$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Core$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?WinExtras$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Svg$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?PrintSupport$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?TextToSpeech$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Network$${SUFFIX}.dll \
$$[QT_INSTALL_BINS]/Qt?Xml$${SUFFIX}.dll
qt_libraries.path = $$DESTDIR/install
INSTALLS += qt_libraries
qt_plugin_platform.files = $$[QT_INSTALL_PLUGINS]/platforms/qwindows$${SUFFIX}.dll
qt_plugin_platform.path = $$DESTDIR/install/platforms
INSTALLS += qt_plugin_platform
qt_plugin_style.files = $$[QT_INSTALL_PLUGINS]/styles/qwindowsvistastyle$${SUFFIX}.dll
qt_plugin_style.path = $$DESTDIR/install/styles
INSTALLS += qt_plugin_style
qt_plugin_imageformat.files = $$[QT_INSTALL_PLUGINS]/imageformats/qgif$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qicns$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qico$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qjpeg$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qsvg$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qtga$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qtiff$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qwbpm$${SUFFIX}.dll \
$$[QT_INSTALL_PLUGINS]/imageformats/qwebp$${SUFFIX}.dll
qt_plugin_imageformat.path = $$DESTDIR/install/imageformats
INSTALLS += qt_plugin_imageformat
qt_plugin_iconengine.files = $$[QT_INSTALL_PLUGINS]/iconengines/qsvgicon$${SUFFIX}.dll
qt_plugin_iconengine.path = $$DESTDIR/install/iconengines
INSTALLS += qt_plugin_iconengine
qt_plugin_printsupport.files = $$[QT_INSTALL_PLUGINS]/printsupport/windowsprintersupport$${SUFFIX}.dll
qt_plugin_printsupport.path = $$DESTDIR/install/printsupport
INSTALLS += qt_plugin_printsupport
qt_plugin_texttospeech.files = $$[QT_INSTALL_PLUGINS]/texttospeech/qtexttospeech_sapi$${SUFFIX}.dll
qt_plugin_texttospeech.path = $$DESTDIR/install/texttospeech
INSTALLS += qt_plugin_texttospeech
VC_REDIST_FILES = $$files($$(VCToolsRedistDir)/$$(VSCMD_ARG_TGT_ARCH)/Microsoft.VC143.CRT/*.dll)
vc_redist.files = $$VC_REDIST_FILES
vc_redist.path = $$DESTDIR/install
INSTALLS += vc_redist
# Debug code for list of all variables and its values
#for(var, $$list($$enumerate_vars())) {
# value = $$eval($$var)
# message($$var = $$value)
#}

View File

@ -1,52 +0,0 @@
import qbs
Pdf4QtLibrary {
name: "Pdf4QtLib"
Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml", "svg"] }
Depends { name: "openssl" }
Depends { name: "freetype" }
Depends { name: "libjpeg" }
Depends { name: "openjpeg" }
Depends { name: "lcms" }
Depends {
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("mingw")
name: "tbb"
}
Depends {
condition: qbs.hostOS.contains("linux")
name: "fontconfig"
}
Properties {
condition: qbs.toolchain.contains("msvc") || qbs.toolchain.contains("clang")
cpp.cxxFlags: "/bigobj"
}
Properties {
condition: qbs.hostOS.contains("windows")
cpp.defines: "PDF4QTLIB_LIBRARY"
}
files: [
"sources/*.cpp",
"sources/*.h",
"sources/*.ui",
"cmaps.qrc",
]
Export {
Depends { name: "cpp" }
Depends { name: "Qt"; submodules: ["core", "gui", "widgets", "xml", "svg"] }
cpp.includePaths: ["sources"]
Depends { name: "openssl" }
Depends { name: "freetype" }
Depends { name: "libjpeg" }
Depends { name: "openjpeg" }
Depends { name: "lcms" }
Depends {
condition: qbs.toolchain.contains("gcc") && !qbs.toolchain.contains("mingw")
name: "tbb"
}
Depends {
condition: qbs.hostOS.contains("linux")
name: "fontconfig"
}
}
}

View File

@ -86,7 +86,7 @@ void PDFCreateStickyNoteTool::onPointPicked(PDFInteger pageIndex, QPointF pagePo
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -135,7 +135,7 @@ void PDFCreateHyperlinkTool::onRectanglePicked(PDFInteger pageIndex, QRectF page
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -170,7 +170,7 @@ void PDFCreateFreeTextTool::onRectanglePicked(PDFInteger pageIndex, QRectF pageR
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -206,7 +206,7 @@ PDFCreateLineTypeTool::PDFCreateLineTypeTool(PDFDrawWidgetProxy* proxy, PDFToolM
addTool(m_pickTool);
connect(m_pickTool, &PDFPickTool::pointPicked, this, &PDFCreateLineTypeTool::onPointPicked);
m_fillColor.setAlphaF(0.2);
m_fillColor.setAlphaF(0.2f);
updateActions();
}
@ -241,7 +241,7 @@ void PDFCreateLineTypeTool::finishDefinition()
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -268,7 +268,7 @@ void PDFCreateLineTypeTool::finishDefinition()
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -301,7 +301,7 @@ void PDFCreateLineTypeTool::finishDefinition()
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -416,7 +416,7 @@ void PDFCreateLineTypeTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(pageIndex);
@ -495,7 +495,7 @@ PDFCreateEllipseTool::PDFCreateEllipseTool(PDFDrawWidgetProxy* proxy, PDFToolMan
addTool(m_pickTool);
connect(m_pickTool, &PDFPickTool::rectanglePicked, this, &PDFCreateEllipseTool::onRectanglePicked);
m_fillColor.setAlphaF(0.2);
m_fillColor.setAlphaF(0.2f);
updateActions();
}
@ -534,7 +534,7 @@ void PDFCreateEllipseTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -594,7 +594,7 @@ void PDFCreateEllipseTool::onRectanglePicked(PDFInteger pageIndex, QRectF pageRe
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -614,7 +614,7 @@ void PDFCreateFreehandCurveTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -659,7 +659,7 @@ void PDFCreateFreehandCurveTool::mousePressEvent(QWidget* widget, QMouseEvent* e
resetTool();
}
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
void PDFCreateFreehandCurveTool::mouseReleaseEvent(QWidget* widget, QMouseEvent* event)
@ -695,7 +695,7 @@ void PDFCreateFreehandCurveTool::mouseReleaseEvent(QWidget* widget, QMouseEvent*
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -705,7 +705,7 @@ void PDFCreateFreehandCurveTool::mouseReleaseEvent(QWidget* widget, QMouseEvent*
resetTool();
}
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
void PDFCreateFreehandCurveTool::mouseMoveEvent(QWidget* widget, QMouseEvent* event)
@ -775,7 +775,7 @@ void PDFCreateStampTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -790,7 +790,7 @@ void PDFCreateStampTool::drawPage(QPainter* painter,
const PDFPage* page = getDocument()->getCatalog()->getPage(pageIndex);
QRectF rectangle = m_stampAnnotation.getRectangle();
QMatrix matrix = getProxy()->getAnnotationManager()->prepareTransformations(pagePointToDevicePointMatrix, painter->device(), m_stampAnnotation.getFlags(), page, rectangle);
QTransform matrix = getProxy()->getAnnotationManager()->prepareTransformations(pagePointToDevicePointMatrix, painter->device(), m_stampAnnotation.getFlags(), page, rectangle);
painter->setWorldTransform(QTransform(matrix), true);
AnnotationDrawParameters parameters;
@ -852,7 +852,7 @@ void PDFCreateStampTool::onPointPicked(PDFInteger pageIndex, QPointF pagePoint)
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -874,7 +874,7 @@ void PDFCreateHighlightTextTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -928,7 +928,7 @@ void PDFCreateHighlightTextTool::mouseReleaseEvent(QWidget* widget, QMouseEvent*
QPolygonF quadrilaterals;
PDFTextSelectionPainter textSelectionPainter(&m_textSelection);
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QMatrix(), &quadrilaterals);
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QTransform(), &quadrilaterals);
if (!path.isEmpty())
{
@ -965,7 +965,7 @@ void PDFCreateHighlightTextTool::mouseReleaseEvent(QWidget* widget, QMouseEvent*
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
@ -1063,7 +1063,7 @@ void PDFCreateHighlightTextTool::setSelection(PDFTextSelection&& textSelection)
if (m_textSelection != textSelection)
{
m_textSelection = qMove(textSelection);
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
@ -1096,7 +1096,7 @@ void PDFCreateRedactRectangleTool::onRectanglePicked(PDFInteger pageIndex, QRect
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
setActive(false);
@ -1114,7 +1114,7 @@ void PDFCreateRedactTextTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1168,7 +1168,7 @@ void PDFCreateRedactTextTool::mouseReleaseEvent(QWidget* widget, QMouseEvent* ev
QPolygonF quadrilaterals;
PDFTextSelectionPainter textSelectionPainter(&m_textSelection);
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QMatrix(), &quadrilaterals);
QPainterPath path = textSelectionPainter.prepareGeometry(pageIndex, textLayoutGetter, QTransform(), &quadrilaterals);
if (!path.isEmpty())
{
@ -1180,7 +1180,7 @@ void PDFCreateRedactTextTool::mouseReleaseEvent(QWidget* widget, QMouseEvent* ev
if (modifier.finalize())
{
emit m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT m_toolManager->documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}

View File

@ -131,7 +131,7 @@ public:
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
PDFReal getPenWidth() const;
@ -170,7 +170,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
PDFReal getPenWidth() const;
@ -205,7 +205,7 @@ public:
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
@ -243,7 +243,7 @@ public:
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual void mouseMoveEvent(QWidget* widget, QMouseEvent* event) override;
@ -283,7 +283,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
@ -347,7 +347,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;

View File

@ -772,7 +772,7 @@ PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObject
if (const PDFDictionary* fixedPrintDictionary = storage->getDictionaryFromObject(dictionary->get("FixedPrint")))
{
annotation->m_matrix = loader.readMatrixFromDictionary(fixedPrintDictionary, "Matrix", QMatrix());
annotation->m_matrix = loader.readMatrixFromDictionary(fixedPrintDictionary, "Matrix", QTransform());
annotation->m_relativeHorizontalOffset = loader.readNumberFromDictionary(fixedPrintDictionary, "H", 0.0);
annotation->m_relativeVerticalOffset = loader.readNumberFromDictionary(fixedPrintDictionary, "V", 0.0);
}
@ -1204,14 +1204,14 @@ PDFAnnotationManager::~PDFAnnotationManager()
}
QMatrix PDFAnnotationManager::prepareTransformations(const QMatrix& pagePointToDevicePointMatrix,
QTransform PDFAnnotationManager::prepareTransformations(const QTransform& pagePointToDevicePointMatrix,
QPaintDevice* device,
const PDFAnnotation::Flags annotationFlags,
const PDFPage* page,
QRectF& annotationRectangle) const
{
// "Unrotate" user coordinate space, if NoRotate flag is set
QMatrix userSpaceToDeviceSpace = pagePointToDevicePointMatrix;
QTransform userSpaceToDeviceSpace = pagePointToDevicePointMatrix;
if (annotationFlags.testFlag(PDFAnnotation::NoRotate))
{
PDFReal rotationAngle = 0.0;
@ -1237,12 +1237,12 @@ QMatrix PDFAnnotationManager::prepareTransformations(const QMatrix& pagePointToD
break;
}
QMatrix rotationMatrix;
QTransform rotationMatrix;
rotationMatrix.rotate(-rotationAngle);
QPointF topLeft = annotationRectangle.bottomLeft(); // Do not forget, that y is upward instead of Qt
QPointF difference = topLeft - rotationMatrix.map(topLeft);
QMatrix finalMatrix;
QTransform finalMatrix;
finalMatrix.translate(difference.x(), difference.y());
finalMatrix.rotate(-rotationAngle);
userSpaceToDeviceSpace = finalMatrix * userSpaceToDeviceSpace;
@ -1270,7 +1270,7 @@ QMatrix PDFAnnotationManager::prepareTransformations(const QMatrix& pagePointToD
void PDFAnnotationManager::drawWidgetAnnotationHighlight(QRectF annotationRectangle,
const PDFAnnotation* annotation,
QPainter* painter,
QMatrix userSpaceToDeviceSpace) const
QTransform userSpaceToDeviceSpace) const
{
const bool isWidget = annotation->getType() == AnnotationType::Widget;
if (m_formManager && isWidget)
@ -1309,7 +1309,7 @@ void PDFAnnotationManager::drawWidgetAnnotationHighlight(QRectF annotationRectan
if (color.isValid())
{
color.setAlphaF(0.2);
color.setAlphaF(0.2f);
// Draw annotation rectangle by highlight color
QPainterPath highlightArea;
@ -1325,7 +1325,7 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1387,7 +1387,7 @@ void PDFAnnotationManager::drawPage(QPainter* painter,
}
void PDFAnnotationManager::drawAnnotation(const PageAnnotation& annotation,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFCMS* cms,
bool isEditorDrawEnabled,
@ -1448,7 +1448,7 @@ bool PDFAnnotationManager::isAnnotationDrawnByEditor(const PageAnnotation& annot
}
void PDFAnnotationManager::drawAnnotationDirect(const PageAnnotation& annotation,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFCMS* cms,
bool isEditorDrawEnabled,
@ -1495,7 +1495,7 @@ void PDFAnnotationManager::drawAnnotationDirect(const PageAnnotation& annotation
void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotation& annotation,
const PDFObject& appearanceStreamObject,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFCMS* cms,
QPainter* painter) const
@ -1507,7 +1507,7 @@ void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotat
const PDFAnnotation::Flags annotationFlags = annotation.annotation->getEffectiveFlags();
QRectF annotationRectangle = annotation.annotation->getRectangle();
QRectF formBoundingBox = loader.readRectangle(formDictionary->get("BBox"), QRectF());
QMatrix formMatrix = loader.readMatrixFromDictionary(formDictionary, "Matrix", QMatrix());
QTransform formMatrix = loader.readMatrixFromDictionary(formDictionary, "Matrix", QTransform());
QByteArray content = m_document->getDecodedStream(formStream);
PDFObject resources = m_document->getObject(formDictionary->get("Resources"));
PDFObject transparencyGroup = m_document->getObject(formDictionary->get("Group"));
@ -1519,7 +1519,7 @@ void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotat
return;
}
QMatrix userSpaceToDeviceSpace = prepareTransformations(pagePointToDevicePointMatrix, painter->device(), annotationFlags, page, annotationRectangle);
QTransform userSpaceToDeviceSpace = prepareTransformations(pagePointToDevicePointMatrix, painter->device(), annotationFlags, page, annotationRectangle);
PDFRenderer::Features features = m_features;
if (annotationFlags.testFlag(PDFAnnotation::NoZoom))
@ -1540,10 +1540,10 @@ void PDFAnnotationManager::drawAnnotationUsingAppearanceStream(const PageAnnotat
const PDFReal scaleY = annotationRectangle.height() / transformedAppearanceBox.height();
const PDFReal translateX = annotationRectangle.left() - transformedAppearanceBox.left() * scaleX;
const PDFReal translateY = annotationRectangle.bottom() - transformedAppearanceBox.bottom() * scaleY;
QMatrix A(scaleX, 0.0, 0.0, scaleY, translateX, translateY);
QTransform A(scaleX, 0.0, 0.0, scaleY, translateX, translateY);
// Step 3) - compute final matrix AA
QMatrix AA = formMatrix * A;
QTransform AA = formMatrix * A;
bool isContentVisible = false;
@ -1872,7 +1872,7 @@ void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
const PDFAppeareanceStreams::Appearance oldAppearance = pageAnnotation.appearance;
QRectF annotationRect = pageAnnotation.annotation->getRectangle();
QMatrix matrix = prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
QTransform matrix = prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
QPainterPath path;
path.addRect(annotationRect);
path = matrix.map(path);
@ -1964,7 +1964,7 @@ void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
if (linkAction)
{
emit actionTriggered(linkAction);
Q_EMIT actionTriggered(linkAction);
}
}
}
@ -1987,7 +1987,7 @@ void PDFWidgetAnnotationManager::updateFromMouseEvent(QMouseEvent* event)
// If appearance has changed, then we must redraw the page
if (appearanceChanged)
{
emit widget->getDrawWidgetProxy()->repaintNeeded();
Q_EMIT widget->getDrawWidgetProxy()->repaintNeeded();
}
}
@ -2051,7 +2051,7 @@ void PDFWidgetAnnotationManager::onCopyAnnotation()
if (modifier.finalize())
{
emit documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
@ -2075,7 +2075,7 @@ void PDFWidgetAnnotationManager::onEditAnnotation()
if (modifier.finalize())
{
emit documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
@ -2091,7 +2091,7 @@ void PDFWidgetAnnotationManager::onDeleteAnnotation()
if (modifier.finalize())
{
emit documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
@ -2119,19 +2119,17 @@ void PDFWidgetAnnotationManager::createWidgetsForMarkupAnnotations(QWidget* pare
QVBoxLayout* layout = new QVBoxLayout(parentWidget);
layout->addWidget(scrollArea);
layout->setMargin(0);
layout->setContentsMargins(QMargins());
QWidget* frameWidget = new QWidget(scrollArea);
QVBoxLayout* frameLayout = new QVBoxLayout(frameWidget);
frameLayout->setMargin(0);
frameLayout->setSpacing(0);
scrollArea->setWidget(frameWidget);
const PDFMarkupAnnotation* markupMainAnnotation = pageAnnotation.annotation->asMarkupAnnotation();
QColor color = markupMainAnnotation->getDrawColorFromAnnotationColor(markupMainAnnotation->getColor(), 1.0);
QColor titleColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.2, 1.0);
QColor backgroundColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.9, 1.0);
QColor titleColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.2f, 1.0f);
QColor backgroundColor = QColor::fromHslF(color.hueF(), color.saturationF(), 0.9f, 1.0f);
QString style = "QGroupBox { "
"border: 2px solid black; "
@ -2333,7 +2331,7 @@ void PDFTextAnnotation::draw(AnnotationDrawParameters& parameters) const
QPainterPath textPath;
textPath.addText(0.0, 0.0, font, text);
textPath = QMatrix(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
textPath = QTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
QRectF textBoundingRect = textPath.boundingRect();
QPointF offset = rectangle.center() - textBoundingRect.center();
textPath.translate(offset);
@ -2566,8 +2564,8 @@ void PDFPolygonalGeometryAnnotation::draw(AnnotationDrawParameters& parameters)
boundingPath = m_path;
painter.drawPath(m_path);
QMatrix LCStoGCS_start = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.00), m_path.pointAtPercent(0.01))).LCStoGCS;
QMatrix LCStoGCS_end = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.99), m_path.pointAtPercent(1.00))).LCStoGCS;
QTransform LCStoGCS_start = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.00), m_path.pointAtPercent(0.01))).LCStoGCS;
QTransform LCStoGCS_end = LineGeometryInfo::create(QLineF(m_path.pointAtPercent(0.99), m_path.pointAtPercent(1.00))).LCStoGCS;
drawLineEnding(&painter, m_path.pointAtPercent(0), lineEndingSize, arrowAxisLength, getStartLineEnding(), false, LCStoGCS_start, boundingPath);
drawLineEnding(&painter, m_path.pointAtPercent(1), lineEndingSize, arrowAxisLength, getEndLineEnding(), true, LCStoGCS_end, boundingPath);
@ -2604,7 +2602,7 @@ PDFAnnotation::LineGeometryInfo PDFAnnotation::LineGeometryInfo::create(QLineF l
// Matrix LCStoGCS is local coordinate system of line line. It transforms
// points on the line to the global coordinate system. So, point (0, 0) will
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
result.LCStoGCS = QMatrix();
result.LCStoGCS = QTransform();
result.LCStoGCS.translate(p1.x(), p1.y());
result.LCStoGCS.rotate(angle);
result.GCStoLCS = result.LCStoGCS.inverted();
@ -2618,7 +2616,7 @@ void PDFAnnotation::drawLineEnding(QPainter* painter,
PDFReal arrowAxisLength,
AnnotationLineEnding ending,
bool flipAxis,
const QMatrix& LCStoGCS,
const QTransform& LCStoGCS,
QPainterPath& boundingPath) const
{
QPainterPath path;
@ -2714,7 +2712,7 @@ void PDFAnnotation::drawLineEnding(QPainter* painter,
// Flip the x-axis (we are drawing endpoint)
if (flipAxis && ending != AnnotationLineEnding::Slash)
{
QMatrix matrix;
QTransform matrix;
matrix.scale(-1.0, 1.0);
path = matrix.map(path);
}
@ -2779,7 +2777,7 @@ void PDFAnnotation::drawLine(const PDFAnnotation::LineGeometryInfo& info,
textVerticalOffset = fontMetrics.descent() + fontMetrics.leading();
textPath.addText(0, 0, font, text);
textPath = QMatrix(1, 0, 0, -1, 0, 0).map(textPath);
textPath = QTransform(1, 0, 0, -1, 0, 0).map(textPath);
}
drawLineEnding(&painter, info.transformedLine.p1(), lineEndingSize, arrowAxisLength, p1Ending, false, info.LCStoGCS, boundingPath);
@ -3340,7 +3338,7 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const
font.setPixelSize(textHeight);
QFontMetricsF fontMetrics(font, painter.device());
const qreal textWidth = fontMetrics.width(text);
const qreal textWidth = fontMetrics.horizontalAdvance(text);
const qreal rectangleWidth = textWidth + 10;
const qreal rectangleHeight = textHeight * 1.2;
const qreal penWidth = 2.0;
@ -3358,7 +3356,7 @@ void PDFStampAnnotation::draw(AnnotationDrawParameters& parameters) const
// Draw text
QPainterPath textPath;
textPath.addText(0, 0, font, text);
textPath = QMatrix(1, 0, 0, -1, 0, 0).map(textPath);
textPath = QTransform(1, 0, 0, -1, 0, 0).map(textPath);
QPointF center = textPath.boundingRect().center();
textPath.translate(rectangle.center() - center);
@ -3462,7 +3460,7 @@ void PDFAnnotation::drawCharacterSymbol(QString text, PDFReal opacity, Annotatio
QPainterPath textPath;
textPath.addText(0.0, 0.0, font, text);
textPath = QMatrix(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
textPath = QTransform(1.0, 0.0, 0.0, -1.0, 0.0, 0.0).map(textPath);
QRectF textBoundingRect = textPath.boundingRect();
QPointF offset = rectangle.center() - textBoundingRect.center();
textPath.translate(offset);

View File

@ -616,11 +616,11 @@ protected:
/// Matrix LCStoGCS is local coordinate system of line originalLine. It transforms
/// points on the line to the global coordinate system. So, point (0, 0) will
/// map onto p1 and point (originalLine.length(), 0) will map onto p2.
QMatrix LCStoGCS;
QTransform LCStoGCS;
/// Inverted matrix of LCStoGCS. It maps global coordinate system to local
/// coordinate system of the original line.
QMatrix GCStoLCS;
QTransform GCStoLCS;
static LineGeometryInfo create(QLineF line);
};
@ -652,7 +652,7 @@ protected:
PDFReal arrowAxisLength,
AnnotationLineEnding ending,
bool flipAxis,
const QMatrix& LCStoGCS,
const QTransform& LCStoGCS,
QPainterPath& boundingPath) const;
/// Draw line using given parameters and painter. Line is specified
@ -1326,14 +1326,14 @@ public:
virtual AnnotationType getType() const override { return AnnotationType::Watermark; }
const QMatrix& getMatrix() const { return m_matrix; }
const QTransform& getMatrix() const { return m_matrix; }
PDFReal getRelativeHorizontalOffset() const { return m_relativeHorizontalOffset; }
PDFReal getRelativeVerticalOffset() const { return m_relativeVerticalOffset; }
private:
friend PDFAnnotationPtr PDFAnnotation::parse(const PDFObjectStorage* storage, PDFObjectReference reference);
QMatrix m_matrix;
QTransform m_matrix;
PDFReal m_relativeHorizontalOffset = 0.0;
PDFReal m_relativeVerticalOffset = 0.0;
};
@ -1439,7 +1439,7 @@ class PDF4QTLIBSHARED_EXPORT PDFAnnotationManager : public QObject, public IDocu
private:
using BaseClass = QObject;
void drawWidgetAnnotationHighlight(QRectF annotationRectangle, PDFObjectReference annotationReference, QPainter* painter, QMatrix userSpaceToDeviceSpace) const;
void drawWidgetAnnotationHighlight(QRectF annotationRectangle, PDFObjectReference annotationReference, QPainter* painter, QTransform userSpaceToDeviceSpace) const;
public:
@ -1462,7 +1462,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
/// Set document
@ -1523,7 +1523,7 @@ public:
/// \param annotationFlags Annotation flags
/// \param page Page
/// \param[in,out] annotationRectangle Input/output annotation rectangle
QMatrix prepareTransformations(const QMatrix& pagePointToDevicePointMatrix,
QTransform prepareTransformations(const QTransform& pagePointToDevicePointMatrix,
QPaintDevice* device,
const PDFAnnotation::Flags annotationFlags,
const PDFPage* page,
@ -1553,7 +1553,7 @@ protected:
void drawWidgetAnnotationHighlight(QRectF annotationRectangle,
const PDFAnnotation* annotation,
QPainter* painter,
QMatrix userSpaceToDeviceSpace) const;
QTransform userSpaceToDeviceSpace) const;
/// Returns true, if given annotation should be drawn
/// \param annotation Annotation
@ -1572,7 +1572,7 @@ protected:
/// \param errors Errors list (where draw errors are stored)
/// \param painter Painter
void drawAnnotation(const PageAnnotation& annotation,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFCMS* cms,
bool isEditorDrawEnabled,
@ -1588,7 +1588,7 @@ protected:
/// \param isEditorDrawEnabled Is annotation drawn by form widget editor?
/// \param painter Painter
void drawAnnotationDirect(const PageAnnotation& annotation,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFCMS* cms,
bool isEditorDrawEnabled,
@ -1603,7 +1603,7 @@ protected:
/// \param painter Painter
void drawAnnotationUsingAppearanceStream(const PageAnnotation& annotation,
const PDFObject& appearanceStreamObject,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFCMS* cms,
QPainter* painter) const;

View File

@ -21,6 +21,16 @@
#include <QFile>
#include <QStandardPaths>
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
#include <openssl/bio.h>
#include <openssl/rsa.h>
#include <openssl/rsaerr.h>
@ -249,3 +259,11 @@ bool PDFSignatureFactory::sign(QString certificateName, QString password, QByteA
}
} // namespace pdf
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic pop
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(pop)
#endif

View File

@ -1398,7 +1398,7 @@ bool PDFCMSGeneric::transformColorSpace(const PDFCMS::ColorSpaceTransformParams&
PDFCMSManager::PDFCMSManager(QObject* parent) :
BaseClass(parent),
m_document(nullptr),
m_mutex(QMutex::Recursive)
m_mutex()
{
}
@ -1426,7 +1426,7 @@ void PDFCMSManager::setSettings(const PDFCMSSettings& settings)
clearCache();
}
emit colorManagementSystemChanged();
Q_EMIT colorManagementSystemChanged();
}
}
@ -1485,7 +1485,7 @@ PDFCMSSettings PDFCMSManager::getDefaultSettings() const
void PDFCMSManager::setDocument(const PDFDocument* document)
{
std::optional<QMutexLocker> lock;
std::optional<QMutexLocker<QRecursiveMutex>> lock;
lock.emplace(&m_mutex);
if (m_document == document)
@ -1571,7 +1571,7 @@ void PDFCMSManager::setDocument(const PDFDocument* document)
if (outputIntentProfilesChanged)
{
lock = std::nullopt;
emit colorManagementSystemChanged();
Q_EMIT colorManagementSystemChanged();
}
}

View File

@ -23,7 +23,7 @@
#include "pdfexception.h"
#include "pdfutils.h"
#include <QMutex>
#include <QRecursiveMutex>
#include <QSharedPointer>
#include <compare>
@ -415,7 +415,7 @@ private:
const PDFDocument* m_document;
PDFColorProfileIdentifiers m_outputIntentProfiles;
mutable QMutex m_mutex;
mutable QRecursiveMutex m_mutex;
mutable PDFCachedItem<PDFCMSPointer> m_CMS;
mutable PDFCachedItem<PDFColorProfileIdentifiers> m_outputProfiles;
mutable PDFCachedItem<PDFColorProfileIdentifiers> m_grayProfiles;

View File

@ -807,7 +807,7 @@ bool PDFAbstractColorSpace::transform(const PDFAbstractColorSpace* source,
Q_ASSERT(sourceIt + 1 != input.end());
Q_ASSERT(sourceIt + 2 != input.end());
PDFColorComponent LStar = qBound<PDFColorComponent>(0.0, interpolate(*sourceIt, 0.0, 1.0, 0.0, 100.0), 100.0);
PDFColorComponent LStar = qBound<PDFColorComponent>(PDFColorComponent(0.0), interpolate(*sourceIt, 0.0, 1.0, 0.0, 100.0), PDFColorComponent(100.0));
PDFColorComponent aStar = qBound<PDFColorComponent>(aMin, interpolate(*std::next(sourceIt, 1), 0.0, 1.0, aMin, aMax), aMax);
PDFColorComponent bStar = qBound<PDFColorComponent>(bMin, interpolate(*std::next(sourceIt, 2), 0.0, 1.0, bMin, bMax), bMax);
@ -1473,13 +1473,13 @@ QColor PDFLabColorSpace::getColor(const PDFColor& color, const PDFCMS* cms, Rend
if (isRange01)
{
LStar = qBound(0.0, interpolate(color[0], 0.0, 1.0, 0.0, 100.0), 100.0);
LStar = qBound<PDFColorComponent>(PDFColorComponent(0.0), interpolate(color[0], 0.0, 1.0, 0.0, 100.0), PDFColorComponent(100.0));
aStar = qBound<PDFColorComponent>(m_aMin, interpolate(color[1], 0.0, 1.0, m_aMin, m_aMax), m_aMax);
bStar = qBound<PDFColorComponent>(m_bMin, interpolate(color[2], 0.0, 1.0, m_bMin, m_bMax), m_bMax);
}
else
{
LStar = qBound<PDFColorComponent>(0.0, color[0], 100.0);
LStar = qBound<PDFColorComponent>(PDFColorComponent(0.0), color[0], PDFColorComponent(100.0));
aStar = qBound<PDFColorComponent>(m_aMin, color[1], m_aMax);
bStar = qBound<PDFColorComponent>(m_bMin, color[2], m_bMax);
}
@ -2052,7 +2052,7 @@ std::vector<PDFColorComponent> PDFIndexedColorSpace::transformColorsToBaseColorS
const int byteOffset = int(colorIndex * colorComponentCount);
// We must point into the array. Check first and last component.
Q_ASSERT(byteOffset + colorComponentCount - 1 < m_colors.size());
Q_ASSERT(byteOffset + colorComponentCount - 1 < static_cast<size_t>(m_colors.size()));
const char* bytePointer = m_colors.constData() + byteOffset;

View File

@ -457,7 +457,7 @@ public:
protected:
/// Clips the color component to range [0, 1]
static constexpr PDFColorComponent clip01(PDFColorComponent component) { return qBound<PDFColorComponent>(0.0, component, 1.0); }
static constexpr PDFColorComponent clip01(PDFColorComponent component) { return qBound<PDFColorComponent>(PDFColorComponent(0.0), component, PDFColorComponent(1.0)); }
/// Clips the color to range [0 1] in all components
static constexpr PDFColor3 clip01(const PDFColor3& color)

View File

@ -98,7 +98,7 @@ void PDFAsynchronousPageCompilerWorkerThread::run()
// we do not want to emit signals with locked mutexes.
// If direct connection is applied, this can lead to deadlock.
locker.unlock();
emit pageCompiled();
Q_EMIT pageCompiled();
locker.relock();
}
}
@ -311,13 +311,13 @@ void PDFAsynchronousPageCompiler::onPageCompiled()
for (const auto& error : errors)
{
emit renderingError(error.first, { error.second });
Q_EMIT renderingError(error.first, { error.second });
}
if (!compiledPages.empty())
{
Q_ASSERT(std::is_sorted(compiledPages.cbegin(), compiledPages.cend()));
emit pageImageChanged(false, compiledPages);
Q_EMIT pageImageChanged(false, compiledPages);
}
}
@ -473,7 +473,7 @@ PDFTextLayout PDFAsynchronousTextLayoutCompiler::createTextLayout(PDFInteger pag
m_proxy->getFontCache()->setCacheShrinkEnabled(&guard, false);
PDFCMSPointer cms = m_proxy->getCMSManager()->getCurrentCMS();
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QMatrix(), m_proxy->getMeshQualitySettings());
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QTransform(), m_proxy->getMeshQualitySettings());
generator.processContents();
result = generator.createTextLayout();
m_proxy->getFontCache()->setCacheShrinkEnabled(&guard, true);
@ -605,7 +605,7 @@ void PDFAsynchronousTextLayoutCompiler::makeTextLayout()
const PDFPage* page = catalog->getPage(pageIndex);
Q_ASSERT(page);
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QMatrix(), m_proxy->getMeshQualitySettings());
PDFTextLayoutGenerator generator(m_proxy->getFeatures(), page, m_proxy->getDocument(), m_proxy->getFontCache(), cms.data(), m_proxy->getOptionalContentActivity(), QTransform(), m_proxy->getMeshQualitySettings());
generator.processContents();
result.setTextLayout(pageIndex, generator.createTextLayout(), &mutex);
m_proxy->getProgress()->step();
@ -629,7 +629,7 @@ void PDFAsynchronousTextLayoutCompiler::onTextLayoutCreated()
m_textLayouts = m_textLayoutCompileFuture.result();
m_isRunning = false;
emit textLayoutChanged();
Q_EMIT textLayoutChanged();
}
} // namespace pdf

View File

@ -237,7 +237,7 @@ public:
const PDFFontCache* fontCache,
const PDFCMS* cms,
const PDFOptionalContentActivity* optionalContentActivity,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFMeshQualitySettings& meshQualitySettings) :
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, meshQualitySettings),
m_features(features)

View File

@ -24,12 +24,13 @@
namespace pdf
{
#define PDF4QT_STRINGIFY(x) PDF4QT_STRINGIFY_IMPL(x)
#define PDF4QT_STRINGIFY_IMPL(x) #x
#ifndef PDF4QT_PROJECT_VERSION
#define PDF4QT_PROJECT_VERSION "UNKNOWN"
#endif
// Name of the library, together with version
static constexpr const char* PDF_LIBRARY_NAME = "PDF4QT " PDF4QT_STRINGIFY(PDF4QT_PROJECT_VERSION);
static constexpr const char* PDF_LIBRARY_VERSION = PDF4QT_STRINGIFY(PDF4QT_PROJECT_VERSION);
static constexpr const char* PDF_LIBRARY_NAME = "PDF4QT " PDF4QT_PROJECT_VERSION;
static constexpr const char* PDF_LIBRARY_VERSION = PDF4QT_PROJECT_VERSION;
// Structure file constants
static constexpr const char* PDF_END_OF_FILE_MARK = "%%EOF";

View File

@ -143,7 +143,7 @@ void PDFDiff::start()
{
// Just do comparation immediately
m_result = perform();
emit comparationFinished();
Q_EMIT comparationFinished();
}
}
@ -677,8 +677,11 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
const auto& aItem = a.left ? context.leftTextFlow : context.rightTextFlow;
const auto& bItem = b.left ? context.leftTextFlow : context.rightTextFlow;
QStringRef aText(&aItem.getItem(a.index)->text, a.charIndex, a.charCount);
QStringRef bText(&bItem.getItem(b.index)->text, b.charIndex, b.charCount);
QStringView aText(aItem.getItem(a.index)->text);
aText = aText.mid(a.charIndex, a.charCount);
QStringView bText(bItem.getItem(b.index)->text);
bText = bText.mid(b.charIndex, b.charCount);
return aText == bText;
};
@ -758,7 +761,10 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
const TextCompareItem& textCompareItem = leftItems[item.index1];
const auto& textFlow = textCompareItem.left ? context.leftTextFlow : context.rightTextFlow;
const PDFDocumentTextFlow::Item* textItem = textFlow.getItem(textCompareItem.index);
QStringRef text(&textItem->text, textCompareItem.charIndex, textCompareItem.charCount);
QStringView text(textItem->text);
text = text.mid(textCompareItem.charIndex, textCompareItem.charCount);
leftStrings << text.toString();
if (pageIndex1 == -1)
@ -783,7 +789,10 @@ void PDFDiff::performCompare(const std::vector<PDFDiffPageContext>& leftPrepared
const TextCompareItem& textCompareItem = rightItems[item.index2];
const auto& textFlow = textCompareItem.left ? context.leftTextFlow : context.rightTextFlow;
const PDFDocumentTextFlow::Item* textItem = textFlow.getItem(textCompareItem.index);
QStringRef text(&textItem->text, textCompareItem.charIndex, textCompareItem.charCount);
QStringView text(textItem->text);
text = text.mid(textCompareItem.charIndex, textCompareItem.charCount);
rightStrings << text.toString();
if (pageIndex2 == -1)
@ -874,7 +883,8 @@ void PDFDiff::finalizeGraphicsPieces(PDFDiffPageContext& context)
continue;
}
hasher.addData(reinterpret_cast<const char*>(info.hash.data()), int(info.hash.size()));
QByteArrayView view(reinterpret_cast<const char*>(info.hash.data()), info.hash.size());
hasher.addData(view);
}
QByteArray hash = hasher.result();
@ -888,7 +898,7 @@ void PDFDiff::onComparationPerformed()
{
m_cancelled = false;
m_result = m_future.result();
emit comparationFinished();
Q_EMIT comparationFinished();
}
PDFReal PDFDiff::calculateEpsilonForPage(const PDFPage* page) const
@ -1796,7 +1806,7 @@ void PDFDiffResultNavigator::setResult(const PDFDiffResult* diffResult)
if (m_diffResult != diffResult)
{
m_diffResult = diffResult;
emit selectionChanged(m_currentIndex);
Q_EMIT selectionChanged(m_currentIndex);
}
}
@ -1826,7 +1836,7 @@ void PDFDiffResultNavigator::goNext()
}
++m_currentIndex;
emit selectionChanged(m_currentIndex);
Q_EMIT selectionChanged(m_currentIndex);
}
void PDFDiffResultNavigator::goPrevious()
@ -1845,7 +1855,7 @@ void PDFDiffResultNavigator::goPrevious()
{
--m_currentIndex;
}
emit selectionChanged(m_currentIndex);
Q_EMIT selectionChanged(m_currentIndex);
}
void PDFDiffResultNavigator::update()
@ -1854,7 +1864,7 @@ void PDFDiffResultNavigator::update()
if (limit > 0 && m_currentIndex >= limit)
{
m_currentIndex = limit - 1;
emit selectionChanged(m_currentIndex);
Q_EMIT selectionChanged(m_currentIndex);
}
}
@ -1863,7 +1873,7 @@ void PDFDiffResultNavigator::select(size_t currentIndex)
if (currentIndex < getLimit() && m_currentIndex != currentIndex)
{
m_currentIndex = currentIndex;
emit selectionChanged(m_currentIndex);
Q_EMIT selectionChanged(m_currentIndex);
}
}

View File

@ -276,7 +276,7 @@ QRectF PDFDocumentDataLoaderDecorator::readRectangle(const PDFObject& object, co
return defaultValue;
}
QMatrix PDFDocumentDataLoaderDecorator::readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QMatrix defaultValue) const
QTransform PDFDocumentDataLoaderDecorator::readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QTransform defaultValue) const
{
if (dictionary->hasKey(key))
{
@ -286,7 +286,7 @@ QMatrix PDFDocumentDataLoaderDecorator::readMatrixFromDictionary(const PDFDictio
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Invalid number of matrix elements. Expected 6, actual %1.").arg(matrixNumbers.size()));
}
return QMatrix(matrixNumbers[0], matrixNumbers[1], matrixNumbers[2], matrixNumbers[3], matrixNumbers[4], matrixNumbers[5]);
return QTransform(matrixNumbers[0], matrixNumbers[1], matrixNumbers[2], matrixNumbers[3], matrixNumbers[4], matrixNumbers[5]);
}
return defaultValue;

View File

@ -25,7 +25,7 @@
#include <QtCore>
#include <QColor>
#include <QMatrix>
#include <QTransform>
#include <QDateTime>
#include <optional>
@ -257,7 +257,7 @@ public:
/// Tries to read matrix from the dictionary. If matrix entry is not present, default value is returned.
/// If it is present and invalid, exception is thrown.
QMatrix readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QMatrix defaultValue) const;
QTransform readMatrixFromDictionary(const PDFDictionary* dictionary, const char* key, QTransform defaultValue) const;
/// Tries to read array of real values from dictionary. If entry dictionary doesn't exist,
/// or error occurs, default value is returned.

View File

@ -505,7 +505,7 @@ PDFObject PDFObjectFactory::createTextString(QString textString)
{
QTextStream textStream(&ba, QIODevice::WriteOnly);
textStream.setCodec("UTF-16BE");
textStream.setEncoding(QStringConverter::Utf16BE);
textStream.setGenerateByteOrderMark(true);
textStream << textString;
}

View File

@ -51,7 +51,7 @@ public:
pdf::PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const;
/// Performs drawing of additional graphics after all pages are drawn onto the painter.

View File

@ -171,7 +171,7 @@ PDFInteger PDFDocumentReader::findXrefTableOffset(const QByteArray& buffer)
throw PDFException(tr("Start of object reference table not found."));
}
Q_ASSERT(startXRefPosition + std::strlen(PDF_START_OF_XREF_MARK) < buffer.size());
Q_ASSERT(startXRefPosition + std::strlen(PDF_START_OF_XREF_MARK) < static_cast<size_t>(buffer.size()));
PDFLexicalAnalyzer analyzer(buffer.constData() + startXRefPosition + std::strlen(PDF_START_OF_XREF_MARK), buffer.constData() + buffer.size());
const PDFLexicalAnalyzer::Token token = analyzer.fetch();
if (token.type != PDFLexicalAnalyzer::TokenType::Integer)

View File

@ -183,7 +183,7 @@ public:
const PDFFontCache* fontCache,
const PDFCMS* cms,
const PDFOptionalContentActivity* optionalContentActivity,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFMeshQualitySettings& meshQualitySettings,
const PDFStructureTree* tree,
const std::map<PDFObjectReference, const PDFStructureItem*>* mapping,
@ -245,7 +245,7 @@ void PDFStructureTreeTextContentProcessor::finishText()
if (trimmedText.size() < m_currentText.size())
{
// Fix character bounding boxes...
if (m_characterBoundingRects.size() == m_currentText.size())
if (m_characterBoundingRects.size() == static_cast<size_t>(m_currentText.size()))
{
std::vector<QRectF> boundingRects(std::next(m_characterBoundingRects.cbegin(), index), std::next(m_characterBoundingRects.cbegin(), index + trimmedText.length()));
m_characterBoundingRects = std::move(boundingRects);
@ -266,7 +266,7 @@ void PDFStructureTreeTextContentProcessor::finishText()
m_currentText = qMove(reversed);
std::reverse(m_characterBoundingRects.begin(), m_characterBoundingRects.end());
}
Q_ASSERT(m_currentText.size() == m_characterBoundingRects.size() || m_characterBoundingRects.empty());
Q_ASSERT(static_cast<size_t>(m_currentText.size()) == m_characterBoundingRects.size() || m_characterBoundingRects.empty());
m_textSequence.emplace_back(PDFStructureTreeTextItem::createText(std::move(m_currentText), m_pageIndex, m_currentBoundingBox, std::move(m_characterBoundingRects)));
}
m_currentText = QString();
@ -449,7 +449,7 @@ void PDFStructureTreeTextExtractor::perform(const std::vector<PDFInteger>& pageI
const PDFPage* page = catalog->getPage(pageIndex);
Q_ASSERT(page);
PDFStructureTreeTextContentProcessor processor(PDFRenderer::IgnoreOptionalContent, page, m_document, &fontCache, &cms, &oca, QMatrix(), mqs, m_tree, &mapping, m_options);
PDFStructureTreeTextContentProcessor processor(PDFRenderer::IgnoreOptionalContent, page, m_document, &fontCache, &cms, &oca, QTransform(), mqs, m_tree, &mapping, m_options);
QList<PDFRenderError> errors = processor.processContents();
QMutexLocker lock(&mutex);
@ -696,7 +696,7 @@ PDFDocumentTextFlow PDFDocumentTextFlowFactory::create(const PDFDocument* docume
const PDFPage* page = catalog->getPage(pageIndex);
Q_ASSERT(page);
PDFTextLayoutGenerator generator(PDFRenderer::IgnoreOptionalContent, page, document, &fontCache, &cms, &oca, QMatrix(), mqs);
PDFTextLayoutGenerator generator(PDFRenderer::IgnoreOptionalContent, page, document, &fontCache, &cms, &oca, QTransform(), mqs);
QList<PDFRenderError> errors = generator.processContents();
PDFTextLayout textLayout = generator.createTextLayout();
PDFTextFlows textFlows = PDFTextFlow::createTextFlows(textLayout, PDFTextFlow::FlowFlags(PDFTextFlow::SeparateBlocks) | PDFTextFlow::RemoveSoftHyphen, pageIndex);

View File

@ -251,7 +251,7 @@ void PDFDocumentTextFlowEditorModel::setSelectionActivated(bool activate)
m_editor->setSelectionActive(activate);
m_editor->deselect();
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
Q_EMIT dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
}
void PDFDocumentTextFlowEditorModel::selectByRectangle(QRectF rectangle)
@ -262,7 +262,7 @@ void PDFDocumentTextFlowEditorModel::selectByRectangle(QRectF rectangle)
}
m_editor->selectByRectangle(rectangle);
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
Q_EMIT dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
}
void PDFDocumentTextFlowEditorModel::selectByContainedText(QString text)
@ -273,7 +273,7 @@ void PDFDocumentTextFlowEditorModel::selectByContainedText(QString text)
}
m_editor->selectByContainedText(text);
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
Q_EMIT dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
}
void PDFDocumentTextFlowEditorModel::selectByRegularExpression(const QRegularExpression& expression)
@ -284,7 +284,7 @@ void PDFDocumentTextFlowEditorModel::selectByRegularExpression(const QRegularExp
}
m_editor->selectByRegularExpression(expression);
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
Q_EMIT dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
}
void PDFDocumentTextFlowEditorModel::selectByPageIndices(const PDFClosedIntervalSet& indices)
@ -295,7 +295,7 @@ void PDFDocumentTextFlowEditorModel::selectByPageIndices(const PDFClosedInterval
}
m_editor->selectByPageIndices(indices);
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
Q_EMIT dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
}
void PDFDocumentTextFlowEditorModel::restoreOriginalTexts()
@ -307,7 +307,7 @@ void PDFDocumentTextFlowEditorModel::restoreOriginalTexts()
m_editor->restoreOriginalTexts();
m_editor->deselect();
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
Q_EMIT dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
}
void PDFDocumentTextFlowEditorModel::moveSelectionUp()
@ -339,7 +339,7 @@ void PDFDocumentTextFlowEditorModel::notifyDataChanged()
return;
}
emit dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
Q_EMIT dataChanged(index(0, 0), index(rowCount(QModelIndex()) - 1, ColumnLast));
}
} // namespace pdf

View File

@ -432,7 +432,7 @@ void PDFDrawSpaceController::recalculate()
}
}
emit drawSpaceChanged();
Q_EMIT drawSpaceChanged();
}
void PDFDrawSpaceController::clear(bool emitSignal)
@ -442,7 +442,7 @@ void PDFDrawSpaceController::clear(bool emitSignal)
if (emitSignal)
{
emit drawSpaceChanged();
Q_EMIT drawSpaceChanged();
}
}
@ -676,12 +676,12 @@ void PDFDrawWidgetProxy::update()
}
}
emit drawSpaceChanged();
Q_EMIT drawSpaceChanged();
}
QMatrix PDFDrawWidgetProxy::createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const
QTransform PDFDrawWidgetProxy::createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const
{
QMatrix matrix;
QTransform matrix;
// We want to create transformation from unrotated rectangle
// to rotated page rectangle.
@ -788,7 +788,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
const PDFPage* page = m_controller->getDocument()->getCatalog()->getPage(item.pageIndex);
QTransform matrix = QTransform(createPagePointToDevicePointMatrix(page, placedRect)) * baseMatrix;
compiledPage->draw(painter, page->getCropBox(), matrix.toAffine(), features, groupInfo.transparency);
compiledPage->draw(painter, page->getCropBox(), matrix, features, groupInfo.transparency);
PDFTextLayoutGetter layoutGetter = m_textLayoutCompiler->getTextLayoutLazy(item.pageIndex);
// Draw text blocks/text lines, if it is enabled
@ -810,7 +810,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
QString blockNumber = QString::number(blockIndex++);
painter->drawPath(matrix.map(block.getBoundingBox()));
painter->drawText(matrix.map(block.getTopLeft()) - QPointF(fontMetrics.width(blockNumber), 0), blockNumber, Qt::TextSingleLine, 0);
painter->drawText(matrix.map(block.getTopLeft()) - QPointF(fontMetrics.horizontalAdvance(blockNumber), 0), blockNumber, Qt::TextSingleLine, 0);
}
painter->restore();
@ -835,7 +835,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
QString lineNumber = QString::number(lineIndex++);
painter->drawPath(matrix.map(line.getBoundingBox()));
painter->drawText(matrix.map(line.getTopLeft()) - QPointF(fontMetrics.width(lineNumber), 0), lineNumber, Qt::TextSingleLine, 0);
painter->drawText(matrix.map(line.getTopLeft()) - QPointF(fontMetrics.horizontalAdvance(lineNumber), 0), lineNumber, Qt::TextSingleLine, 0);
}
}
@ -848,7 +848,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
for (IDocumentDrawInterface* drawInterface : m_drawInterfaces)
{
painter->save();
drawInterface->drawPage(painter, item.pageIndex, compiledPage, layoutGetter, matrix.toAffine(), drawInterfaceErrors);
drawInterface->drawPage(painter, item.pageIndex, compiledPage, layoutGetter, matrix, drawInterfaceErrors);
painter->restore();
}
}
@ -893,7 +893,7 @@ void PDFDrawWidgetProxy::drawPages(QPainter* painter, QRect rect, PDFRenderer::F
{
errors.append(drawInterfaceErrors);
}
emit renderingError(item.pageIndex, qMove(errors));
Q_EMIT renderingError(item.pageIndex, qMove(errors));
}
}
}
@ -998,7 +998,7 @@ PDFInteger PDFDrawWidgetProxy::getPageUnderPoint(QPoint point, QPointF* pagePoin
if (pagePoint)
{
const PDFPage* page = m_controller->getDocument()->getCatalog()->getPage(item.pageIndex);
QMatrix matrix = createPagePointToDevicePointMatrix(page, placedRect).inverted();
QTransform matrix = createPagePointToDevicePointMatrix(page, placedRect).inverted();
*pagePoint = matrix.map(point);
}
@ -1268,7 +1268,7 @@ void PDFDrawWidgetProxy::setPageLayout(PageLayout pageLayout)
if (getPageLayout() != pageLayout)
{
m_controller->setPageLayout(pageLayout);
emit pageLayoutChanged();
Q_EMIT pageLayoutChanged();
}
}
@ -1277,7 +1277,7 @@ void PDFDrawWidgetProxy::setCustomPageLayout(PDFDrawSpaceController::LayoutItems
if (m_controller->getCustomLayout() != layoutItems)
{
m_controller->setCustomLayout(std::move(layoutItems));
emit pageLayoutChanged();
Q_EMIT pageLayoutChanged();
}
}
@ -1299,8 +1299,8 @@ void PDFDrawWidgetProxy::performPageCacheClear()
void PDFDrawWidgetProxy::onTextLayoutChanged()
{
emit repaintNeeded();
emit textLayoutChanged();
Q_EMIT repaintNeeded();
Q_EMIT textLayoutChanged();
}
bool PDFDrawWidgetProxy::isBlockMode() const
@ -1402,7 +1402,7 @@ void PDFDrawWidgetProxy::setHorizontalOffset(int value)
{
m_horizontalOffset = horizontalOffset;
updateHorizontalScrollbarFromOffset();
emit drawSpaceChanged();
Q_EMIT drawSpaceChanged();
}
}
@ -1414,7 +1414,7 @@ void PDFDrawWidgetProxy::setVerticalOffset(int value)
{
m_verticalOffset = verticalOffset;
updateVerticalScrollbarFromOffset();
emit drawSpaceChanged();
Q_EMIT drawSpaceChanged();
}
}
@ -1480,7 +1480,7 @@ void PDFDrawWidgetProxy::setFeatures(PDFRenderer::Features features)
m_features = features;
m_compiler->start();
m_textLayoutCompiler->start();
emit pageImageChanged(true, { });
Q_EMIT pageImageChanged(true, { });
}
}
@ -1491,7 +1491,7 @@ void PDFDrawWidgetProxy::setPreferredMeshResolutionRatio(PDFReal ratio)
m_compiler->stop(true);
m_meshQualitySettings.preferredMeshResolutionRatio = ratio;
m_compiler->start();
emit pageImageChanged(true, { });
Q_EMIT pageImageChanged(true, { });
}
}
@ -1502,7 +1502,7 @@ void PDFDrawWidgetProxy::setMinimalMeshResolutionRatio(PDFReal ratio)
m_compiler->stop(true);
m_meshQualitySettings.minimalMeshResolutionRatio = ratio;
m_compiler->start();
emit pageImageChanged(true, { });
Q_EMIT pageImageChanged(true, { });
}
}
@ -1513,28 +1513,28 @@ void PDFDrawWidgetProxy::setColorTolerance(PDFReal colorTolerance)
m_compiler->stop(true);
m_meshQualitySettings.tolerance = colorTolerance;
m_compiler->start();
emit pageImageChanged(true, { });
Q_EMIT pageImageChanged(true, { });
}
}
void PDFDrawWidgetProxy::onColorManagementSystemChanged()
{
m_compiler->reset();
emit pageImageChanged(true, { });
Q_EMIT pageImageChanged(true, { });
}
void PDFDrawWidgetProxy::onOptionalContentGroupStateChanged()
{
m_compiler->reset();
m_textLayoutCompiler->reset();
emit pageImageChanged(true, { });
Q_EMIT pageImageChanged(true, { });
}
void IDocumentDrawInterface::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(painter);

View File

@ -181,7 +181,7 @@ struct PDFWidgetSnapshot
{
PDFInteger pageIndex = -1; ///< Index of page
QRectF rect; ///< Page rectangle on viewport
QMatrix pageToDeviceMatrix; ///< Transforms page coordinates to widget coordinates
QTransform pageToDeviceMatrix; ///< Transforms page coordinates to widget coordinates
const PDFPrecompiledPage* compiledPage = nullptr; ///< Compiled page (can be nullptr)
};
@ -217,7 +217,7 @@ public:
/// from page's media box to the target rectangle.
/// \param page Page, for which we want to create matrix
/// \param rectangle Page rectangle, to which is page media box transformed
QMatrix createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const;
QTransform createPagePointToDevicePointMatrix(const PDFPage* page, const QRectF& rectangle) const;
/// Draws the actually visible pages on the painter using the rectangle.
/// Rectangle is space in the widget, which is used for painting the PDF.

View File

@ -28,6 +28,7 @@
#include <QKeyEvent>
#include <QApplication>
#include <QPixmapCache>
#include <QColorSpace>
namespace pdf
{
@ -52,7 +53,7 @@ PDFWidget::PDFWidget(const PDFCMSManager* cmsManager, RendererEngine engine, int
layout->addWidget(m_drawWidget->getWidget(), 0, 0);
layout->addWidget(m_horizontalScrollBar, 1, 0);
layout->addWidget(m_verticalScrollBar, 0, 1);
layout->setMargin(0);
layout->setContentsMargins(QMargins());
setLayout(layout);
setFocusProxy(m_drawWidget->getWidget());
@ -145,7 +146,7 @@ void PDFWidget::onRenderingError(PDFInteger pageIndex, const QList<PDFRenderErro
// Empty list of error should not be reported!
Q_ASSERT(!errors.empty());
m_pageRenderingErrors[pageIndex] = errors;
emit pageRenderingErrorsChanged(pageIndex, errors.size());
Q_EMIT pageRenderingErrorsChanged(pageIndex, errors.size());
}
void PDFWidget::onPageImageChanged(bool all, const std::vector<PDFInteger>& pages)
@ -566,7 +567,7 @@ PDFOpenGLDrawWidget::PDFOpenGLDrawWidget(PDFWidget* widget, int samplesCount, QW
QSurfaceFormat format = this->format();
format.setProfile(QSurfaceFormat::CoreProfile);
format.setSamples(samplesCount);
format.setColorSpace(QSurfaceFormat::sRGBColorSpace);
format.setColorSpace(QColorSpace(QColorSpace::SRgb));
format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
setFormat(format);
}

View File

@ -19,7 +19,7 @@
#include "pdfdbgheap.h"
#include <QTimeZone>
#include <QTextCodec>
#include <QStringDecoder>
#include <cctype>
#include <cstring>
@ -2233,9 +2233,9 @@ QString PDFEncoding::convertTextString(const QByteArray& stream)
QString PDFEncoding::convertFromUnicode(const QByteArray& stream)
{
const ushort* bytes = reinterpret_cast<const ushort*>(stream.data());
const char16_t* bytes = reinterpret_cast<const char16_t*>(stream.data());
const int sizeInChars = stream.size();
const int sizeSizeInUShorts = sizeInChars / sizeof(const ushort) * sizeof(char);
const size_t sizeSizeInUShorts = sizeInChars / sizeof(const ushort) * sizeof(char);
return QString::fromUtf16(bytes, sizeSizeInUShorts);
}
@ -2373,21 +2373,21 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
if (hasUnicodeLeadMarkings(stream))
{
QTextCodec::ConverterState state = { };
{
QTextCodec* codec = QTextCodec::codecForName("UTF-16BE");
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
if (state.invalidChars == 0)
QStringDecoder decoder(QStringDecoder::Utf16BE);
QString text = decoder.decode(stream);
if (!decoder.hasError())
{
return text;
}
}
{
QTextCodec* codec = QTextCodec::codecForName("UTF-16LE");
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
if (state.invalidChars == 0)
QStringDecoder decoder(QStringDecoder::Utf16LE);
QString text = decoder.decode(stream);
if (!decoder.hasError())
{
return text;
}
@ -2396,11 +2396,10 @@ QString PDFEncoding::convertSmartFromByteStringToUnicode(const QByteArray& strea
if (hasUTF8LeadMarkings(stream))
{
QTextCodec::ConverterState state = { };
QStringDecoder decoder(QStringDecoder::Utf8);
QString text = decoder.decode(stream);
QTextCodec* codec = QTextCodec::codecForName("UTF-8");
QString text = codec->toUnicode(stream.constData(), stream.length(), &state);
if (state.invalidChars == 0)
if (!decoder.hasError())
{
return text;
}

View File

@ -1554,7 +1554,7 @@ PDFFontPointer PDFFont::createFont(const PDFObject& object, const PDFDocument* d
{
throw PDFException(PDFTranslationContext::tr("Invalid Type 3 font matrix."));
}
QMatrix fontMatrix(fontMatrixValues[0], fontMatrixValues[1], fontMatrixValues[2], fontMatrixValues[3], fontMatrixValues[4], fontMatrixValues[5]);
QTransform fontMatrix(fontMatrixValues[0], fontMatrixValues[1], fontMatrixValues[2], fontMatrixValues[3], fontMatrixValues[4], fontMatrixValues[5]);
PDFObject charProcs = document->getObject(fontDictionary->get("CharProcs"));
if (!charProcs.isDictionary())
@ -2365,7 +2365,7 @@ PDFReal PDFType0Font::getGlyphAdvance(CID cid) const
PDFType3Font::PDFType3Font(FontDescriptor fontDescriptor,
int firstCharacterIndex,
int lastCharacterIndex,
QMatrix fontMatrix,
QTransform fontMatrix,
std::map<int, QByteArray>&& characterContentStreams,
std::vector<double>&& widths,
const PDFObject& resources,

View File

@ -23,7 +23,7 @@
#include "pdfobject.h"
#include <QFont>
#include <QMatrix>
#include <QTransform>
#include <QSharedPointer>
#include <set>
@ -563,7 +563,7 @@ public:
explicit PDFType3Font(FontDescriptor fontDescriptor,
int firstCharacterIndex,
int lastCharacterIndex,
QMatrix fontMatrix,
QTransform fontMatrix,
std::map<int, QByteArray>&& characterContentStreams,
std::vector<double>&& widths,
const PDFObject& resources,
@ -580,7 +580,7 @@ public:
/// is returned.
const QByteArray* getContentStream(int characterIndex) const;
const QMatrix& getFontMatrix() const { return m_fontMatrix; }
const QTransform& getFontMatrix() const { return m_fontMatrix; }
const PDFObject& getResources() const { return m_resources; }
const std::map<int, QByteArray>& getContentStreams() const { return m_characterContentStreams; }
@ -591,7 +591,7 @@ public:
private:
int m_firstCharacterIndex;
int m_lastCharacterIndex;
QMatrix m_fontMatrix;
QTransform m_fontMatrix;
std::map<int, QByteArray> m_characterContentStreams;
std::vector<double> m_widths;
PDFObject m_resources;

View File

@ -232,7 +232,7 @@ private:
bool hasContinuousSelection() const;
/// Creates transformation matrix, which transforms widget coordinates to page coordinates
QMatrix createListBoxTransformMatrix() const;
QTransform createListBoxTransformMatrix() const;
PDFFormField::FieldFlags m_flags;
@ -1202,7 +1202,7 @@ void PDFFormManager::setFormFieldValue(PDFFormField::SetValueParameters paramete
if (modifier.finalize())
{
emit documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
@ -1464,7 +1464,7 @@ PDFFormManager::MouseEventInfo PDFFormManager::getMouseEventInfo(QWidget* widget
{
annotationRect = pageAnnotation.annotation->getRectangle();
}
QMatrix widgetToDevice = m_annotationManager->prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
QTransform widgetToDevice = m_annotationManager->prepareTransformations(snapshotItem.pageToDeviceMatrix, widget, pageAnnotation.annotation->getEffectiveFlags(), m_document->getCatalog()->getPage(snapshotItem.pageIndex), annotationRect);
QPainterPath path;
path.addRect(annotationRect);
@ -1490,7 +1490,7 @@ const std::optional<QCursor>& PDFFormManager::getCursor() const
return m_mouseCursor;
}
void PDFFormManager::drawXFAForm(const QMatrix& pagePointToDevicePointMatrix,
void PDFFormManager::drawXFAForm(const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
QList<PDFRenderError>& errors,
QPainter* painter)
@ -1565,7 +1565,7 @@ void PDFFormManager::performPaging()
if (modifier.finalize())
{
emit documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
}
@ -1727,7 +1727,7 @@ void PDFFormManager::performResetAction(const PDFActionResetForm* action)
if (modifier.finalize())
{
emit documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
Q_EMIT documentModified(PDFModifiedDocument(modifier.getDocument(), nullptr, modifier.getFlags()));
}
}
@ -1967,11 +1967,11 @@ void PDFFormFieldPushButtonEditor::click()
{
if (const PDFAction* mousePressAction = m_formManager->getAction(PDFAnnotationAdditionalActions::MousePressed, getFormWidget()))
{
emit m_formManager->actionTriggered(mousePressAction);
Q_EMIT m_formManager->actionTriggered(mousePressAction);
}
else if (const PDFAction* defaultAction = m_formManager->getAction(PDFAnnotationAdditionalActions::Default, getFormWidget()))
{
emit m_formManager->actionTriggered(defaultAction);
Q_EMIT m_formManager->actionTriggered(defaultAction);
}
}
@ -2672,9 +2672,9 @@ void PDFListBoxPseudowidget::setAppearance(const PDFAnnotationDefaultAppearance&
initialize(font, fontColor, textAlignment, rect, options, topIndex, qMove(selection));
}
QMatrix PDFListBoxPseudowidget::createListBoxTransformMatrix() const
QTransform PDFListBoxPseudowidget::createListBoxTransformMatrix() const
{
QMatrix matrix;
QTransform matrix;
matrix.translate(m_widgetRect.left(), m_widgetRect.bottom());
matrix.scale(1.0, -1.0);
return matrix;
@ -2701,7 +2701,7 @@ void PDFListBoxPseudowidget::draw(AnnotationDrawParameters& parameters, bool edi
return color;
};
QMatrix matrix = createListBoxTransformMatrix();
QTransform matrix = createListBoxTransformMatrix();
QPainter* painter = parameters.painter;
@ -2869,8 +2869,8 @@ int PDFListBoxPseudowidget::getValidIndex(int index) const
int PDFListBoxPseudowidget::getIndexFromWidgetPosition(const QPointF& point) const
{
QMatrix widgetToPageMatrix = createListBoxTransformMatrix();
QMatrix pageToWidgetMatrix = widgetToPageMatrix.inverted();
QTransform widgetToPageMatrix = createListBoxTransformMatrix();
QTransform pageToWidgetMatrix = widgetToPageMatrix.inverted();
QPointF widgetPoint = pageToWidgetMatrix.map(point);
const qreal y = widgetPoint.y();

View File

@ -636,7 +636,7 @@ public:
QPointF mousePosition;
/// Matrix, which maps from device space to widget space
QMatrix deviceToWidget;
QTransform deviceToWidget;
/// Returns true, if mouse event info is valid, i.e.
/// mouse event occurs above some form field.
@ -682,7 +682,7 @@ public:
/// \param page Page
/// \param errors Error list (for reporting rendering errors)
/// \param painter Painter
void drawXFAForm(const QMatrix& pagePointToDevicePointMatrix,
void drawXFAForm(const QTransform& pagePointToDevicePointMatrix,
const PDFPage* page,
QList<PDFRenderError>& errors,
QPainter* painter);

View File

@ -25,11 +25,15 @@
#include <tuple>
#include <array>
#include <pdf4qtlib_export.h>
#if !defined(PDF4QTLIBSHARED_EXPORT)
#if defined(PDF4QTLIB_LIBRARY)
# define PDF4QTLIBSHARED_EXPORT Q_DECL_EXPORT
#else
# define PDF4QTLIBSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif
// Compiler detection
#if defined(_MSC_VER)

View File

@ -78,7 +78,7 @@ void PDFIconTheme::prepareTheme()
{
{
QTextStream stream(&file);
stream.setCodec("UTF8");
stream.setEncoding(QStringConverter::Utf8);
stream.setGenerateByteOrderMark(true);
for (const QString& text : infoList)
{

View File

@ -727,10 +727,10 @@ void PDFThumbnailsItemModel::setThumbnailsSize(int size)
{
if (m_thumbnailSize != size)
{
emit layoutAboutToBeChanged();
Q_EMIT layoutAboutToBeChanged();
m_thumbnailSize = size;
m_thumbnailCache.clear();
emit layoutChanged();
Q_EMIT layoutChanged();
}
}
@ -773,7 +773,7 @@ void PDFThumbnailsItemModel::onPageImageChanged(bool all, const std::vector<PDFI
if (all)
{
m_thumbnailCache.clear();
emit dataChanged(index(0, 0, QModelIndex()), index(rowCount(QModelIndex()) - 1, 0, QModelIndex()));
Q_EMIT dataChanged(index(0, 0, QModelIndex()), index(rowCount(QModelIndex()) - 1, 0, QModelIndex()));
}
else
{
@ -783,7 +783,7 @@ void PDFThumbnailsItemModel::onPageImageChanged(bool all, const std::vector<PDFI
if (pageIndex < rowCount)
{
m_thumbnailCache.remove(getKey(pageIndex));
emit dataChanged(index(pageIndex, 0, QModelIndex()), index(pageIndex, 0, QModelIndex()));
Q_EMIT dataChanged(index(pageIndex, 0, QModelIndex()), index(pageIndex, 0, QModelIndex()));
}
}
}

View File

@ -3915,7 +3915,7 @@ std::optional<int32_t> PDFJBIG2HuffmanDecoder::readSignedInteger()
}
else if (it->isLowValue())
{
return it->value - m_reader->read(32);
return it->value - int32_t(m_reader->read(32));
}
else if (it->rangeBitLength == 0)
{
@ -3923,7 +3923,7 @@ std::optional<int32_t> PDFJBIG2HuffmanDecoder::readSignedInteger()
}
else
{
return it->value + m_reader->read(it->rangeBitLength);
return it->value + int32_t(m_reader->read(it->rangeBitLength));
}
}
}

View File

@ -20,7 +20,7 @@
#include "pdfglobal.h"
#include <QMatrix>
#include <QTransform>
namespace pdf
{
@ -38,7 +38,7 @@ struct PDFMeshQualitySettings
/// Matrix, which transforms user space points (user space is target space of the shading)
/// to the device space of the paint device.
QMatrix userSpaceToDeviceSpaceMatrix;
QTransform userSpaceToDeviceSpaceMatrix;
/// Rectangle in device space coordinate system, onto which is area meshed.
QRectF deviceSpaceMeshingArea;

View File

@ -257,7 +257,7 @@ void PDFObjectEditorAbstractModel::setEditedObject(PDFObject object)
{
m_editedObject = qMove(object);
updateSelectorValues();
emit editedObjectChanged();
Q_EMIT editedObjectChanged();
}
}

View File

@ -544,7 +544,7 @@ PDFObjectEditorMappedComboBoxAdapter::PDFObjectEditorMappedComboBoxAdapter(QLabe
comboBox->addItem(item.name, item.flags);
}
connect(comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, attribute](){ emit commitRequested(attribute); });
connect(comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
PDFObject PDFObjectEditorMappedComboBoxAdapter::getValue() const
@ -604,7 +604,7 @@ PDFObjectEditorMappedLineEditAdapter::PDFObjectEditorMappedLineEditAdapter(QLabe
initLabel(label);
lineEdit->setClearButtonEnabled(true);
connect(lineEdit, &QLineEdit::editingFinished, this, [this, attribute](){ emit commitRequested(attribute); });
connect(lineEdit, &QLineEdit::editingFinished, this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
PDFObject PDFObjectEditorMappedLineEditAdapter::getValue() const
@ -645,7 +645,7 @@ PDFObjectEditorMappedTextBrowserAdapter::PDFObjectEditorMappedTextBrowserAdapter
textBrowser->setUndoRedoEnabled(true);
textBrowser->setTextInteractionFlags(Qt::TextEditorInteraction);
connect(textBrowser, &QTextBrowser::textChanged, this, [this, attribute](){ emit commitRequested(attribute); });
connect(textBrowser, &QTextBrowser::textChanged, this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
PDFObject PDFObjectEditorMappedTextBrowserAdapter::getValue() const
@ -721,7 +721,7 @@ PDFObjectEditorMappedDateTimeAdapter::PDFObjectEditorMappedDateTimeAdapter(QLabe
{
initLabel(label);
connect(dateTimeEdit, &QDateTimeEdit::editingFinished, this, [this, attribute](){ emit commitRequested(attribute); });
connect(dateTimeEdit, &QDateTimeEdit::editingFinished, this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
PDFObject PDFObjectEditorMappedDateTimeAdapter::getValue() const
@ -767,7 +767,7 @@ PDFObjectEditorMappedFlagsAdapter::PDFObjectEditorMappedFlagsAdapter(std::vector
for (const auto& item : m_flagCheckBoxes)
{
QCheckBox* checkBox = item.second;
connect(checkBox, &QCheckBox::clicked, this, [this, attribute](){ emit commitRequested(attribute); });
connect(checkBox, &QCheckBox::clicked, this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
}
@ -822,7 +822,7 @@ PDFObjectEditorMappedCheckBoxAdapter::PDFObjectEditorMappedCheckBoxAdapter(QLabe
m_checkBox(checkBox)
{
initLabel(label);
connect(checkBox, &QCheckBox::clicked, this, [this, attribute](){ emit commitRequested(attribute); });
connect(checkBox, &QCheckBox::clicked, this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
PDFObject PDFObjectEditorMappedCheckBoxAdapter::getValue() const
@ -858,7 +858,7 @@ PDFObjectEditorMappedDoubleAdapter::PDFObjectEditorMappedDoubleAdapter(QLabel* l
{
initLabel(label);
connect(spinBox, &QDoubleSpinBox::editingFinished, this, [this, attribute](){ emit commitRequested(attribute); });
connect(spinBox, &QDoubleSpinBox::editingFinished, this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
PDFObject PDFObjectEditorMappedDoubleAdapter::getValue() const
@ -904,7 +904,7 @@ PDFObjectEditorMappedColorAdapter::PDFObjectEditorMappedColorAdapter(QLabel* lab
comboBox->addItem(getIconForColor(color), colorName, color);
}
connect(comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, attribute](){ emit commitRequested(attribute); });
connect(comboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [this, attribute](){ Q_EMIT commitRequested(attribute); });
}
PDFObject PDFObjectEditorMappedColorAdapter::getValue() const

View File

@ -240,10 +240,10 @@ void PDFOptimizer::optimize()
int stage = 1;
emit optimizationStarted();
Q_EMIT optimizationStarted();
for (OptimizationFlags flags : stages)
{
emit optimizationProgress(tr("Stage %1").arg(stage++));
Q_EMIT optimizationProgress(tr("Stage %1").arg(stage++));
OptimizationFlags currentSteps = flags & m_flags;
int passIndex = 1;
@ -251,7 +251,7 @@ void PDFOptimizer::optimize()
bool pass = true;
while (pass)
{
emit optimizationProgress(tr("Pass %1").arg(passIndex++));
Q_EMIT optimizationProgress(tr("Pass %1").arg(passIndex++));
pass = false;
if (currentSteps.testFlag(DereferenceSimpleObjects))
@ -280,7 +280,7 @@ void PDFOptimizer::optimize()
}
}
}
emit optimizationFinished();
Q_EMIT optimizationFinished();
}
PDFOptimizer::OptimizationFlags PDFOptimizer::getFlags() const
@ -307,7 +307,7 @@ bool PDFOptimizer::performDereferenceSimpleObjects()
PDFExecutionPolicy::execute(PDFExecutionPolicy::Scope::Unknown, objects.begin(), objects.end(), processEntry);
m_storage.setObjects(qMove(objects));
emit optimizationProgress(tr("Simple objects dereferenced and embedded: %1").arg(counter));
Q_EMIT optimizationProgress(tr("Simple objects dereferenced and embedded: %1").arg(counter));
return false;
}
@ -326,7 +326,7 @@ bool PDFOptimizer::performRemoveNullObjects()
PDFExecutionPolicy::execute(PDFExecutionPolicy::Scope::Unknown, objects.begin(), objects.end(), processEntry);
m_storage.setObjects(qMove(objects));
emit optimizationProgress(tr("Null objects entries from dictionaries removed: %1").arg(counter));
Q_EMIT optimizationProgress(tr("Null objects entries from dictionaries removed: %1").arg(counter));
return false;
}
@ -351,7 +351,7 @@ bool PDFOptimizer::performRemoveUnusedObjects()
PDFExecutionPolicy::execute(PDFExecutionPolicy::Scope::Unknown, range.begin(), range.end(), processEntry);
m_storage.setObjects(qMove(objects));
emit optimizationProgress(tr("Unused objects removed: %1").arg(counter));
Q_EMIT optimizationProgress(tr("Unused objects removed: %1").arg(counter));
return counter > 0;
}
@ -415,7 +415,7 @@ bool PDFOptimizer::performMergeIdenticalObjects()
}
m_storage.setObjects(qMove(objects));
emit optimizationProgress(tr("Identical objects merged: %1").arg(counter));
Q_EMIT optimizationProgress(tr("Identical objects merged: %1").arg(counter));
return counter > 0;
}
@ -511,7 +511,7 @@ bool PDFOptimizer::performShrinkObjectStorage()
const size_t newObjectCount = objects.size();
m_storage.setObjects(qMove(objects));
emit optimizationProgress(tr("Object list shrinked by: %1").arg(objectCount - newObjectCount));
Q_EMIT optimizationProgress(tr("Object list shrinked by: %1").arg(objectCount - newObjectCount));
return false;
}
@ -561,7 +561,7 @@ bool PDFOptimizer::performRecompressFlateStreams()
PDFExecutionPolicy::execute(PDFExecutionPolicy::Scope::Unknown, objects.begin(), objects.end(), processEntry);
m_storage.setObjects(qMove(objects));
emit optimizationProgress(tr("Bytes saved by recompressing stream: %1").arg(bytesSaved));
Q_EMIT optimizationProgress(tr("Bytes saved by recompressing stream: %1").arg(bytesSaved));
return false;
}

View File

@ -407,7 +407,7 @@ void PDFOptionalContentActivity::setState(PDFObjectReference ocg, OCState state,
}
it->second = state;
emit optionalContentGroupStateChanged(ocg, state);
Q_EMIT optionalContentGroupStateChanged(ocg, state);
}
}

View File

@ -192,7 +192,7 @@ void PDFPageContentEditorStyleSettings::setPen(const QPen& pen, bool forceUpdate
setColorToComboBox(ui->penColorCombo, pen.color());
blockSignals(oldBlockSignals);
emit penChanged(m_pen);
Q_EMIT penChanged(m_pen);
}
}
@ -207,7 +207,7 @@ void PDFPageContentEditorStyleSettings::setBrush(const QBrush& brush, bool force
setColorToComboBox(ui->brushColorCombo, brush.color());
blockSignals(oldBlockSignals);
emit brushChanged(m_brush);
Q_EMIT brushChanged(m_brush);
}
}
@ -221,7 +221,7 @@ void PDFPageContentEditorStyleSettings::setFont(const QFont& font, bool forceUpd
ui->fontComboBox->setCurrentFont(m_font);
blockSignals(oldBlockSignals);
emit fontChanged(m_font);
Q_EMIT fontChanged(m_font);
}
}
@ -241,7 +241,7 @@ void PDFPageContentEditorStyleSettings::setFontAlignment(Qt::Alignment alignment
radioButton->setChecked(true);
blockSignals(oldBlockSignals);
emit alignmentChanged(m_alignment);
Q_EMIT alignmentChanged(m_alignment);
}
}
@ -252,7 +252,7 @@ void PDFPageContentEditorStyleSettings::setTextAngle(PDFReal angle, bool forceUp
const bool oldBlockSignals = blockSignals(true);
ui->textAngleEdit->setValue(angle);
blockSignals(oldBlockSignals);
emit textAngleChanged(ui->textAngleEdit->value());
Q_EMIT textAngleChanged(ui->textAngleEdit->value());
}
}
@ -371,7 +371,7 @@ void PDFPageContentEditorStyleSettings::onSelectFontButtonClicked()
{
m_font = font;
ui->fontComboBox->setCurrentFont(m_font);
emit fontChanged(m_font);
Q_EMIT fontChanged(m_font);
}
}
@ -381,7 +381,7 @@ void PDFPageContentEditorStyleSettings::setPenColor(QColor color)
{
m_pen.setColor(color);
setColorToComboBox(ui->penColorCombo, color);
emit penChanged(m_pen);
Q_EMIT penChanged(m_pen);
}
}
@ -397,7 +397,7 @@ void PDFPageContentEditorStyleSettings::setBrushColor(QColor color)
{
m_brush.setColor(color);
setColorToComboBox(ui->brushColorCombo, color);
emit brushChanged(m_brush);
Q_EMIT brushChanged(m_brush);
}
}
@ -437,13 +437,13 @@ void PDFPageContentEditorStyleSettings::onPenWidthChanged(double value)
if (m_pen.widthF() != value)
{
m_pen.setWidthF(value);
emit penChanged(m_pen);
Q_EMIT penChanged(m_pen);
}
}
void PDFPageContentEditorStyleSettings::onTextAngleChanged(double value)
{
emit textAngleChanged(value);
Q_EMIT textAngleChanged(value);
}
void PDFPageContentEditorStyleSettings::onAlignmentRadioButtonClicked(int alignment)
@ -452,7 +452,7 @@ void PDFPageContentEditorStyleSettings::onAlignmentRadioButtonClicked(int alignm
if (m_alignment != alignmentValue)
{
m_alignment = alignmentValue;
emit alignmentChanged(m_alignment);
Q_EMIT alignmentChanged(m_alignment);
}
}
@ -462,7 +462,7 @@ void PDFPageContentEditorStyleSettings::onPenStyleChanged()
if (m_pen.style() != penStyle)
{
m_pen.setStyle(penStyle);
emit penChanged(m_pen);
Q_EMIT penChanged(m_pen);
}
}
@ -472,7 +472,7 @@ void PDFPageContentEditorStyleSettings::onBrushStyleChanged()
if (m_brush.style() != brushStyle)
{
m_brush.setStyle(brushStyle);
emit brushChanged(m_brush);
Q_EMIT brushChanged(m_brush);
}
}
@ -486,7 +486,7 @@ void PDFPageContentEditorStyleSettings::onPenColorComboTextChanged()
if (m_pen.color() != color)
{
m_pen.setColor(color);
emit penChanged(m_pen);
Q_EMIT penChanged(m_pen);
}
}
else if (ui->penColorCombo->currentIndex() != -1)
@ -502,7 +502,7 @@ void PDFPageContentEditorStyleSettings::onPenColorComboIndexChanged()
if (color.isValid() && m_pen.color() != color)
{
m_pen.setColor(color);
emit penChanged(m_pen);
Q_EMIT penChanged(m_pen);
}
}
@ -516,7 +516,7 @@ void PDFPageContentEditorStyleSettings::onBrushColorComboTextChanged()
if (m_brush.color() != color)
{
m_brush.setColor(color);
emit brushChanged(m_brush);
Q_EMIT brushChanged(m_brush);
}
}
else if (ui->brushColorCombo->currentIndex() != -1)
@ -532,7 +532,7 @@ void PDFPageContentEditorStyleSettings::onBrushColorComboIndexChanged()
if (color.isValid() && m_brush.color() != color)
{
m_brush.setColor(color);
emit brushChanged(m_brush);
Q_EMIT brushChanged(m_brush);
}
}
@ -541,7 +541,7 @@ void PDFPageContentEditorStyleSettings::onFontChanged(const QFont& font)
if (m_font != font)
{
m_font = font;
emit fontChanged(m_font);
Q_EMIT fontChanged(m_font);
}
}

View File

@ -46,7 +46,7 @@ void PDFCreatePCElementTool::setPen(const QPen& pen)
if (PDFPageContentStyledElement* styledElement = dynamic_cast<PDFPageContentStyledElement*>(getElement()))
{
styledElement->setPen(pen);
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
@ -55,7 +55,7 @@ void PDFCreatePCElementTool::setBrush(const QBrush& brush)
if (PDFPageContentStyledElement* styledElement = dynamic_cast<PDFPageContentStyledElement*>(getElement()))
{
styledElement->setBrush(brush);
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
@ -64,7 +64,7 @@ void PDFCreatePCElementTool::setFont(const QFont& font)
if (PDFPageContentElementTextBox* textBoxElement = dynamic_cast<PDFPageContentElementTextBox*>(getElement()))
{
textBoxElement->setFont(font);
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
@ -73,7 +73,7 @@ void PDFCreatePCElementTool::setAlignment(Qt::Alignment alignment)
if (PDFPageContentElementTextBox* textBoxElement = dynamic_cast<PDFPageContentElementTextBox*>(getElement()))
{
textBoxElement->setAlignment(alignment);
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
@ -82,12 +82,12 @@ void PDFCreatePCElementTool::setTextAngle(PDFReal angle)
if (PDFPageContentElementTextBox* textBoxElement = dynamic_cast<PDFPageContentElementTextBox*>(getElement()))
{
textBoxElement->setAngle(angle);
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
QRectF PDFCreatePCElementTool::getRectangleFromPickTool(PDFPickTool* pickTool,
const QMatrix& pagePointToDevicePointMatrix)
const QTransform& pagePointToDevicePointMatrix)
{
const std::vector<QPointF>& points = pickTool->getPickedPoints();
if (points.empty())
@ -146,7 +146,7 @@ void PDFCreatePCElementRectangleTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -240,7 +240,7 @@ void PDFCreatePCElementLineTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -337,7 +337,7 @@ void PDFCreatePCElementImageTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -484,7 +484,7 @@ void PDFCreatePCElementDotTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -545,7 +545,7 @@ void PDFCreatePCElementFreehandCurveTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -590,7 +590,7 @@ void PDFCreatePCElementFreehandCurveTool::mousePressEvent(QWidget* widget, QMous
resetTool();
}
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
void PDFCreatePCElementFreehandCurveTool::mouseReleaseEvent(QWidget* widget, QMouseEvent* event)
@ -618,7 +618,7 @@ void PDFCreatePCElementFreehandCurveTool::mouseReleaseEvent(QWidget* widget, QMo
resetTool();
}
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
void PDFCreatePCElementFreehandCurveTool::mouseMoveEvent(QWidget* widget, QMouseEvent* event)
@ -636,7 +636,7 @@ void PDFCreatePCElementFreehandCurveTool::mouseMoveEvent(QWidget* widget, QMouse
m_element->addPoint(pagePoint);
}
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
@ -689,7 +689,7 @@ void PDFCreatePCElementTextTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -940,14 +940,14 @@ void PDFCreatePCElementTextTool::setFont(const QFont& font)
{
BaseClass::setFont(font);
m_textEditWidget->setAppearance(font, m_element->getAlignment(), m_element->getRectangle(), std::numeric_limits<int>::max(), m_element->getPen().color());
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
void PDFCreatePCElementTextTool::setAlignment(Qt::Alignment alignment)
{
BaseClass::setAlignment(alignment);
m_textEditWidget->setAppearance(m_element->getFont(), alignment, m_element->getRectangle(), std::numeric_limits<int>::max(), m_element->getPen().color());
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
void PDFCreatePCElementTextTool::setPen(const QPen& pen)
@ -962,7 +962,7 @@ void PDFCreatePCElementTextTool::setPen(const QPen& pen)
}
m_textEditWidget->setAppearance(font, m_element->getAlignment(), m_element->getRectangle(), std::numeric_limits<int>::max(), pen.color());
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
} // namespace pdf

View File

@ -52,7 +52,7 @@ public:
virtual void setTextAngle(pdf::PDFReal angle);
protected:
static QRectF getRectangleFromPickTool(PDFPickTool* pickTool, const QMatrix& pagePointToDevicePointMatrix);
static QRectF getRectangleFromPickTool(PDFPickTool* pickTool, const QTransform& pagePointToDevicePointMatrix);
PDFPageContentScene* m_scene;
};
@ -77,7 +77,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual const PDFPageContentElement* getElement() const override;
@ -111,7 +111,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual const PDFPageContentElement* getElement() const override;
@ -151,7 +151,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual const PDFPageContentElement* getElement() const override;
@ -185,7 +185,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual const PDFPageContentElement* getElement() const override;
@ -217,7 +217,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual const PDFPageContentElement* getElement() const override;
@ -255,7 +255,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual const PDFPageContentElement* getElement() const override;

View File

@ -221,7 +221,7 @@ void PDFPageContentEditorWidget::onItemSelectionChanged()
{
if (m_selectionChangeEnabled)
{
emit itemSelectionChangedByUser();
Q_EMIT itemSelectionChangedByUser();
}
}

View File

@ -269,7 +269,7 @@ void PDFPageContentElementRectangle::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -344,7 +344,7 @@ void PDFPageContentScene::addElement(PDFPageContentElement* element)
{
element->setElementId(m_firstFreeId++);
m_elements.emplace_back(element);
emit sceneChanged(false);
Q_EMIT sceneChanged(false);
}
void PDFPageContentScene::replaceElement(PDFPageContentElement* element)
@ -356,7 +356,7 @@ void PDFPageContentScene::replaceElement(PDFPageContentElement* element)
if (m_elements[i]->getElementId() == element->getElementId())
{
m_elements[i] = std::move(elementPtr);
emit sceneChanged(false);
Q_EMIT sceneChanged(false);
break;
}
}
@ -379,7 +379,7 @@ void PDFPageContentScene::clear()
{
m_manipulator.reset();
m_elements.clear();
emit sceneChanged(false);
Q_EMIT sceneChanged(false);
}
}
@ -507,7 +507,7 @@ void PDFPageContentScene::mouseDoubleClickEvent(QWidget* widget, QMouseEvent* ev
MouseEventInfo info = getMouseEventInfo(widget, event->pos());
if (info.isValid())
{
emit editElementRequest(info.hoveredElementIds);
Q_EMIT editElementRequest(info.hoveredElementIds);
}
// If mouse is grabbed, then event is accepted always (because
@ -602,7 +602,7 @@ void PDFPageContentScene::mouseMoveEvent(QWidget* widget, QMouseEvent* event)
if (m_manipulator.isManipulationInProgress())
{
emit sceneChanged(true);
Q_EMIT sceneChanged(true);
}
}
@ -641,7 +641,7 @@ int PDFPageContentScene::getInputPriority() const
void PDFPageContentScene::drawElements(QPainter* painter,
PDFInteger pageIndex,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPrecompiledPage* compiledPage,
QList<PDFRenderError>& errors) const
{
@ -660,7 +660,7 @@ void PDFPageContentScene::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
if (!m_isActive)
@ -815,8 +815,8 @@ void PDFPageContentScene::updateMouseCursor(const MouseEventInfo& info, PDFReal
void PDFPageContentScene::onSelectionChanged()
{
emit sceneChanged(true);
emit selectionChanged();
Q_EMIT sceneChanged(true);
Q_EMIT selectionChanged();
}
PDFWidget* PDFPageContentScene::widget() const
@ -846,7 +846,7 @@ void PDFPageContentScene::setActive(bool newIsActive)
m_manipulator.reset();
}
emit sceneChanged(false);
Q_EMIT sceneChanged(false);
}
}
@ -917,7 +917,7 @@ void PDFPageContentScene::removeElementsById(const std::vector<PDFInteger>& sele
if (newSize < oldSize)
{
emit sceneChanged(false);
Q_EMIT sceneChanged(false);
}
}
@ -952,7 +952,7 @@ void PDFPageContentElementLine::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1134,7 +1134,7 @@ void PDFPageContentImageElement::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1261,7 +1261,7 @@ void PDFPageContentElementDot::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1349,7 +1349,7 @@ void PDFPageContentElementFreehandCurve::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1518,7 +1518,7 @@ void PDFPageContentElementManipulator::update(PDFInteger id, SelectionModes mode
if (modified)
{
emit selectionChanged();
Q_EMIT selectionChanged();
}
}
@ -1580,7 +1580,7 @@ void PDFPageContentElementManipulator::update(const std::set<PDFInteger>& ids, S
if (modified)
{
emit selectionChanged();
Q_EMIT selectionChanged();
}
}
@ -2195,7 +2195,7 @@ void PDFPageContentElementManipulator::startManipulation(PDFInteger pageIndex,
m_isManipulationInProgress = true;
m_lastUpdatedPoint = startPoint;
updateManipulation(pageIndex, startPoint, currentPoint);
emit stateChanged();
Q_EMIT stateChanged();
}
}
@ -2216,7 +2216,7 @@ void PDFPageContentElementManipulator::updateManipulation(PDFInteger pageIndex,
}
m_lastUpdatedPoint = currentPoint;
emit stateChanged();
Q_EMIT stateChanged();
}
void PDFPageContentElementManipulator::finishManipulation(PDFInteger pageIndex,
@ -2252,7 +2252,7 @@ void PDFPageContentElementManipulator::cancelManipulation()
m_isManipulationInProgress = false;
m_manipulatedElements.clear();
m_manipulationModes.clear();
emit stateChanged();
Q_EMIT stateChanged();
}
Q_ASSERT(!m_isManipulationInProgress);
@ -2264,7 +2264,7 @@ void PDFPageContentElementManipulator::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
// Draw selection
@ -2286,9 +2286,9 @@ void PDFPageContentElementManipulator::drawPage(QPainter* painter,
PDFPainterStateGuard guard(painter);
QPen pen(Qt::SolidLine);
pen.setWidthF(2.0);
pen.setColor(QColor::fromRgbF(0.8, 0.8, 0.1, 0.7));
pen.setColor(QColor::fromRgbF(0.8f, 0.8f, 0.1f, 0.7f));
QBrush brush(Qt::SolidPattern);
brush.setColor(QColor::fromRgbF(1.0, 1.0, 0.0, 0.2));
brush.setColor(QColor::fromRgbF(1.0f, 1.0f, 0.0f, 0.2f));
painter->setPen(std::move(pen));
painter->setBrush(std::move(brush));
@ -2374,7 +2374,7 @@ void PDFPageContentElementTextBox::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -2416,7 +2416,7 @@ void PDFPageContentElementTextBox::drawPage(QPainter* painter,
{
QRectF textBoundingRect = painter->boundingRect(textRect, getText(), option);
QMatrix matrix;
QTransform matrix;
matrix.rotate(getAngle());
QRectF mappedTextBoundingRect = matrix.mapRect(textBoundingRect);

View File

@ -48,7 +48,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const = 0;
/// Returns manipulation mode. If manipulation mode is zero, then element
@ -151,7 +151,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
@ -185,7 +185,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
@ -218,7 +218,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
@ -247,7 +247,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
@ -282,7 +282,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
@ -320,7 +320,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual uint getManipulationMode(const QPointF& point,
@ -439,7 +439,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const;
/// Returns bounding box of whole selection
@ -541,7 +541,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
PDFWidget* widget() const;
@ -550,7 +550,7 @@ public:
void drawElements(QPainter* painter,
PDFInteger pageIndex,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
const PDFPrecompiledPage* compiledPage,
QList<PDFRenderError>& errors) const;

View File

@ -225,7 +225,7 @@ PDFPageContentProcessor::PDFPageContentProcessor(const PDFPage* page,
const PDFFontCache* fontCache,
const PDFCMS* CMS,
const PDFOptionalContentActivity* optionalContentActivity,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFMeshQualitySettings& meshQualitySettings) :
m_page(page),
m_document(document),
@ -729,7 +729,7 @@ void PDFPageContentProcessor::processContentStream(const PDFStream* stream)
}
}
void PDFPageContentProcessor::processForm(const QMatrix& matrix,
void PDFPageContentProcessor::processForm(const QTransform& matrix,
const QRectF& boundingBox,
const PDFObject& resources,
const PDFObject& transparencyGroup,
@ -764,11 +764,11 @@ void PDFPageContentProcessor::processForm(const QMatrix& matrix,
m_graphicState.setSoftMask(nullptr);
}
QMatrix formMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
QTransform formMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
m_graphicState.setCurrentTransformationMatrix(formMatrix);
updateGraphicState();
QMatrix patternMatrix = formMatrix * m_pagePointToDevicePointMatrix;
QTransform patternMatrix = formMatrix * m_pagePointToDevicePointMatrix;
PDFTemporaryValueChange patternMatrixGuard(&m_patternBaseMatrix, patternMatrix);
// If the clipping box is valid, then use clipping. Clipping box is in the form coordinate system
@ -1029,9 +1029,9 @@ void PDFPageContentProcessor::processTillingPatternPainting(const PDFTilingPatte
Q_ASSERT(m_pagePointToDevicePointMatrix.isInvertible());
// Initialize rendering matrix
QMatrix patternMatrix = tilingPattern->getMatrix() * getPatternBaseMatrix();
QMatrix matrix = patternMatrix * m_pagePointToDevicePointMatrix.inverted();
QMatrix pathTransformationMatrix = m_graphicState.getCurrentTransformationMatrix() * matrix.inverted();
QTransform patternMatrix = tilingPattern->getMatrix() * getPatternBaseMatrix();
QTransform matrix = patternMatrix * m_pagePointToDevicePointMatrix.inverted();
QTransform pathTransformationMatrix = m_graphicState.getCurrentTransformationMatrix() * matrix.inverted();
m_graphicState.setCurrentTransformationMatrix(matrix);
int uncoloredTilingPatternFlag = 0;
@ -1082,18 +1082,18 @@ void PDFPageContentProcessor::processTillingPatternPainting(const PDFTilingPatte
const PDFInteger columns = qMax<PDFInteger>(qCeil(tilingArea.width() / xStep), 1);
const PDFInteger rows = qMax<PDFInteger>(qCeil(tilingArea.height() / yStep), 1);
QMatrix baseTransformationMatrix = m_graphicState.getCurrentTransformationMatrix();
QTransform baseTransformationMatrix = m_graphicState.getCurrentTransformationMatrix();
for (PDFInteger column = 0; column < columns; ++column)
{
for (PDFInteger row = 0; row < rows; ++row)
{
PDFPageContentProcessorGraphicStateSaveRestoreGuard guard3(this);
QMatrix transformationMatrix = baseTransformationMatrix;
QTransform transformationMatrix = baseTransformationMatrix;
transformationMatrix.translate(tilingArea.left(), tilingArea.top());
transformationMatrix.translate(column * xStep, row * yStep);
QMatrix currentPatternMatrix = transformationMatrix * m_pagePointToDevicePointMatrix;
QTransform currentPatternMatrix = transformationMatrix * m_pagePointToDevicePointMatrix;
PDFTemporaryValueChange patternMatrixGuard(&m_patternBaseMatrix, currentPatternMatrix);
m_graphicState.setCurrentTransformationMatrix(transformationMatrix);
@ -1630,7 +1630,7 @@ void PDFPageContentProcessor::operatorSetLineWidth(PDFReal lineWidth)
Qt::PenCapStyle PDFPageContentProcessor::convertLineCapToPenCapStyle(PDFInteger lineCap)
{
lineCap = qBound<PDFInteger>(0, lineCap, 2);
lineCap = qBound<PDFInteger>(PDFInteger(0), lineCap, PDFInteger(2));
Qt::PenCapStyle penCapStyle = Qt::FlatCap;
switch (lineCap)
@ -1693,7 +1693,7 @@ void PDFPageContentProcessor::operatorSetLineCap(PDFInteger lineCap)
Qt::PenJoinStyle PDFPageContentProcessor::convertLineJoinToPenJoinStyle(PDFInteger lineJoin)
{
lineJoin = qBound<PDFInteger>(0, lineJoin, 2);
lineJoin = qBound<PDFInteger>(PDFInteger(0), lineJoin, PDFInteger(2));
Qt::PenJoinStyle penJoinStyle = Qt::MiterJoin;
switch (lineJoin)
@ -2079,7 +2079,7 @@ void PDFPageContentProcessor::operatorAdjustCurrentTransformationMatrix(PDFReal
// [ a, b, 0 ]
// [x', y', 1] = [ x, y, 1] * [ c, d, 0 ]
// [ e, f, 1 ]
// If we transpose this equation (we want this, because Qt uses transposed matrices (QMatrix).
// If we transpose this equation (we want this, because Qt uses transposed matrices (QTransform).
// So, we will get following result:
//
// [ x' ] [ a, c, e] [ x ]
@ -2093,8 +2093,8 @@ void PDFPageContentProcessor::operatorAdjustCurrentTransformationMatrix(PDFReal
// We must also check, that matrix is invertible. If it is not, then we will throw exception
// to avoid errors later (for some operations, we assume matrix is invertible).
QMatrix matrix(a, b, c, d, e, f);
QMatrix transformMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
QTransform matrix(a, b, c, d, e, f);
QTransform transformMatrix = matrix * m_graphicState.getCurrentTransformationMatrix();
if (!transformMatrix.isInvertible())
{
@ -2645,8 +2645,8 @@ void PDFPageContentProcessor::operatorColorSetDeviceCMYKFilling(PDFReal c, PDFRe
void PDFPageContentProcessor::operatorTextBegin()
{
performTextBegin(ProcessOrder::BeforeOperation);
m_graphicState.setTextMatrix(QMatrix());
m_graphicState.setTextLineMatrix(QMatrix());
m_graphicState.setTextMatrix(QTransform());
m_graphicState.setTextLineMatrix(QTransform());
updateGraphicState();
++m_textBeginEndState;
@ -2738,7 +2738,7 @@ void PDFPageContentProcessor::operatorTextSetFontAndFontSize(PDFOperandName font
void PDFPageContentProcessor::operatorTextSetRenderMode(PDFInteger mode)
{
mode = qBound<PDFInteger>(0, mode, 7);
mode = qBound<PDFInteger>(PDFInteger(0), mode, PDFInteger(7));
m_graphicState.setTextRenderingMode(static_cast<TextRenderingMode>(mode));
updateGraphicState();
}
@ -2751,8 +2751,8 @@ void PDFPageContentProcessor::operatorTextSetRise(PDFReal rise)
void PDFPageContentProcessor::operatorTextMoveByOffset(PDFReal t_x, PDFReal t_y)
{
const QMatrix& textLineMatrix = m_graphicState.getTextLineMatrix();
QMatrix transformedMatrix = QMatrix(1, 0, 0, 1, t_x, t_y) * textLineMatrix;
const QTransform& textLineMatrix = m_graphicState.getTextLineMatrix();
QTransform transformedMatrix = QTransform(1, 0, 0, 1, t_x, t_y) * textLineMatrix;
m_graphicState.setTextMatrix(transformedMatrix);
m_graphicState.setTextLineMatrix(transformedMatrix);
@ -2773,7 +2773,7 @@ void PDFPageContentProcessor::operatorTextSetMatrix(PDFReal a, PDFReal b, PDFRea
// [ a, b, 0 ]
// [x', y', 1] = [ x, y, 1] * [ c, d, 0 ]
// [ e, f, 1 ]
// If we transpose this equation (we want this, because Qt uses transposed matrices (QMatrix).
// If we transpose this equation (we want this, because Qt uses transposed matrices (QTransform).
// So, we will get following result:
//
// [ x' ] [ a, c, e] [ x ]
@ -2787,7 +2787,7 @@ void PDFPageContentProcessor::operatorTextSetMatrix(PDFReal a, PDFReal b, PDFRea
// We must also check, that matrix is invertible. If it is not, then we will throw exception
// to avoid errors later (for some operations, we assume matrix is invertible).
QMatrix matrix(a, b, c, d, e, f);
QTransform matrix(a, b, c, d, e, f);
m_graphicState.setTextMatrix(matrix);
m_graphicState.setTextLineMatrix(matrix);
@ -2914,7 +2914,7 @@ void PDFPageContentProcessor::operatorShadingPaintShape(PDFPageContentProcessor:
return;
}
QMatrix matrix = getCurrentWorldMatrix();
QTransform matrix = getCurrentWorldMatrix();
PDFPageContentProcessorStateGuard guard(this);
PDFTemporaryValueChange guard2(&m_patternBaseMatrix, matrix);
@ -2923,7 +2923,7 @@ void PDFPageContentProcessor::operatorShadingPaintShape(PDFPageContentProcessor:
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Shading '%1' not found.").arg(QString::fromLatin1(name.name)));
}
PDFPatternPtr pattern = PDFPattern::createShadingPattern(m_colorSpaceDictionary, m_document, m_shadingDictionary->get(name.name), QMatrix(), PDFObject(), m_CMS, m_graphicState.getRenderingIntent(), this, true);
PDFPatternPtr pattern = PDFPattern::createShadingPattern(m_colorSpaceDictionary, m_document, m_shadingDictionary->get(name.name), QTransform(), PDFObject(), m_CMS, m_graphicState.getRenderingIntent(), this, true);
// We will do a trick: we will set current fill color space, and then paint
// bounding rectangle in the color pattern.
@ -2931,7 +2931,7 @@ void PDFPageContentProcessor::operatorShadingPaintShape(PDFPageContentProcessor:
updateGraphicState();
Q_ASSERT(matrix.isInvertible());
QMatrix inverted = matrix.inverted();
QTransform inverted = matrix.inverted();
QPainterPath deviceBoundingRectPath;
deviceBoundingRectPath.addRect(m_pageBoundingRectDeviceSpace);
@ -3007,7 +3007,7 @@ void PDFPageContentProcessor::processForm(const PDFStream* stream)
QRectF boundingBox = loader.readRectangle(streamDictionary->get("BBox"), QRectF());
// Read the transformation matrix, if it is present
QMatrix transformationMatrix = loader.readMatrixFromDictionary(streamDictionary, "Matrix", QMatrix());
QTransform transformationMatrix = loader.readMatrixFromDictionary(streamDictionary, "Matrix", QTransform());
// Read the dictionary content
QByteArray content = m_document->getDecodedStream(stream);
@ -3176,8 +3176,8 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
const bool isHorizontalWritingSystem = font->isHorizontalWritingSystem();
// Calculate text rendering matrix
QMatrix adjustMatrix(horizontalScaling, 0.0, 0.0, 1.0, 0.0, textRise);
QMatrix textMatrix = m_graphicState.getTextMatrix();
QTransform adjustMatrix(horizontalScaling, 0.0, 0.0, 1.0, 0.0, textRise);
QTransform textMatrix = m_graphicState.getTextMatrix();
if (!isType3Font)
{
@ -3208,8 +3208,8 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
{
const QPainterPath& glyphPath = *item.glyph;
QMatrix textRenderingMatrix = adjustMatrix * textMatrix;
QMatrix toDeviceSpaceTransform = textRenderingMatrix * m_graphicState.getCurrentTransformationMatrix();
QTransform textRenderingMatrix = adjustMatrix * textMatrix;
QTransform toDeviceSpaceTransform = textRenderingMatrix * m_graphicState.getCurrentTransformationMatrix();
if (!glyphPath.isEmpty())
{
@ -3262,7 +3262,7 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
Q_ASSERT(dynamic_cast<const PDFType3Font*>(m_graphicState.getTextFont().get()));
const PDFType3Font* parentFont = static_cast<const PDFType3Font*>(m_graphicState.getTextFont().get());
QMatrix fontMatrix = parentFont->getFontMatrix();
QTransform fontMatrix = parentFont->getFontMatrix();
if (!fontMatrix.isInvertible())
{
throw PDFRendererException(RenderErrorType::Error, PDFTranslationContext::tr("Type 3 font matrix is not invertible."));
@ -3276,9 +3276,9 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
initDictionaries(resources);
}
QMatrix scaleMatrix(fontSize, 0.0, 0.0, fontSize, 0.0, 0.0);
QTransform scaleMatrix(fontSize, 0.0, 0.0, fontSize, 0.0, 0.0);
adjustMatrix = scaleMatrix * adjustMatrix;
QMatrix fontAdjustedMatrix = fontMatrix * adjustMatrix;
QTransform fontAdjustedMatrix = fontMatrix * adjustMatrix;
for (const TextSequenceItem& item : textSequence.items)
{
@ -3298,7 +3298,7 @@ void PDFPageContentProcessor::drawText(const TextSequence& textSequence)
// We must clear operands, because we are processing a new content stream
m_operands.clear();
QMatrix worldMatrix = fontAdjustedMatrix * textMatrix * m_graphicState.getCurrentTransformationMatrix();
QTransform worldMatrix = fontAdjustedMatrix * textMatrix * m_graphicState.getCurrentTransformationMatrix();
m_graphicState.setCurrentTransformationMatrix(worldMatrix);
updateGraphicState();
@ -3492,7 +3492,7 @@ PDFPageContentProcessor::PDFPageContentProcessorState& PDFPageContentProcessor::
return *this;
}
void PDFPageContentProcessor::PDFPageContentProcessorState::setCurrentTransformationMatrix(const QMatrix& currentTransformationMatrix)
void PDFPageContentProcessor::PDFPageContentProcessorState::setCurrentTransformationMatrix(const QTransform& currentTransformationMatrix)
{
if (m_currentTransformationMatrix != currentTransformationMatrix)
{
@ -3638,7 +3638,7 @@ void PDFPageContentProcessor::PDFPageContentProcessorState::setTextKnockout(bool
}
}
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextLineMatrix(const QMatrix& textLineMatrix)
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextLineMatrix(const QTransform& textLineMatrix)
{
if (m_textLineMatrix != textLineMatrix)
{
@ -3827,7 +3827,7 @@ void PDFPageContentProcessor::PDFPageContentProcessorState::setBlackGenerationFu
}
}
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextMatrix(const QMatrix& textMatrix)
void PDFPageContentProcessor::PDFPageContentProcessorState::setTextMatrix(const QTransform& textMatrix)
{
if (m_textMatrix != textMatrix)
{

View File

@ -28,7 +28,7 @@
#include "pdftextlayout.h"
#include "pdfoperationcontrol.h"
#include <QMatrix>
#include <QTransform>
#include <QPainterPath>
#include <QSharedPointer>
@ -82,7 +82,7 @@ public:
const PDFFontCache* fontCache,
const PDFCMS* CMS,
const PDFOptionalContentActivity* optionalContentActivity,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFMeshQualitySettings& meshQualitySettings);
virtual ~PDFPageContentProcessor();
@ -223,7 +223,7 @@ public:
/// \param transparencyGroup Transparency group object
/// \param content Content stream of the form
/// \param formStructuralParent Structural parent key for form
void processForm(const QMatrix& matrix,
void processForm(const QTransform& matrix,
const QRectF& boundingBox,
const PDFObject& resources,
const PDFObject& transparencyGroup,
@ -366,8 +366,8 @@ protected:
using StateFlags = PDFFlags<StateFlag>;
const QMatrix& getCurrentTransformationMatrix() const { return m_currentTransformationMatrix; }
void setCurrentTransformationMatrix(const QMatrix& currentTransformationMatrix);
const QTransform& getCurrentTransformationMatrix() const { return m_currentTransformationMatrix; }
void setCurrentTransformationMatrix(const QTransform& currentTransformationMatrix);
const PDFAbstractColorSpace* getStrokeColorSpace() const { return m_strokeColorSpace.data(); }
void setStrokeColorSpace(const QSharedPointer<PDFAbstractColorSpace>& strokeColorSpace);
@ -437,11 +437,11 @@ protected:
bool getTextKnockout() const { return m_textKnockout; }
void setTextKnockout(bool textKnockout);
const QMatrix& getTextMatrix() const { return m_textMatrix; }
void setTextMatrix(const QMatrix& textMatrix);
const QTransform& getTextMatrix() const { return m_textMatrix; }
void setTextMatrix(const QTransform& textMatrix);
const QMatrix& getTextLineMatrix() const { return m_textLineMatrix; }
void setTextLineMatrix(const QMatrix& textLineMatrix);
const QTransform& getTextLineMatrix() const { return m_textLineMatrix; }
void setTextLineMatrix(const QTransform& textLineMatrix);
PDFReal getAlphaStroking() const { return m_alphaStroking; }
void setAlphaStroking(PDFReal alpha);
@ -492,7 +492,7 @@ protected:
void setHalftoneOrigin(const QPointF& halftoneOrigin);
private:
QMatrix m_currentTransformationMatrix;
QTransform m_currentTransformationMatrix;
PDFColorSpacePointer m_strokeColorSpace;
PDFColorSpacePointer m_fillColorSpace;
QColor m_strokeColor;
@ -516,8 +516,8 @@ protected:
TextRenderingMode m_textRenderingMode; // Text rendering mode
PDFReal m_textRise; // T_rise
bool m_textKnockout;
QMatrix m_textMatrix;
QMatrix m_textLineMatrix;
QTransform m_textMatrix;
QTransform m_textLineMatrix;
PDFReal m_alphaStroking;
PDFReal m_alphaFilling;
BlendMode m_blendMode;
@ -670,13 +670,13 @@ protected:
bool isContentSuppressed() const;
/// Returns page point to device point matrix
const QMatrix& getPagePointToDevicePointMatrix() const { return m_pagePointToDevicePointMatrix; }
const QTransform& getPagePointToDevicePointMatrix() const { return m_pagePointToDevicePointMatrix; }
/// Returns base matrix for patterns
const QMatrix& getPatternBaseMatrix() const { return m_patternBaseMatrix; }
const QTransform& getPatternBaseMatrix() const { return m_patternBaseMatrix; }
/// Returns current world matrix (translating actual point to the device point)
QMatrix getCurrentWorldMatrix() const { return getGraphicState()->getCurrentTransformationMatrix() * m_pagePointToDevicePointMatrix; }
QTransform getCurrentWorldMatrix() const { return getGraphicState()->getCurrentTransformationMatrix() * m_pagePointToDevicePointMatrix; }
/// Returns page bounding rectangle in device space
const QRectF& getPageBoundingRectDeviceSpace() const { return m_pageBoundingRectDeviceSpace; }
@ -1071,10 +1071,10 @@ private:
/// Base matrix to be used when drawing patterns. Concatenate this matrix
/// with pattern matrix to get transformation from pattern space to device space.
QMatrix m_patternBaseMatrix;
QTransform m_patternBaseMatrix;
/// Matrix mapping page points to the device points
QMatrix m_pagePointToDevicePointMatrix;
QTransform m_pagePointToDevicePointMatrix;
/// Bounding rectangle of pages media box in device space coordinates. If drawing rotation
/// is zero, then it corresponds to the scaled media box of the page.

View File

@ -57,7 +57,7 @@ void PDFPageNavigation::navigateToPage(size_t pageIndex)
executeNavigationNode(isForward ? Direction::Forward : Direction::Backward);
// Step c) Navigate to new page - send navigation request.
emit pageChangeRequest(m_currentPageIndex, &m_transition);
Q_EMIT pageChangeRequest(m_currentPageIndex, &m_transition);
}
void PDFPageNavigation::navigateForward()
@ -104,7 +104,7 @@ void PDFPageNavigation::executeNavigationNode(Direction direction)
{
for (const PDFAction* currentAction : action->getActionList())
{
emit actionTriggered(currentAction);
Q_EMIT actionTriggered(currentAction);
}
}
break;
@ -116,7 +116,7 @@ void PDFPageNavigation::executeNavigationNode(Direction direction)
{
for (const PDFAction* currentAction : action->getActionList())
{
emit actionTriggered(currentAction);
Q_EMIT actionTriggered(currentAction);
}
}
break;

View File

@ -32,7 +32,7 @@ PDFPainterBase::PDFPainterBase(PDFRenderer::Features features,
const PDFFontCache* fontCache,
const PDFCMS* cms,
const PDFOptionalContentActivity* optionalContentActivity,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFMeshQualitySettings& meshQualitySettings) :
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, meshQualitySettings),
m_features(features)
@ -240,7 +240,7 @@ void PDFPainterBase::performEndTransparencyGroup(ProcessOrder order, const PDFTr
PDFPainter::PDFPainter(QPainter* painter,
PDFRenderer::Features features,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFDocument* document,
const PDFFontCache* fontCache,
@ -389,7 +389,7 @@ void PDFPainter::performRestoreGraphicState(ProcessOrder order)
}
}
void PDFPainter::setWorldMatrix(const QMatrix& matrix)
void PDFPainter::setWorldMatrix(const QTransform& matrix)
{
m_painter->setWorldTransform(QTransform(matrix), false);
}
@ -407,7 +407,7 @@ PDFPrecompiledPageGenerator::PDFPrecompiledPageGenerator(PDFPrecompiledPage* pre
const PDFCMS* cms,
const PDFOptionalContentActivity* optionalContentActivity,
const PDFMeshQualitySettings& meshQualitySettings) :
BaseClass(features, page, document, fontCache, cms, optionalContentActivity, QMatrix(), meshQualitySettings),
BaseClass(features, page, document, fontCache, cms, optionalContentActivity, QTransform(), meshQualitySettings),
m_precompiledPage(precompiledPage)
{
m_precompiledPage->setPaperColor(cms->getPaperColor());
@ -439,7 +439,7 @@ void PDFPrecompiledPageGenerator::performImagePainting(const QImage& image)
}
// Add snap info for image to the snapper
QMatrix matrix = getCurrentWorldMatrix();
QTransform matrix = getCurrentWorldMatrix();
PDFSnapInfo* snapInfo = m_precompiledPage->getSnapInfo();
snapInfo->addImage({
matrix.map(QPointF(0.0, 0.0)),
@ -494,7 +494,7 @@ void PDFPrecompiledPageGenerator::performRestoreGraphicState(PDFPageContentProce
}
}
void PDFPrecompiledPageGenerator::setWorldMatrix(const QMatrix& matrix)
void PDFPrecompiledPageGenerator::setWorldMatrix(const QTransform& matrix)
{
m_precompiledPage->addSetWorldMatrix(matrix);
}
@ -506,7 +506,7 @@ void PDFPrecompiledPageGenerator::setCompositionMode(QPainter::CompositionMode m
void PDFPrecompiledPage::draw(QPainter* painter,
const QRectF& cropBox,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
PDFRenderer::Features features,
PDFReal opacity) const
{
@ -620,7 +620,7 @@ void PDFPrecompiledPage::draw(QPainter* painter,
painter->restore();
}
void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix, QColor color)
void PDFPrecompiledPage::redact(QPainterPath redactPath, const QTransform& matrix, QColor color)
{
if (redactPath.isEmpty())
{
@ -628,7 +628,7 @@ void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix,
return;
}
std::stack<QMatrix> worldMatrixStack;
std::stack<QTransform> worldMatrixStack;
worldMatrixStack.push(matrix);
if (color.isValid())
@ -643,7 +643,7 @@ void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix,
{
case InstructionType::DrawPath:
{
QMatrix currentMatrix = worldMatrixStack.top().inverted();
QTransform currentMatrix = worldMatrixStack.top().inverted();
QPainterPath mappedRedactPath = currentMatrix.map(redactPath);
PathPaintData& path = m_paths[instruction.dataIndex];
path.path = path.path.subtracted(mappedRedactPath);
@ -676,7 +676,7 @@ void PDFPrecompiledPage::redact(QPainterPath redactPath, const QMatrix& matrix,
case InstructionType::Clip:
{
QMatrix currentMatrix = worldMatrixStack.top().inverted();
QTransform currentMatrix = worldMatrixStack.top().inverted();
QPainterPath mappedRedactPath = currentMatrix.map(redactPath);
m_clips[instruction.dataIndex].clipPath = m_clips[instruction.dataIndex].clipPath.subtracted(mappedRedactPath);
break;
@ -743,7 +743,7 @@ void PDFPrecompiledPage::addMesh(PDFMesh mesh, PDFReal alpha)
m_meshes.emplace_back(qMove(mesh), alpha);
}
void PDFPrecompiledPage::addSetWorldMatrix(const QMatrix& matrix)
void PDFPrecompiledPage::addSetWorldMatrix(const QTransform& matrix)
{
m_instructions.emplace_back(InstructionType::SetWorldMatrix, m_matrices.size());
m_matrices.push_back(matrix);
@ -810,7 +810,7 @@ void PDFPrecompiledPage::finalize(qint64 compilingTimeNS, QList<PDFRenderError>
m_memoryConsumptionEstimate += sizeof(ClipData) * m_clips.capacity();
m_memoryConsumptionEstimate += sizeof(ImageData) * m_images.capacity();
m_memoryConsumptionEstimate += sizeof(MeshPaintData) * m_meshes.capacity();
m_memoryConsumptionEstimate += sizeof(QMatrix) * m_matrices.capacity();
m_memoryConsumptionEstimate += sizeof(QTransform) * m_matrices.capacity();
m_memoryConsumptionEstimate += sizeof(QPainter::CompositionMode) * m_compositionModes.capacity();
m_memoryConsumptionEstimate += sizeof(PDFRenderError) * m_errors.size();
@ -843,7 +843,7 @@ PDFPrecompiledPage::GraphicPieceInfos PDFPrecompiledPage::calculateGraphicPieceI
struct State
{
QMatrix matrix;
QTransform matrix;
};
std::stack<State> stateStack;
stateStack.emplace();
@ -925,7 +925,7 @@ PDFPrecompiledPage::GraphicPieceInfos PDFPrecompiledPage::calculateGraphicPieceI
QDataStream streamImage(&serializedImage, QIODevice::WriteOnly);
// Jakub Melka: serialize image position
QMatrix worldMatrix = stateStack.top().matrix;
QTransform worldMatrix = stateStack.top().matrix;
QPainterPath pagePath;
pagePath.addRect(0, 0, 1, 1);

View File

@ -45,7 +45,7 @@ public:
const PDFFontCache* fontCache,
const PDFCMS* cms,
const PDFOptionalContentActivity* optionalContentActivity,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFMeshQualitySettings& meshQualitySettings);
virtual bool isContentSuppressedByOC(PDFObjectReference ocgOrOcmd) override;
@ -54,7 +54,7 @@ protected:
virtual void performUpdateGraphicsState(const PDFPageContentProcessorState& state) override;
virtual void performBeginTransparencyGroup(ProcessOrder order, const PDFTransparencyGroup& transparencyGroup) override;
virtual void performEndTransparencyGroup(ProcessOrder order, const PDFTransparencyGroup& transparencyGroup) override;
virtual void setWorldMatrix(const QMatrix& matrix) = 0;
virtual void setWorldMatrix(const QTransform& matrix) = 0;
virtual void setCompositionMode(QPainter::CompositionMode mode) = 0;
/// Returns current pen
@ -120,7 +120,7 @@ public:
/// \param meshQualitySettings Mesh quality settings
explicit PDFPainter(QPainter* painter,
PDFRenderer::Features features,
QMatrix pagePointToDevicePointMatrix,
QTransform pagePointToDevicePointMatrix,
const PDFPage* page,
const PDFDocument* document,
const PDFFontCache* fontCache,
@ -136,7 +136,7 @@ protected:
virtual void performMeshPainting(const PDFMesh& mesh) override;
virtual void performSaveGraphicState(ProcessOrder order) override;
virtual void performRestoreGraphicState(ProcessOrder order) override;
virtual void setWorldMatrix(const QMatrix& matrix) override;
virtual void setWorldMatrix(const QTransform& matrix) override;
virtual void setCompositionMode(QPainter::CompositionMode mode) override;
private:
@ -191,7 +191,7 @@ public:
/// \param opacity Opacity of page graphics
void draw(QPainter* painter,
const QRectF& cropBox,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
PDFRenderer::Features features,
PDFReal opacity) const;
@ -199,7 +199,7 @@ public:
/// and fill redact path with given color.
/// \param redactPath Redaction path in page coordinates
/// \param color Redaction color (if invalid, nothing is being drawn)
void redact(QPainterPath redactPath, const QMatrix& matrix, QColor color);
void redact(QPainterPath redactPath, const QTransform& matrix, QColor color);
void addPath(QPen pen, QBrush brush, QPainterPath path, bool isText);
void addClip(QPainterPath path);
@ -207,7 +207,7 @@ public:
void addMesh(PDFMesh mesh, PDFReal alpha);
void addSaveGraphicState() { m_instructions.emplace_back(InstructionType::SaveGraphicState, 0); }
void addRestoreGraphicState() { m_instructions.emplace_back(InstructionType::RestoreGraphicState, 0); }
void addSetWorldMatrix(const QMatrix& matrix);
void addSetWorldMatrix(const QTransform& matrix);
void addSetCompositionMode(QPainter::CompositionMode compositionMode);
/// Optimizes page memory allocation to contain less space
@ -354,7 +354,7 @@ private:
std::vector<ClipData> m_clips;
std::vector<ImageData> m_images;
std::vector<MeshPaintData> m_meshes;
std::vector<QMatrix> m_matrices;
std::vector<QTransform> m_matrices;
std::vector<QPainter::CompositionMode> m_compositionModes;
QList<PDFRenderError> m_errors;
PDFSnapInfo m_snapInfo;
@ -384,7 +384,7 @@ protected:
virtual void performMeshPainting(const PDFMesh& mesh) override;
virtual void performSaveGraphicState(ProcessOrder order) override;
virtual void performRestoreGraphicState(ProcessOrder order) override;
virtual void setWorldMatrix(const QMatrix& matrix) override;
virtual void setWorldMatrix(const QTransform& matrix) override;
virtual void setCompositionMode(QPainter::CompositionMode mode) override;
private:

View File

@ -705,7 +705,7 @@ PDFObject PDFParser::getObject()
{
case PDFLexicalAnalyzer::TokenType::Boolean:
{
Q_ASSERT(m_lookAhead1.data.type() == QVariant::Bool);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::Bool);
const bool value = m_lookAhead1.data.toBool();
shift();
return PDFObject::createBool(value);
@ -713,7 +713,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::Integer:
{
Q_ASSERT(m_lookAhead1.data.type() == QVariant::LongLong);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::LongLong);
const PDFInteger value = m_lookAhead1.data.toLongLong();
shift();
@ -723,7 +723,7 @@ PDFObject PDFParser::getObject()
m_lookAhead2.type == PDFLexicalAnalyzer::TokenType::Command &&
m_lookAhead2.data.toByteArray() == PDF_REFERENCE_COMMAND)
{
Q_ASSERT(m_lookAhead1.data.type() == QVariant::LongLong);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::LongLong);
const PDFInteger generation = m_lookAhead1.data.toLongLong();
shift();
shift();
@ -738,7 +738,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::Real:
{
Q_ASSERT(m_lookAhead1.data.type() == QVariant::Double);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::Double);
const PDFReal value = m_lookAhead1.data.toDouble();
shift();
return PDFObject::createReal(value);
@ -746,7 +746,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::String:
{
Q_ASSERT(m_lookAhead1.data.type() == QVariant::ByteArray);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::QByteArray);
QByteArray array = m_lookAhead1.data.toByteArray();
array.shrink_to_fit();
shift();
@ -755,7 +755,7 @@ PDFObject PDFParser::getObject()
case PDFLexicalAnalyzer::TokenType::Name:
{
Q_ASSERT(m_lookAhead1.data.type() == QVariant::ByteArray);
Q_ASSERT(m_lookAhead1.data.typeId() == QMetaType::QByteArray);
QByteArray array = m_lookAhead1.data.toByteArray();
array.shrink_to_fit();
shift();

View File

@ -41,17 +41,17 @@ const PDFAbstractColorSpace* PDFShadingPattern::getColorSpace() const
return m_colorSpace.data();
}
QMatrix PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const
QTransform PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const
{
return m_matrix * settings.userSpaceToDeviceSpaceMatrix;
}
QMatrix PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const QMatrix& userSpaceToDeviceSpaceMatrix) const
QTransform PDFShadingPattern::getPatternSpaceToDeviceSpaceMatrix(const QTransform& userSpaceToDeviceSpaceMatrix) const
{
return m_matrix * userSpaceToDeviceSpaceMatrix;
}
PDFShadingSampler* PDFShadingPattern::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
PDFShadingSampler* PDFShadingPattern::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
{
Q_UNUSED(userSpaceToDeviceSpaceMatrix);
@ -100,7 +100,7 @@ PDFPatternPtr PDFPattern::createPattern(const PDFDictionary* colorSpaceDictionar
const PDFReal xStep = loader.readNumberFromDictionary(patternDictionary, "XStep", 0.0);
const PDFReal yStep = loader.readNumberFromDictionary(patternDictionary, "YStep", 0.0);
PDFObject resources = document->getObject(patternDictionary->get("Resources"));
QMatrix matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QMatrix());
QTransform matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QTransform());
// Verify the data
if (paintType != PDFTilingPattern::PaintType::Colored && paintType != PDFTilingPattern::PaintType::Uncolored)
@ -136,7 +136,7 @@ PDFPatternPtr PDFPattern::createPattern(const PDFDictionary* colorSpaceDictionar
case PatternType::Shading:
{
PDFObject patternGraphicState = document->getObject(patternDictionary->get("ExtGState"));
QMatrix matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QMatrix());
QTransform matrix = loader.readMatrixFromDictionary(patternDictionary, "Matrix", QTransform());
return createShadingPattern(colorSpaceDictionary, document, patternDictionary->get("Shading"), matrix, patternGraphicState, cms, intent, reporter, false);
}
@ -151,7 +151,7 @@ PDFPatternPtr PDFPattern::createPattern(const PDFDictionary* colorSpaceDictionar
PDFPatternPtr PDFPattern::createShadingPattern(const PDFDictionary* colorSpaceDictionary,
const PDFDocument* document,
const PDFObject& shadingObject,
const QMatrix& matrix,
const QTransform& matrix,
const PDFObject& patternGraphicState,
const PDFCMS* cms,
RenderingIntent intent,
@ -252,7 +252,7 @@ PDFPatternPtr PDFPattern::createShadingPattern(const PDFDictionary* colorSpaceDi
throw PDFException(PDFTranslationContext::tr("Invalid function shading pattern domain. Invalid domain ranges."));
}
QMatrix domainToTargetTransform = loader.readMatrixFromDictionary(shadingDictionary, "Matrix", QMatrix());
QTransform domainToTargetTransform = loader.readMatrixFromDictionary(shadingDictionary, "Matrix", QTransform());
size_t colorComponentCount = colorSpace->getColorComponentCount();
if (functions.size() > 1 && colorComponentCount != functions.size())
@ -505,13 +505,13 @@ PDFPatternPtr PDFPattern::createShadingPattern(const PDFDictionary* colorSpaceDi
class PDFFunctionShadingSampler : public PDFShadingSampler
{
public:
PDFFunctionShadingSampler(const PDFFunctionShading* functionShadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
PDFFunctionShadingSampler(const PDFFunctionShading* functionShadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
PDFShadingSampler(functionShadingPattern),
m_functionShadingPattern(functionShadingPattern),
m_domain(functionShadingPattern->getDomain())
{
QMatrix patternSpaceToDeviceSpaceMatrix = functionShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
QMatrix domainToDeviceSpaceMatrix = functionShadingPattern->getDomainToTargetTransform() * patternSpaceToDeviceSpaceMatrix;
QTransform patternSpaceToDeviceSpaceMatrix = functionShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
QTransform domainToDeviceSpaceMatrix = functionShadingPattern->getDomainToTargetTransform() * patternSpaceToDeviceSpaceMatrix;
if (domainToDeviceSpaceMatrix.isInvertible())
{
@ -519,7 +519,7 @@ public:
}
else
{
m_deviceSpaceToDomainMatrix = QMatrix();
m_deviceSpaceToDomainMatrix = QTransform();
}
}
@ -594,7 +594,7 @@ public:
private:
const PDFFunctionShading* m_functionShadingPattern;
QRectF m_domain;
QMatrix m_deviceSpaceToDomainMatrix;
QTransform m_deviceSpaceToDomainMatrix;
};
ShadingType PDFFunctionShading::getShadingType() const
@ -612,13 +612,13 @@ PDFMesh PDFFunctionShading::createMesh(const PDFMeshQualitySettings& settings,
Q_UNUSED(operationControl);
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
QMatrix domainToDeviceSpaceMatrix = m_domainToTargetTransform * patternSpaceToDeviceSpaceMatrix;
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
QTransform domainToDeviceSpaceMatrix = m_domainToTargetTransform * patternSpaceToDeviceSpaceMatrix;
QLineF topLine(m_domain.topLeft(), m_domain.topRight());
QLineF leftLine(m_domain.topLeft(), m_domain.bottomLeft());
Q_ASSERT(domainToDeviceSpaceMatrix.isInvertible());
QMatrix deviceSpaceToDomainMatrix = domainToDeviceSpaceMatrix.inverted();
QTransform deviceSpaceToDomainMatrix = domainToDeviceSpaceMatrix.inverted();
QLineF topLineDS = domainToDeviceSpaceMatrix.map(topLine);
QLineF leftLineDS = domainToDeviceSpaceMatrix.map(leftLine);
@ -911,7 +911,7 @@ PDFMesh PDFFunctionShading::createMesh(const PDFMeshQualitySettings& settings,
return mesh;
}
PDFShadingSampler* PDFFunctionShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
PDFShadingSampler* PDFFunctionShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
{
return new PDFFunctionShadingSampler(this, userSpaceToDeviceSpaceMatrix);
}
@ -926,7 +926,7 @@ PDFMesh PDFAxialShading::createMesh(const PDFMeshQualitySettings& settings,
Q_UNUSED(operationControl);
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
QPointF p1 = patternSpaceToDeviceSpaceMatrix.map(m_startPoint);
QPointF p2 = patternSpaceToDeviceSpaceMatrix.map(m_endPoint);
@ -939,10 +939,10 @@ PDFMesh PDFAxialShading::createMesh(const PDFMeshQualitySettings& settings,
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
// points on the line to the global coordinate system. So, point (0, 0) will
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
QMatrix p1p2LCS;
QTransform p1p2LCS;
p1p2LCS.translate(p1.x(), p1.y());
p1p2LCS.rotate(angle);
QMatrix p1p2GCS = p1p2LCS.inverted();
QTransform p1p2GCS = p1p2LCS.inverted();
QPointF p1m = p1p2GCS.map(p1);
QPointF p2m = p1p2GCS.map(p2);
@ -1150,7 +1150,7 @@ PDFMesh PDFAxialShading::createMesh(const PDFMeshQualitySettings& settings,
class PDFAxialShadingSampler : public PDFShadingSampler
{
public:
PDFAxialShadingSampler(const PDFAxialShading* axialShadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
PDFAxialShadingSampler(const PDFAxialShading* axialShadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
PDFShadingSampler(axialShadingPattern),
m_axialShadingPattern(axialShadingPattern),
m_xStart(0.0),
@ -1160,7 +1160,7 @@ public:
m_tMin(0.0),
m_tMax(0.0)
{
QMatrix patternSpaceToDeviceSpace = axialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
QTransform patternSpaceToDeviceSpace = axialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
QPointF p1 = patternSpaceToDeviceSpace.map(axialShadingPattern->getStartPoint());
QPointF p2 = patternSpaceToDeviceSpace.map(axialShadingPattern->getEndPoint());
@ -1174,10 +1174,10 @@ public:
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
// points on the line to the global coordinate system. So, point (0, 0) will
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
QMatrix p1p2LCS;
QTransform p1p2LCS;
p1p2LCS.translate(p1.x(), p1.y());
p1p2LCS.rotate(angle);
QMatrix p1p2GCS = p1p2LCS.inverted();
QTransform p1p2GCS = p1p2LCS.inverted();
QPointF p1m = p1p2GCS.map(p1);
QPointF p2m = p1p2GCS.map(p2);
@ -1297,7 +1297,7 @@ public:
private:
const PDFAxialShading* m_axialShadingPattern;
QMatrix m_p1p2GCS;
QTransform m_p1p2GCS;
PDFReal m_xStart;
PDFReal m_xEnd;
PDFReal m_tAtStart;
@ -1306,7 +1306,7 @@ private:
PDFReal m_tMax;
};
PDFShadingSampler* PDFAxialShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
PDFShadingSampler* PDFAxialShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
{
return new PDFAxialShadingSampler(this, userSpaceToDeviceSpaceMatrix);
}
@ -1357,7 +1357,7 @@ void PDFMesh::paint(QPainter* painter, PDFReal alpha) const
painter->restore();
}
void PDFMesh::transform(const QMatrix& matrix)
void PDFMesh::transform(const QTransform& matrix)
{
for (QPointF& vertex : m_vertices)
{
@ -1439,7 +1439,7 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings,
Q_UNUSED(operationControl);
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(settings);
QPointF p1 = patternSpaceToDeviceSpaceMatrix.map(m_startPoint);
QPointF p2 = patternSpaceToDeviceSpaceMatrix.map(m_endPoint);
@ -1458,10 +1458,10 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings,
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
// points on the line to the global coordinate system. So, point (0, 0) will
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
QMatrix p1p2LCS;
QTransform p1p2LCS;
p1p2LCS.translate(p1.x(), p1.y());
p1p2LCS.rotate(angle);
QMatrix p1p2GCS = p1p2LCS.inverted();
QTransform p1p2GCS = p1p2LCS.inverted();
QPointF p1m = p1p2GCS.map(p1);
QPointF p2m = p1p2GCS.map(p2);
@ -1723,7 +1723,7 @@ PDFMesh PDFRadialShading::createMesh(const PDFMeshQualitySettings& settings,
class PDFRadialShadingSampler : public PDFShadingSampler
{
public:
PDFRadialShadingSampler(const PDFRadialShading* radialShadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
PDFRadialShadingSampler(const PDFRadialShading* radialShadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
PDFShadingSampler(radialShadingPattern),
m_radialShadingPattern(radialShadingPattern),
m_xStart(0.0),
@ -1735,7 +1735,7 @@ public:
m_r0(0.0),
m_r1(0.0)
{
QMatrix patternSpaceToDeviceSpace = radialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
QTransform patternSpaceToDeviceSpace = radialShadingPattern->getMatrix() * userSpaceToDeviceSpaceMatrix;
QPointF p1 = patternSpaceToDeviceSpace.map(radialShadingPattern->getStartPoint());
QPointF p2 = patternSpaceToDeviceSpace.map(radialShadingPattern->getEndPoint());
@ -1754,10 +1754,10 @@ public:
// Matrix p1p2LCS is local coordinate system of line p1-p2. It transforms
// points on the line to the global coordinate system. So, point (0, 0) will
// map onto p1 and point (length(p1-p2), 0) will map onto p2.
QMatrix p1p2LCS;
QTransform p1p2LCS;
p1p2LCS.translate(p1.x(), p1.y());
p1p2LCS.rotate(angle);
QMatrix p1p2GCS = p1p2LCS.inverted();
QTransform p1p2GCS = p1p2LCS.inverted();
QPointF p1m = p1p2GCS.map(p1);
QPointF p2m = p1p2GCS.map(p2);
@ -1970,7 +1970,7 @@ public:
private:
const PDFRadialShading* m_radialShadingPattern;
QMatrix m_p1p2GCS;
QTransform m_p1p2GCS;
PDFReal m_xStart;
PDFReal m_xEnd;
PDFReal m_tAtStart;
@ -1981,7 +1981,7 @@ private:
PDFReal m_r1;
};
PDFShadingSampler* PDFRadialShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
PDFShadingSampler* PDFRadialShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
{
return new PDFRadialShadingSampler(this, userSpaceToDeviceSpaceMatrix);
}
@ -1993,11 +1993,11 @@ private:
{
std::array<uint32_t, 3> vertexIndices = { };
std::array<PDFColor, 3> vertexColors;
QMatrix barycentricCoordinateMatrix;
QTransform barycentricCoordinateMatrix;
};
public:
PDFTriangleShadingSampler(const PDFType4567Shading* shadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
PDFTriangleShadingSampler(const PDFType4567Shading* shadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
PDFShadingSampler(shadingPattern),
m_type4567ShadingPattern(shadingPattern)
{
@ -2098,7 +2098,7 @@ public:
QPointF p1p3 = p1 - p3;
QPointF p2p3 = p2 - p3;
QMatrix B(p1p3.x(), p1p3.y(), p2p3.x(), p2p3.y(), 0.0, 0.0);
QTransform B(p1p3.x(), p1p3.y(), p2p3.x(), p2p3.y(), 0.0, 0.0);
if (!B.isInvertible())
{
@ -2108,9 +2108,9 @@ public:
// We precalculate B^-1 * (-p3), so we do not have it to compute it
// in each iteration.
QMatrix Binv = B.inverted();
QTransform Binv = B.inverted();
QPointF pt = Binv.map(-p3);
Binv.setMatrix(Binv.m11(), Binv.m12(), Binv.m21(), Binv.m22(), pt.x(), pt.y());
Binv = QTransform(Binv.m11(), Binv.m12(), Binv.m21(), Binv.m22(), pt.x(), pt.y());
triangle.barycentricCoordinateMatrix = Binv;
m_triangles.emplace_back(qMove(triangle));
@ -2132,10 +2132,10 @@ ShadingType PDFFreeFormGouradTriangleShading::getShadingType() const
bool PDFFreeFormGouradTriangleShading::processTriangles(InitializeFunction initializeMeshFunction,
AddTriangleFunction addTriangle,
const QMatrix& userSpaceToDeviceSpaceMatrix,
const QTransform& userSpaceToDeviceSpaceMatrix,
bool convertColors) const
{
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
size_t bitsPerVertex = m_bitsPerFlag + 2 * m_bitsPerCoordinate + m_colorComponentCount * m_bitsPerComponent;
size_t remainder = (8 - (bitsPerVertex % 8)) % 8;
bitsPerVertex += remainder;
@ -2292,7 +2292,7 @@ PDFMesh PDFFreeFormGouradTriangleShading::createMesh(const PDFMeshQualitySetting
return mesh;
}
PDFShadingSampler* PDFFreeFormGouradTriangleShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
PDFShadingSampler* PDFFreeFormGouradTriangleShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
{
PDFTriangleShadingSampler* sampler = new PDFTriangleShadingSampler(this, userSpaceToDeviceSpaceMatrix);
@ -2328,10 +2328,10 @@ ShadingType PDFLatticeFormGouradTriangleShading::getShadingType() const
bool PDFLatticeFormGouradTriangleShading::processTriangles(InitializeFunction initializeMeshFunction,
AddTriangleFunction addTriangle,
const QMatrix& userSpaceToDeviceSpaceMatrix,
const QTransform& userSpaceToDeviceSpaceMatrix,
bool convertColors) const
{
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
size_t bitsPerVertex = 2 * m_bitsPerCoordinate + m_colorComponentCount * m_bitsPerComponent;
size_t remainder = (8 - (bitsPerVertex % 8)) % 8;
bitsPerVertex += remainder;
@ -2460,7 +2460,7 @@ PDFMesh PDFLatticeFormGouradTriangleShading::createMesh(const PDFMeshQualitySett
return mesh;
}
PDFShadingSampler* PDFLatticeFormGouradTriangleShading::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
PDFShadingSampler* PDFLatticeFormGouradTriangleShading::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
{
PDFTriangleShadingSampler* sampler = new PDFTriangleShadingSampler(this, userSpaceToDeviceSpaceMatrix);
@ -2874,9 +2874,9 @@ ShadingType PDFTensorProductPatchShading::getShadingType() const
return ShadingType::TensorProductPatchMesh;
}
PDFTensorPatches PDFTensorProductPatchShading::createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const
PDFTensorPatches PDFTensorProductPatchShading::createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const
{
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
size_t bitsPerPatch = m_bitsPerFlag + 16 * 2 * m_bitsPerCoordinate + 4 * m_colorComponentCount * m_bitsPerComponent;
size_t remainder = (8 - (bitsPerPatch % 8)) % 8;
@ -3158,7 +3158,7 @@ struct PDFTensorProductPatchShadingBase::Triangle
class PDFTensorPatchesSample : public PDFShadingSampler
{
public:
PDFTensorPatchesSample(const PDFTensorProductPatchShadingBase* shadingPattern, QMatrix userSpaceToDeviceSpaceMatrix) :
PDFTensorPatchesSample(const PDFTensorProductPatchShadingBase* shadingPattern, QTransform userSpaceToDeviceSpaceMatrix) :
PDFShadingSampler(shadingPattern),
m_tensorProductShadingPattern(shadingPattern)
{
@ -3238,7 +3238,7 @@ private:
PDFTensorPatches m_patches;
};
PDFShadingSampler* PDFTensorProductPatchShadingBase::createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const
PDFShadingSampler* PDFTensorProductPatchShadingBase::createSampler(QTransform userSpaceToDeviceSpaceMatrix) const
{
PDFTensorPatches patches = createPatches(userSpaceToDeviceSpaceMatrix, false);
@ -3448,7 +3448,7 @@ void PDFTensorProductPatchShadingBase::fillMesh(PDFMesh& mesh,
}
void PDFTensorProductPatchShadingBase::fillMesh(PDFMesh& mesh,
const QMatrix& patternSpaceToDeviceSpaceMatrix,
const QTransform& patternSpaceToDeviceSpaceMatrix,
const PDFMeshQualitySettings& settings,
const PDFTensorPatches& patches,
const PDFCMS* cms,
@ -3495,9 +3495,9 @@ ShadingType PDFCoonsPatchShading::getShadingType() const
return ShadingType::CoonsPatchMesh;
}
PDFTensorPatches PDFCoonsPatchShading::createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const
PDFTensorPatches PDFCoonsPatchShading::createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const
{
QMatrix patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
QTransform patternSpaceToDeviceSpaceMatrix = getPatternSpaceToDeviceSpaceMatrix(userSpaceToDeviceSpaceMatrix);
size_t bitsPerPatch = m_bitsPerFlag + 16 * 2 * m_bitsPerCoordinate + 4 * m_colorComponentCount * m_bitsPerComponent;
size_t remainder = (8 - (bitsPerPatch % 8)) % 8;

View File

@ -23,7 +23,7 @@
#include "pdfcolorspaces.h"
#include "pdfmeshqualitysettings.h"
#include <QMatrix>
#include <QTransform>
#include <QPainterPath>
#include <memory>
@ -95,7 +95,7 @@ public:
/// Transforms the mesh according to the matrix transform
/// \param matrix Matrix transform to be performed
void transform(const QMatrix& matrix);
void transform(const QTransform& matrix);
/// Reserves memory for meshing - both number of vertices and triangles.
/// Use this function, if number of vertices and triangles is known.
@ -172,7 +172,7 @@ public:
/// Returns transformation matrix from pattern space to the default
/// target space.
const QMatrix& getMatrix() const { return m_matrix; }
const QTransform& getMatrix() const { return m_matrix; }
/// Create pattern from the object. If error occurs, exception is thrown
/// \param colorSpaceDictionary Color space dictionary
@ -201,7 +201,7 @@ public:
static PDFPatternPtr createShadingPattern(const PDFDictionary* colorSpaceDictionary,
const PDFDocument* document,
const PDFObject& shadingObject,
const QMatrix& matrix,
const QTransform& matrix,
const PDFObject& patternGraphicState,
const PDFCMS* cms,
RenderingIntent intent,
@ -210,7 +210,7 @@ public:
protected:
QRectF m_boundingBox;
QMatrix m_matrix;
QTransform m_matrix;
};
class PDFInvalidPattern : public PDFPattern
@ -338,16 +338,16 @@ public:
bool isAntialiasing() const { return m_antiAlias; }
/// Returns matrix transforming pattern space to device space
QMatrix getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const;
QTransform getPatternSpaceToDeviceSpaceMatrix(const PDFMeshQualitySettings& settings) const;
/// Returns matrix transforming pattern space to device space
QMatrix getPatternSpaceToDeviceSpaceMatrix(const QMatrix& userSpaceToDeviceSpaceMatrix) const;
QTransform getPatternSpaceToDeviceSpaceMatrix(const QTransform& userSpaceToDeviceSpaceMatrix) const;
/// Create sampler which can compute shading colors in device space coordinates. If sampler can't
/// be created (or shading is invalid), then nullptr is returned.
/// \param userSpaceToDeviceSpaceMatrix Matrix, which transforms user space points
/// (user space is target space of the shading) to the device space of the paint device.
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const;
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const;
protected:
friend class PDFPattern;
@ -395,17 +395,17 @@ public:
RenderingIntent intent,
PDFRenderErrorReporter* reporter,
const PDFOperationControl* operationControl) const override;
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
const QRectF& getDomain() const { return m_domain; }
const QMatrix& getDomainToTargetTransform() const { return m_domainToTargetTransform; }
const QTransform& getDomainToTargetTransform() const { return m_domainToTargetTransform; }
const std::vector<PDFFunctionPtr>& getFunctions() const { return m_functions; }
private:
friend class PDFPattern;
QRectF m_domain; ///< Domain of the color function
QMatrix m_domainToTargetTransform; ///< Transformation mapping from domain to shading coordinate space
QTransform m_domainToTargetTransform; ///< Transformation mapping from domain to shading coordinate space
std::vector<PDFFunctionPtr> m_functions; ///< Color functions
};
@ -420,7 +420,7 @@ public:
RenderingIntent intent,
PDFRenderErrorReporter* reporter,
const PDFOperationControl* operationControl) const override;
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
private:
friend class PDFPattern;
@ -437,7 +437,7 @@ public:
RenderingIntent intent,
PDFRenderErrorReporter* reporter,
const PDFOperationControl* operationControl) const override;
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
PDFReal getR0() const { return m_r0; }
PDFReal getR1() const { return m_r1; }
@ -501,7 +501,7 @@ public:
RenderingIntent intent,
PDFRenderErrorReporter* reporter,
const PDFOperationControl* operationControl) const override;
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
private:
struct VertexData
@ -519,7 +519,7 @@ private:
bool processTriangles(InitializeFunction initializeMeshFunction,
AddTriangleFunction addTriangle,
const QMatrix& userSpaceToDeviceSpaceMatrix,
const QTransform& userSpaceToDeviceSpaceMatrix,
bool convertColors) const;
};
@ -534,7 +534,7 @@ public:
RenderingIntent intent,
PDFRenderErrorReporter* reporter,
const PDFOperationControl* operationControl) const override;
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
private:
friend class PDFPattern;
@ -551,7 +551,7 @@ private:
bool processTriangles(InitializeFunction initializeMeshFunction,
AddTriangleFunction addTriangle,
const QMatrix& userSpaceToDeviceSpaceMatrix,
const QTransform& userSpaceToDeviceSpaceMatrix,
bool convertColors) const;
PDFInteger m_verticesPerRow = 0;
@ -693,14 +693,14 @@ class PDFTensorProductPatchShadingBase : public PDFType4567Shading
public:
explicit inline PDFTensorProductPatchShadingBase() = default;
virtual PDFShadingSampler* createSampler(QMatrix userSpaceToDeviceSpaceMatrix) const override;
virtual PDFTensorPatches createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const = 0;
virtual PDFShadingSampler* createSampler(QTransform userSpaceToDeviceSpaceMatrix) const override;
virtual PDFTensorPatches createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const = 0;
protected:
struct Triangle;
void fillMesh(PDFMesh& mesh, const PDFMeshQualitySettings& settings, const PDFTensorPatch& patch, const PDFCMS* cms, RenderingIntent intent, PDFRenderErrorReporter* reporter, bool fastAlgorithm, const PDFOperationControl* operationControl) const;
void fillMesh(PDFMesh& mesh, const QMatrix& patternSpaceToDeviceSpaceMatrix, const PDFMeshQualitySettings& settings, const PDFTensorPatches& patches, const PDFCMS* cms, RenderingIntent intent, PDFRenderErrorReporter* reporter, const PDFOperationControl* operationControl) const;
void fillMesh(PDFMesh& mesh, const QTransform& patternSpaceToDeviceSpaceMatrix, const PDFMeshQualitySettings& settings, const PDFTensorPatches& patches, const PDFCMS* cms, RenderingIntent intent, PDFRenderErrorReporter* reporter, const PDFOperationControl* operationControl) const;
static void addTriangle(std::vector<Triangle>& triangles, const PDFTensorPatch& patch, std::array<QPointF, 3> uvCoordinates);
private:
@ -718,7 +718,7 @@ public:
RenderingIntent intent,
PDFRenderErrorReporter* reporter,
const PDFOperationControl* operationControl) const override;
virtual PDFTensorPatches createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
virtual PDFTensorPatches createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
private:
friend class PDFPattern;
@ -735,7 +735,7 @@ public:
RenderingIntent intent,
PDFRenderErrorReporter* reporter,
const PDFOperationControl* operationControl) const override;
virtual PDFTensorPatches createPatches(QMatrix userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
virtual PDFTensorPatches createPatches(QTransform userSpaceToDeviceSpaceMatrix, bool transformColor) const override;
private:
friend class PDFPattern;

View File

@ -70,5 +70,4 @@ PDFPluginInfo PDFPluginInfo::loadFromJson(const QJsonObject* json)
return result;
}
} // namespace pdf

View File

@ -35,7 +35,7 @@ void PDFProgress::start(size_t stepCount, ProgressStartupInfo startupInfo)
m_stepCount = stepCount;
m_percentage = 0;
emit progressStarted(qMove(startupInfo));
Q_EMIT progressStarted(qMove(startupInfo));
}
void PDFProgress::step()
@ -55,13 +55,13 @@ void PDFProgress::step()
if (emitSignal)
{
emit progressStep(newPercentage);
Q_EMIT progressStep(newPercentage);
}
}
void PDFProgress::finish()
{
emit progressFinished();
Q_EMIT progressFinished();
}
} // namespace pdf

View File

@ -101,7 +101,7 @@ PDFDocument PDFRedact::perform(Options options)
redactPath.addPath(redactAnnotation->getRedactionRegion().getPath());
}
QMatrix matrix;
QTransform matrix;
matrix.translate(0, page->getMediaBox().height());
matrix.scale(1.0, -1.0);

View File

@ -50,7 +50,7 @@ PDFRenderer::PDFRenderer(const PDFDocument* document,
Q_ASSERT(document);
}
QMatrix PDFRenderer::createPagePointToDevicePointMatrix(const PDFPage* page,
QTransform PDFRenderer::createPagePointToDevicePointMatrix(const PDFPage* page,
const QRectF& rectangle,
PageRotation extraRotation)
{
@ -60,11 +60,11 @@ QMatrix PDFRenderer::createPagePointToDevicePointMatrix(const PDFPage* page,
return createMediaBoxToDevicePointMatrix(mediaBox, rectangle, pageRotation);
}
QMatrix PDFRenderer::createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
QTransform PDFRenderer::createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
const QRectF& rectangle,
PageRotation rotation)
{
QMatrix matrix;
QTransform matrix;
switch (rotation)
{
case PageRotation::None:
@ -130,14 +130,14 @@ QList<PDFRenderError> PDFRenderer::render(QPainter* painter, const QRectF& recta
const PDFPage* page = catalog->getPage(pageIndex);
Q_ASSERT(page);
QMatrix matrix = createPagePointToDevicePointMatrix(page, rectangle);
QTransform matrix = createPagePointToDevicePointMatrix(page, rectangle);
PDFPainter processor(painter, m_features, matrix, page, m_document, m_fontCache, m_cms, m_optionalContentActivity, m_meshQualitySettings);
processor.setOperationControl(m_operationControl);
return processor.processContents();
}
QList<PDFRenderError> PDFRenderer::render(QPainter* painter, const QMatrix& matrix, size_t pageIndex) const
QList<PDFRenderError> PDFRenderer::render(QPainter* painter, const QTransform& matrix, size_t pageIndex) const
{
const PDFCatalog* catalog = m_document->getCatalog();
if (pageIndex >= catalog->getPageCount() || !catalog->getPage(pageIndex))
@ -229,7 +229,7 @@ QImage PDFRasterizer::render(PDFInteger pageIndex,
{
QImage image;
QMatrix matrix = PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), size), extraRotation);
QTransform matrix = PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), size), extraRotation);
if (m_features.testFlag(UseOpenGL) && m_features.testFlag(ValidOpenGL))
{
// We have valid OpenGL context, try to select it and possibly create framebuffer object
@ -426,7 +426,7 @@ void PDFRasterizerPool::render(const std::vector<PDFInteger>& pageIndices,
QElapsedTimer timer;
timer.start();
emit renderError(PDFCatalog::INVALID_PAGE_INDEX, PDFRenderError(RenderErrorType::Information, PDFTranslationContext::tr("Start at %1...").arg(QTime::currentTime().toString(Qt::TextDate))));
Q_EMIT renderError(PDFCatalog::INVALID_PAGE_INDEX, PDFRenderError(RenderErrorType::Information, PDFTranslationContext::tr("Start at %1...").arg(QTime::currentTime().toString(Qt::TextDate))));
if (progress)
{
@ -445,7 +445,7 @@ void PDFRasterizerPool::render(const std::vector<PDFInteger>& pageIndices,
{
progress->step();
}
emit renderError(pageIndex, PDFRenderError(RenderErrorType::Error, PDFTranslationContext::tr("Page %1 not found.").arg(pageIndex)));
Q_EMIT renderError(pageIndex, PDFRenderError(RenderErrorType::Error, PDFTranslationContext::tr("Page %1 not found.").arg(pageIndex)));
return;
}
@ -465,7 +465,7 @@ void PDFRasterizerPool::render(const std::vector<PDFInteger>& pageIndices,
for (const PDFRenderError& error : precompiledPage.getErrors())
{
emit renderError(pageIndex, error);
Q_EMIT renderError(pageIndex, error);
}
// We can const-cast here, because we do not modify the document in annotation manager.
@ -506,8 +506,8 @@ void PDFRasterizerPool::render(const std::vector<PDFInteger>& pageIndices,
progress->finish();
}
emit renderError(PDFCatalog::INVALID_PAGE_INDEX, PDFRenderError(RenderErrorType::Information, PDFTranslationContext::tr("Finished at %1...").arg(QTime::currentTime().toString(Qt::TextDate))));
emit renderError(PDFCatalog::INVALID_PAGE_INDEX, PDFRenderError(RenderErrorType::Information, PDFTranslationContext::tr("%1 miliseconds elapsed to render %2 pages...").arg(timer.nsecsElapsed() / 1000000).arg(pageIndices.size())));
Q_EMIT renderError(PDFCatalog::INVALID_PAGE_INDEX, PDFRenderError(RenderErrorType::Information, PDFTranslationContext::tr("Finished at %1...").arg(QTime::currentTime().toString(Qt::TextDate))));
Q_EMIT renderError(PDFCatalog::INVALID_PAGE_INDEX, PDFRenderError(RenderErrorType::Information, PDFTranslationContext::tr("%1 miliseconds elapsed to render %2 pages...").arg(timer.nsecsElapsed() / 1000000).arg(pageIndices.size())));
}
int PDFRasterizerPool::getDefaultRasterizerCount()

View File

@ -85,7 +85,7 @@ public:
/// Paints desired page onto the painter. Page is painted using \p matrix, which maps page coordinates
/// to the device coordinates. If the page doesn't exist, then error is returned. No exception is thrown.
/// Rendering errors are reported and returned in the error list. If no error occured, empty list is returned.
QList<PDFRenderError> render(QPainter* painter, const QMatrix& matrix, size_t pageIndex) const;
QList<PDFRenderError> render(QPainter* painter, const QTransform& matrix, size_t pageIndex) const;
/// Compiles page (i.e. prepares compiled page). \p page should be empty page, onto which
/// are graphics commands written. No exception is thrown. Rendering errors are reported and written
@ -99,17 +99,17 @@ public:
/// \param page Page, for which we want to create matrix
/// \param rectangle Page rectangle, to which is page media box transformed
/// \param extraRotation Extra rotation applied to the page rotation
static QMatrix createPagePointToDevicePointMatrix(const PDFPage* page,
const QRectF& rectangle,
PageRotation extraRotation = PageRotation::None);
static QTransform createPagePointToDevicePointMatrix(const PDFPage* page,
const QRectF& rectangle,
PageRotation extraRotation = PageRotation::None);
/// Creates media box to device point matrix for the given media box.
/// \param mediaBox Media box
/// \param rectangle Page rectangle, to which is page media box transformed
/// \param rotation Rotation
static QMatrix createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
const QRectF& rectangle,
PageRotation rotation);
static QTransform createMediaBoxToDevicePointMatrix(const QRectF& mediaBox,
const QRectF& rectangle,
PageRotation rotation);
/// Returns default renderer features
static constexpr Features getDefaultFeatures() { return Features(Antialiasing | TextAntialiasing | ClipToCropBox | DisplayAnnotations); }

View File

@ -26,6 +26,16 @@
#include <QRandomGenerator>
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
#include <openssl/rc4.h>
#include <openssl/md5.h>
#include <openssl/aes.h>
@ -42,6 +52,11 @@ namespace pdf
template<typename T>
using openssl_ptr = std::unique_ptr<T, void(*)(T*)>;
void sk_x509_free_impl(STACK_OF(X509)* ptr)
{
sk_X509_free(ptr);
}
// Padding password
static constexpr std::array<uint8_t, 32> PDFPasswordPadding = {
0x28, 0xBF, 0x4E, 0x5E, 0x4E, 0x75, 0x8A, 0x41,
@ -1993,7 +2008,7 @@ PDFSecurityHandlerPointer PDFSecurityHandlerFactory::createSecurityHandler(const
{
openssl_ptr<EVP_PKEY> key(keyPtr, EVP_PKEY_free);
openssl_ptr<X509> certificate(certificatePtr, X509_free);
openssl_ptr<STACK_OF(X509)> certificates(certificatesPtr, sk_X509_free);
openssl_ptr<STACK_OF(X509)> certificates(certificatesPtr, sk_x509_free_impl);
openssl_ptr<BIO> dataToBeSigned(BIO_new(BIO_s_mem()), BIO_free_all);
uint32_t permissions = qToLittleEndian(publicKeyHandler->m_permissions);
@ -2002,7 +2017,7 @@ PDFSecurityHandlerPointer PDFSecurityHandlerFactory::createSecurityHandler(const
BIO_write(dataToBeSigned.get(), randomKey.data(), randomKey.length());
BIO_write(dataToBeSigned.get(), &permissions, sizeof(permissions));
openssl_ptr<STACK_OF(X509)> recipientCertificates(sk_X509_new_null(), sk_X509_free);
openssl_ptr<STACK_OF(X509)> recipientCertificates(sk_X509_new_null(), sk_x509_free_impl);
sk_X509_push(recipientCertificates.get(), certificate.get());
openssl_ptr<PKCS7> pkcs7(PKCS7_encrypt(recipientCertificates.get(), dataToBeSigned.get(), EVP_aes_256_cbc(), PKCS7_BINARY), PKCS7_free);
@ -2444,7 +2459,7 @@ PDFSecurityHandler::AuthorizationResult PDFPublicKeySecurityHandler::authenticat
openssl_ptr<EVP_PKEY> key(keyPtr, EVP_PKEY_free);
openssl_ptr<X509> certificate(certificatePtr, X509_free);
openssl_ptr<STACK_OF(X509)> certificates2(certificatesPtr, sk_X509_free);
openssl_ptr<STACK_OF(X509)> certificates2(certificatesPtr, sk_x509_free_impl);
for (const auto& recipientItem : recipients)
{
@ -2595,7 +2610,7 @@ PDFObject PDFPublicKeySecurityHandler::createEncryptionDictionaryObject() const
factory << PDFInteger(int32_t(m_permissions));
factory.endDictionaryItem();
// Jakub Melka: 131105 is mysterious value set by Adobe Acrobat Pro
// Jakub Melka: 131105 is mysterious value set by Acrobat Pro
// when using public key security
factory.beginDictionaryItem("R");
factory << PDFInteger(131105);
@ -2607,3 +2622,11 @@ PDFObject PDFPublicKeySecurityHandler::createEncryptionDictionaryObject() const
}
} // namespace pdf
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic pop
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(pop)
#endif

View File

@ -1,4 +1,4 @@
// Copyright (C) 2020-2022 Jakub Melka
// Copyright (C) 2020-2022 Jakub Melka
//
// This file is part of PDF4QT.
//
@ -23,6 +23,16 @@
#include "pdfdbgheap.h"
#include "pdfsignaturehandler_impl.h"
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable: 4996)
#endif
#include <openssl/err.h>
#include <openssl/sha.h>
#include <openssl/rsa.h>
@ -46,7 +56,7 @@ namespace pdf
template<typename T>
using openssl_ptr = std::unique_ptr<T, void(*)(T*)>;
static QMutex s_globalOpenSSLMutex(QMutex::Recursive);
static QRecursiveMutex s_globalOpenSSLMutex;
/// OpenSSL is not thread safe.
class PDFOpenSSLGlobalLock
@ -56,7 +66,7 @@ public:
inline ~PDFOpenSSLGlobalLock() = default;
private:
QMutexLocker m_mutexLocker;
QMutexLocker<QRecursiveMutex> m_mutexLocker;
};
PDFSignatureReference PDFSignatureReference::parse(const PDFObjectStorage* storage, PDFObject object)
@ -2100,3 +2110,11 @@ pdf::PDFCertificateStore::CertificateEntries pdf::PDFCertificateStore::getSystem
return result;
}
#if defined(PDF4QT_COMPILER_MINGW) || defined(PDF4QT_COMPILER_GCC)
#pragma GCC diagnostic pop
#endif
#if defined(PDF4QT_COMPILER_MSVC)
#pragma warning(pop)
#endif

View File

@ -35,7 +35,7 @@ PDFTextEditPseudowidget::PDFTextEditPseudowidget(PDFFormField::FieldFlags flags)
m_maxTextLength(0)
{
m_textLayout.setCacheEnabled(true);
m_passwordReplacementCharacter = QApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter);
m_passwordReplacementCharacter = QChar(QApplication::style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter));
}
void PDFTextEditPseudowidget::shortcutOverrideEvent(QWidget* widget, QKeyEvent* event)
@ -559,9 +559,9 @@ void PDFTextEditPseudowidget::performInsertText(const QString& text)
updateTextLayout();
}
QMatrix PDFTextEditPseudowidget::createTextBoxTransformMatrix(bool edit) const
QTransform PDFTextEditPseudowidget::createTextBoxTransformMatrix(bool edit) const
{
QMatrix matrix;
QTransform matrix;
matrix.translate(m_widgetRect.left(), m_widgetRect.bottom());
matrix.scale(1.0, -1.0);
@ -759,8 +759,8 @@ void PDFTextEditPseudowidget::draw(AnnotationDrawParameters& parameters, bool ed
int PDFTextEditPseudowidget::getCursorPositionFromWidgetPosition(const QPointF& point, bool edit) const
{
QMatrix textBoxSpaceToPageSpace = createTextBoxTransformMatrix(edit);
QMatrix pageSpaceToTextBoxSpace = textBoxSpaceToPageSpace.inverted();
QTransform textBoxSpaceToPageSpace = createTextBoxTransformMatrix(edit);
QTransform pageSpaceToTextBoxSpace = textBoxSpaceToPageSpace.inverted();
QPointF textBoxPoint = pageSpaceToTextBoxSpace.map(point);

View File

@ -177,7 +177,7 @@ private:
/// Creates text box transform matrix, which transforms from
/// widget space to page space.
/// \param edit Create matrix for text editing?
QMatrix createTextBoxTransformMatrix(bool edit) const;
QTransform createTextBoxTransformMatrix(bool edit) const;
/// Returns vector of cursor positions (which may be not equal
/// to edit string length, because edit string can contain surrogates,

View File

@ -324,7 +324,7 @@ PDFTextSelection PDFTextLayout::createTextSelection(PDFInteger pageIndex, const
size_t blockId = 0;
for (PDFTextBlock& block : m_blocks)
{
QMatrix angleMatrix;
QTransform angleMatrix;
angleMatrix.rotate(block.getAngle());
block.applyTransform(angleMatrix);
@ -613,7 +613,7 @@ void PDFTextLayout::performDoLayout(PDFReal angle)
TextCharacters characters = getCharactersForAngle(angle);
// Step 1) - rotate blocks
QMatrix angleMatrix;
QTransform angleMatrix;
angleMatrix.rotate(angle);
applyTransform(characters, angleMatrix);
@ -840,7 +840,7 @@ void PDFTextLayout::performDoLayout(PDFReal angle)
}
// Topological sort
QMatrix invertedAngleMatrix = angleMatrix.inverted();
QTransform invertedAngleMatrix = angleMatrix.inverted();
while (!workBlocks.empty())
{
auto it = std::min_element(workBlocks.begin(), workBlocks.end(), [&orderingEdges](const size_t l, const size_t r) { return orderingEdges[l].size() < orderingEdges[r].size(); });
@ -863,7 +863,7 @@ TextCharacters PDFTextLayout::getCharactersForAngle(PDFReal angle) const
return result;
}
void PDFTextLayout::applyTransform(TextCharacters& characters, const QMatrix& matrix)
void PDFTextLayout::applyTransform(TextCharacters& characters, const QTransform& matrix)
{
for (TextCharacter& character : characters)
{
@ -896,7 +896,7 @@ PDFReal PDFTextLine::getAngle() const
return 0.0;
}
void PDFTextLine::applyTransform(const QMatrix& matrix)
void PDFTextLine::applyTransform(const QTransform& matrix)
{
m_boundingBox = matrix.map(m_boundingBox);
m_topLeft = matrix.map(m_topLeft);
@ -956,7 +956,7 @@ PDFReal PDFTextBlock::getAngle() const
return 0.0;
}
void PDFTextBlock::applyTransform(const QMatrix& matrix)
void PDFTextBlock::applyTransform(const QTransform& matrix)
{
m_boundingBox = matrix.map(m_boundingBox);
m_topLeft = matrix.map(m_topLeft);
@ -982,7 +982,7 @@ QDataStream& operator<<(QDataStream& stream, const PDFTextBlock& block)
return stream;
}
void TextCharacter::applyTransform(const QMatrix& matrix)
void TextCharacter::applyTransform(const QTransform& matrix)
{
position = matrix.map(position);
boundingBox = matrix.map(boundingBox);
@ -1427,7 +1427,7 @@ PDFTextLayout PDFTextLayoutStorageGetter::getTextLayoutImpl() const
return m_storage ? m_storage->getTextLayout(m_pageIndex) : PDFTextLayout();
}
void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix)
void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix)
{
Q_ASSERT(painter);
@ -1462,7 +1462,7 @@ void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFT
PDFTextBlock block = blocks[start.blockIndex];
// Fix angle of block, so we will get correct selection rectangles (parallel to lines)
QMatrix angleMatrix;
QTransform angleMatrix;
angleMatrix.rotate(block.getAngle());
block.applyTransform(angleMatrix);
@ -1524,7 +1524,7 @@ void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFT
}
}
QMatrix transformMatrix = angleMatrix.inverted() * matrix;
QTransform transformMatrix = angleMatrix.inverted() * matrix;
path = transformMatrix.map(path);
QColor penColor = item.color.darker();
@ -1539,7 +1539,7 @@ void PDFTextSelectionPainter::draw(QPainter* painter, PDFInteger pageIndex, PDFT
painter->restore();
}
QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix, QPolygonF* quadrilaterals)
QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix, QPolygonF* quadrilaterals)
{
QPainterPath path;
@ -1572,7 +1572,7 @@ QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFT
PDFTextBlock block = blocks[start.blockIndex];
// Fix angle of block, so we will get correct selection rectangles (parallel to lines)
QMatrix angleMatrix;
QTransform angleMatrix;
angleMatrix.rotate(block.getAngle());
block.applyTransform(angleMatrix);
@ -1640,7 +1640,7 @@ QPainterPath PDFTextSelectionPainter::prepareGeometry(PDFInteger pageIndex, PDFT
}
}
QMatrix transformMatrix = angleMatrix.inverted() * matrix;
QTransform transformMatrix = angleMatrix.inverted() * matrix;
currentPath = transformMatrix.map(currentPath);
if (quadrilaterals)

View File

@ -53,7 +53,7 @@ struct PDFTextCharacterInfo
PDFReal fontSize = 0.0;
/// Transformation matrix from character space to device space
QMatrix matrix;
QTransform matrix;
};
struct PDFTextLayoutSettings
@ -99,7 +99,7 @@ struct TextCharacter
size_t index = 0; // Just temporary index, it is not serialized, just for text layout algorithm
void applyTransform(const QMatrix& matrix);
void applyTransform(const QTransform& matrix);
friend QDataStream& operator<<(QDataStream& stream, const TextCharacter& character);
friend QDataStream& operator>>(QDataStream& stream, TextCharacter& character);
@ -125,7 +125,7 @@ public:
/// Get angle inclination of block
PDFReal getAngle() const;
void applyTransform(const QMatrix& matrix);
void applyTransform(const QTransform& matrix);
friend QDataStream& operator<<(QDataStream& stream, const PDFTextLine& line);
friend QDataStream& operator>>(QDataStream& stream, PDFTextLine& line);
@ -152,7 +152,7 @@ public:
/// Get angle inclination of block
PDFReal getAngle() const;
void applyTransform(const QMatrix& matrix);
void applyTransform(const QTransform& matrix);
friend QDataStream& operator<<(QDataStream& stream, const PDFTextBlock& block);
friend QDataStream& operator>>(QDataStream& stream, PDFTextBlock& block);
@ -414,7 +414,7 @@ private:
/// Applies transform to text characters (positions and bounding boxes)
/// \param characters Characters
/// \param matrix Transform matrix
static void applyTransform(TextCharacters& characters, const QMatrix& matrix);
static void applyTransform(TextCharacters& characters, const QTransform& matrix);
TextCharacters m_characters;
std::set<PDFReal> m_angles;
@ -507,14 +507,14 @@ public:
/// \param pageIndex Page index
/// \param textLayoutGetter Text layout getter
/// \param matrix Matrix which translates from page space to device space
void draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix);
void draw(QPainter* painter, PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix);
/// Prepares geometry for text selection drawing, using text layout and matrix. If current text selection
/// doesn't contain items from active page, then text layout is not accessed.
/// \param pageIndex Page index
/// \param textLayoutGetter Text layout getter
/// \param matrix Matrix which translates from page space to device space
QPainterPath prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QMatrix& matrix, QPolygonF* quadrilaterals);
QPainterPath prepareGeometry(PDFInteger pageIndex, PDFTextLayoutGetter& textLayoutGetter, const QTransform& matrix, QPolygonF* quadrilaterals);
private:
static constexpr const PDFReal HEIGHT_INCREASE_FACTOR = 0.40;

View File

@ -986,7 +986,7 @@ PDFTransparencyRenderer::PDFTransparencyRenderer(const PDFPage* page,
const PDFOptionalContentActivity* optionalContentActivity,
const PDFInkMapper* inkMapper,
PDFTransparencyRendererSettings settings,
QMatrix pagePointToDevicePointMatrix) :
QTransform pagePointToDevicePointMatrix) :
BaseClass(page, document, fontCache, cms, optionalContentActivity, pagePointToDevicePointMatrix, PDFMeshQualitySettings()),
m_inkMapper(inkMapper),
m_active(false),
@ -1295,7 +1295,7 @@ void PDFTransparencyRenderer::performFillFragmentFromTexture(const PDFReal shape
const uint8_t colorChannelEnd,
int x,
int y,
const QMatrix& worldToTextureMatrix,
const QTransform& worldToTextureMatrix,
const PDFFloatBitmap& texture,
const PDFPainterPathSampler& clipSampler)
{
@ -2102,7 +2102,7 @@ void PDFTransparencyRenderer::performPathPainting(const QPainterPath& path, bool
Q_UNUSED(text);
Q_UNUSED(fillRule);
QMatrix worldMatrix = getCurrentWorldMatrix();
QTransform worldMatrix = getCurrentWorldMatrix();
const PDFReal shapeStroking = getShapeStroking();
const PDFReal opacityStroking = getOpacityStroking();
@ -2262,7 +2262,7 @@ bool PDFTransparencyRenderer::performPathPaintingUsingShading(const QPainterPath
// Exactly one of stroke/fill must be true and other must be false
Q_ASSERT(stroke != fill);
QMatrix worldMatrix = getCurrentWorldMatrix();
QTransform worldMatrix = getCurrentWorldMatrix();
QPainterPath worldPath = worldMatrix.map(path);
QRect fillRect = getActualFillRect(worldPath.controlPointRect());
@ -2626,7 +2626,7 @@ bool PDFTransparencyRenderer::performOriginalImagePainting(const PDFImage& image
// 2) We are shrinking the image
// 3) Aspect ratio of the image is the same
QMatrix matrix = getCurrentWorldMatrix();
QTransform matrix = getCurrentWorldMatrix();
QLineF mappedWidthVector = matrix.map(QLineF(0, 0, texture.getWidth(), 0));
QLineF mappedHeightVector = matrix.map(QLineF(0, 0, 0, texture.getHeight()));
qreal angle = mappedWidthVector.angleTo(mappedHeightVector);
@ -2649,8 +2649,8 @@ bool PDFTransparencyRenderer::performOriginalImagePainting(const PDFImage& image
}
}
QMatrix imageTransform(1.0 / qreal(texture.getWidth()), 0, 0, 1.0 / qreal(texture.getHeight()), 0, 0);
QMatrix worldMatrix = imageTransform * getCurrentWorldMatrix();
QTransform imageTransform(1.0 / qreal(texture.getWidth()), 0, 0, 1.0 / qreal(texture.getHeight()), 0, 0);
QTransform worldMatrix = imageTransform * getCurrentWorldMatrix();
// Because Qt uses opposite axis direction than PDF, then we must transform the y-axis
// to the opposite (so the image is then unchanged)
@ -2663,7 +2663,7 @@ bool PDFTransparencyRenderer::performOriginalImagePainting(const PDFImage& image
imagePolygon << QPointF(texture.getWidth(), texture.getHeight());
imagePolygon << QPointF(texture.getWidth(), 0.0);
QMatrix worldToTextureMatrix = worldMatrix.inverted();
QTransform worldToTextureMatrix = worldMatrix.inverted();
QRectF boundingRectangle = worldMatrix.map(imagePolygon).boundingRect();
QRect fillRect = getActualFillRect(boundingRectangle);
@ -3920,7 +3920,7 @@ void PDFInkCoverageCalculator::perform(QSize size, const std::vector<PDFInteger>
settings.flags.setFlag(PDFTransparencyRendererSettings::SeparationSimulation, true);
settings.activeColorMask = PDFPixelFormat::getAllColorsMask();
QMatrix pagePointToDevicePoint = pdf::PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), imageSize));
QTransform pagePointToDevicePoint = pdf::PDFRenderer::createPagePointToDevicePointMatrix(page, QRect(QPoint(0, 0), imageSize));
pdf::PDFCMSPointer cms = m_cmsManager->getCurrentCMS();
pdf::PDFTransparencyRenderer renderer(page, m_document, m_fontCache, cms.data(), m_optionalContentActivity,
m_inkMapper, settings, pagePointToDevicePoint);

View File

@ -646,7 +646,7 @@ public:
const PDFOptionalContentActivity* optionalContentActivity,
const PDFInkMapper* inkMapper,
PDFTransparencyRendererSettings settings,
QMatrix pagePointToDevicePointMatrix);
QTransform pagePointToDevicePointMatrix);
/// Sets device color space. This is final color space, to which
/// is painted page transformed.
@ -879,7 +879,7 @@ private:
const uint8_t colorChannelEnd,
int x,
int y,
const QMatrix& worldToTextureMatrix,
const QTransform& worldToTextureMatrix,
const PDFFloatBitmap& texture,
const PDFPainterPathSampler& clipSampler);

View File

@ -472,16 +472,16 @@ constexpr bool isRectangleVerticallyOverlapped(const QRectF& r1, const QRectF& r
inline QColor invertColor(QColor color)
{
qreal r = 0.0;
qreal g = 0.0;
qreal b = 0.0;
qreal a = 0.0;
float r = 0.0;
float g = 0.0;
float b = 0.0;
float a = 0.0;
color.getRgbF(&r, &g, &b, &a);
r = 1.0 - r;
g = 1.0 - g;
b = 1.0 - b;
r = 1.0f - r;
g = 1.0f - g;
b = 1.0f - b;
return QColor::fromRgbF(r, g, b, a);
}

View File

@ -102,8 +102,8 @@ void PDFWidgetTool::setActive(bool active)
setActiveImpl(active);
updateActions();
emit m_proxy->repaintNeeded();
emit toolActivityChanged(active);
Q_EMIT m_proxy->repaintNeeded();
Q_EMIT toolActivityChanged(active);
}
}
@ -246,7 +246,7 @@ void PDFFindTextTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -542,7 +542,7 @@ void PDFSelectTextTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1091,7 +1091,7 @@ void PDFPickTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
Q_UNUSED(compiledPage);
@ -1176,7 +1176,7 @@ void PDFPickTool::mousePressEvent(QWidget* widget, QMouseEvent* event)
m_snapper.setReferencePoint(pageIndex, pagePoint);
// Emit signal about picked point
emit pointPicked(pageIndex, pagePoint);
Q_EMIT pointPicked(pageIndex, pagePoint);
if (m_mode == Mode::Rectangles && m_pickedPoints.size() == 2)
{
@ -1189,14 +1189,14 @@ void PDFPickTool::mousePressEvent(QWidget* widget, QMouseEvent* event)
const qreal yMax = qMax(first.y(), second.y());
QRectF pageRectangle(xMin, yMin, xMax - xMin, yMax - yMin);
emit rectanglePicked(pageIndex, pageRectangle);
Q_EMIT rectanglePicked(pageIndex, pageRectangle);
// We must reset tool, to pick next rectangle
resetTool();
}
buildSnapData();
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
else
@ -1204,7 +1204,7 @@ void PDFPickTool::mousePressEvent(QWidget* widget, QMouseEvent* event)
// Try to perform pick image
if (const PDFSnapper::ViewportSnapImage* snappedImage = m_snapper.getSnappedImage())
{
emit imagePicked(snappedImage->image);
Q_EMIT imagePicked(snappedImage->image);
}
}
}
@ -1230,7 +1230,7 @@ void PDFPickTool::mouseMoveEvent(QWidget* widget, QMouseEvent* event)
{
m_mousePosition = mousePos;
m_snapper.updateSnappedPoint(m_mousePosition);
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
}
@ -1271,7 +1271,7 @@ void PDFPickTool::resetTool()
m_snapper.clearReferencePoint();
buildSnapData();
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
}
void PDFPickTool::buildSnapData()
@ -1334,7 +1334,7 @@ void PDFScreenshotTool::onRectanglePicked(PDFInteger pageIndex, QRectF pageRecta
}
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
emit messageDisplayRequest(tr("Page contents of size %1 x %2 pixels were copied to the clipboard.").arg(image.width()).arg(image.height()), 5000);
Q_EMIT messageDisplayRequest(tr("Page contents of size %1 x %2 pixels were copied to the clipboard.").arg(image.width()).arg(image.height()), 5000);
}
}
}
@ -1365,7 +1365,7 @@ void PDFExtractImageTool::onImagePicked(const QImage& image)
if (!image.isNull())
{
QApplication::clipboard()->setImage(image, QClipboard::Clipboard);
emit messageDisplayRequest(tr("Image of size %1 x %2 pixels was copied to the clipboard.").arg(image.width()).arg(image.height()), 5000);
Q_EMIT messageDisplayRequest(tr("Image of size %1 x %2 pixels was copied to the clipboard.").arg(image.width()).arg(image.height()), 5000);
}
}
@ -1386,7 +1386,7 @@ void PDFSelectTableTool::drawPage(QPainter* painter,
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const
{
BaseClass::drawPage(painter, pageIndex, compiledPage, layoutGetter, pagePointToDevicePointMatrix, errors);
@ -1394,7 +1394,7 @@ void PDFSelectTableTool::drawPage(QPainter* painter,
if (isTablePicked() && pageIndex == m_pageIndex)
{
PDFPainterStateGuard guard(painter);
QColor color = QColor::fromRgbF(0.0, 0.0, 0.5, 0.2);
QColor color = QColor::fromRgbF(0.0f, 0.0f, 0.5f, 0.2f);
QRectF rectangle = pagePointToDevicePointMatrix.mapRect(m_pickedRectangle);
const PDFReal lineWidth = PDFWidgetUtils::scaleDPI_x(getProxy()->getWidget(), 2.0);
@ -1487,7 +1487,7 @@ void PDFSelectTableTool::mousePressEvent(QWidget* widget, QMouseEvent* event)
}
}
emit getProxy()->repaintNeeded();
Q_EMIT getProxy()->repaintNeeded();
event->accept();
}
}
@ -1671,7 +1671,7 @@ void PDFSelectTableTool::onRectanglePicked(PDFInteger pageIndex, QRectF pageRect
autodetectTableGeometry();
emit messageDisplayRequest(tr("Table region was selected. Use left/right mouse buttons to add/remove rows/columns, then use Enter key to copy the table."), 5000);
Q_EMIT messageDisplayRequest(tr("Table region was selected. Use left/right mouse buttons to add/remove rows/columns, then use Enter key to copy the table."), 5000);
}
void PDFSelectTableTool::autodetectTableGeometry()

View File

@ -166,7 +166,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
protected:
@ -233,7 +233,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
@ -326,7 +326,7 @@ public:
virtual void drawPage(QPainter* painter, PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual void drawPostRendering(QPainter* painter, QRect rect) const override;
virtual void mousePressEvent(QWidget* widget, QMouseEvent* event) override;
@ -393,7 +393,7 @@ public:
PDFInteger pageIndex,
const PDFPrecompiledPage* compiledPage,
PDFTextLayoutGetter& layoutGetter,
const QMatrix& pagePointToDevicePointMatrix,
const QTransform& pagePointToDevicePointMatrix,
QList<PDFRenderError>& errors) const override;
virtual void shortcutOverrideEvent(QWidget* widget, QKeyEvent* event) override;

Some files were not shown because too many files have changed in this diff Show More