Messagelib

printmessage.h
1/*
2 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "messageviewer_export.h"
10
11#include <QEventLoop>
12#include <QObject>
13#include <QPrinter>
14
15class QWebEngineView;
16namespace MessageViewer
17{
18class MESSAGEVIEWER_EXPORT PrintMessage : public QObject
19{
20 Q_OBJECT
21public:
22 explicit PrintMessage(QObject *parent = nullptr);
23 ~PrintMessage() override;
24
25 void setView(QWebEngineView *view);
26 void setDocumentName(const QString &name);
27
28 void print();
29 void printPreview();
30
31 [[nodiscard]] QString documentName() const;
32
33 [[nodiscard]] QWidget *parentWidget() const;
34 void setParentWidget(QWidget *newParentWidget);
35
36Q_SIGNALS:
37 void printingFinished();
38
39private:
40 MESSAGEVIEWER_NO_EXPORT void printDocument(QPrinter *printer, const QPageLayout &layout);
41 MESSAGEVIEWER_NO_EXPORT void printFinished(bool success);
42 MESSAGEVIEWER_NO_EXPORT void printPreviewDocument(QPrinter *printer);
43 QString mDocumentName;
44 QPrinter mPrinter;
45 QEventLoop mWaitForResult;
46 QWidget *mParentWidget = nullptr;
47 QWebEngineView *mView = nullptr;
48 bool mInPrintPreview = false;
49};
50}
QAction * printPreview(const QObject *recvr, const char *slot, QObject *parent)
const QList< QKeySequence > & print()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.