Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpdflink.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qpdflink.h"
5#include "qpdflink_p.h"
6#include "qpdflinkmodel_p.h"
7#include <QGuiApplication>
8#include <QDebug>
9
11
29
32{
33}
34
35QPdfLink::QPdfLink(int page, QList<QRectF> rects,
36 QString contextBefore, QString contextAfter)
37 : QPdfLink(new QPdfLinkPrivate(page, std::move(rects),
38 std::move(contextBefore),
39 std::move(contextAfter)))
40{
41}
42
44
45QPdfLink::~QPdfLink() = default;
46QPdfLink::QPdfLink(const QPdfLink &other) noexcept = default;
47QPdfLink::QPdfLink(QPdfLink &&other) noexcept = default;
49
56{
57 return d->page >= 0;
58}
59
67int QPdfLink::page() const
68{
69 return d->page;
70}
71
80{
81 return d->location;
82}
83
91{
92 return d->zoom;
93}
94
102{
103 return d->url;
104}
105
115{
116 return d->contextBefore;
117}
118
128{
129 return d->contextAfter;
130}
131
143QList<QRectF> QPdfLink::rectangles() const
144{
145 return d->rects;
146}
147
154{
155 if (d->page <= 0)
156 return d->url.toString();
157 return QPdfLinkModel::tr("Page %1 location %2, %3 zoom %4")
158 .arg(d->page).arg(d->location.x(), 0, 'f', 1).arg(d->location.y(), 0, 'f', 1)
159 .arg(d->zoom, 0, 'f', 0);
160}
161
170
171#ifndef QT_NO_DEBUG_STREAM
173{
174 QDebugStateSaver saver(dbg);
175 dbg.nospace();
176 dbg << "QPdfLink(page=" << link.page()
177 << " location=" << link.location()
178 << " zoom=" << link.zoom()
179 << " contextBefore=" << link.contextBefore()
180 << " contextAfter=" << link.contextAfter()
181 << " rects=" << link.rectangles();
182 dbg << ')';
183 return dbg;
184}
185#endif
186
188
189#include "moc_qpdflink.cpp"
Mode
\keyword clipboard mode
Definition qclipboard.h:27
\inmodule QtCore
\inmodule QtCore
static QClipboard * clipboard()
Returns the object for interacting with the clipboard.
QList< QRectF > rects
Definition qpdflink_p.h:48
QString contextBefore
Definition qpdflink_p.h:45
QString contextAfter
Definition qpdflink_p.h:46
QPointF location
Definition qpdflink_p.h:43
\inmodule QtCore\reentrant
Definition qpoint.h:217
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
Definition qpoint.h:343
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:348
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
Definition qstring.cpp:8870
\inmodule QtCore
Definition qurl.h:94
QString toString(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
Definition qurl.cpp:2831
Combined button and popup list for selecting options.
GLint location
GLenum mode
double qreal
Definition qtypes.h:187
QByteArray page
[45]
QSharedPointer< T > other(t)
[5]