Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
helpviewerimpl_p.h
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4
#
ifndef
HELPVIEWERIMPLPRIVATE_H
5
#
define
HELPVIEWERIMPLPRIVATE_H
6
7
#
include
"centralwidget.h"
8
#
include
"helpviewer.h"
9
#
include
"openpagesmanager.h"
10
11
#
include
<
QtCore
/
QObject
>
12
#
if
defined
(
BROWSER_QTEXTBROWSER
)
13
#
include
<
QtWidgets
/
QTextBrowser
>
14
#
elif
defined
(
BROWSER_QTWEBKIT
)
15
#
include
<
QtGui
/
QGuiApplication
>
16
#
include
<
QtGui
/
QScreen
>
17
#
endif
// BROWSER_QTWEBKIT
18
19
QT_BEGIN_NAMESPACE
20
21
using
namespace
Qt::StringLiterals;
22
23
class
HelpViewerImpl::HelpViewerImplPrivate :
public
QObject
24
{
25
Q_OBJECT
26
27
public
:
28
#
if
defined
(
BROWSER_QTEXTBROWSER
)
29
HelpViewerImplPrivate(
int
zoom)
30
: zoomCount(zoom)
31
{ }
32
#
elif
defined
(
BROWSER_QTWEBKIT
)
33
HelpViewerImplPrivate()
34
{
35
// The web uses 96dpi by default on the web to preserve the font size across platforms, but
36
// since we control the content for the documentation, we want the system DPI to be used.
37
// - OS X reports 72dpi but doesn't allow changing the DPI, ignore anything below a 1.0 ratio to handle this.
38
// - On Windows and Linux don't zoom the default web 96dpi below a 1.25 ratio to avoid
39
// filtered images in the doc unless the font readability difference is considerable.
40
webDpiRatio = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.;
41
if
(webDpiRatio < 1.25)
42
webDpiRatio = 1.0;
43
}
44
#
endif
// BROWSER_QTWEBKIT
45
46
#
if
defined
(
BROWSER_QTEXTBROWSER
)
47
bool
hasAnchorAt(QTextBrowser *browser,
const
QPoint& pos)
48
{
49
lastAnchor = browser->anchorAt(pos);
50
if
(lastAnchor.isEmpty())
51
return
false
;
52
53
lastAnchor = browser->source().resolved(QUrl(lastAnchor)).toString();
54
if
(lastAnchor.at(0) == u'#') {
55
QString src = browser->source().toString();
56
int
hsh = src.indexOf(u'#');
57
lastAnchor = (hsh >= 0 ? src.left(hsh) : src) + lastAnchor;
58
}
59
return
true
;
60
}
61
62
public
slots:
63
void
openLink()
64
{
65
doOpenLink(
false
);
66
}
67
68
void
openLinkInNewPage()
69
{
70
doOpenLink(
true
);
71
}
72
73
public
:
74
QString lastAnchor;
75
int
zoomCount;
76
bool
forceFont =
false
;
77
78
private
:
79
80
void
doOpenLink(
bool
newPage)
81
{
82
if
(lastAnchor.isEmpty())
83
return
;
84
if
(newPage)
85
OpenPagesManager::instance()->createPage(QUrl(lastAnchor));
86
else
87
CentralWidget::instance()->setSource(QUrl(lastAnchor));
88
lastAnchor.clear();
89
}
90
91
#
elif
defined
(
BROWSER_QTWEBKIT
)
92
qreal webDpiRatio;
93
#
endif
// BROWSER_QTWEBKIT
94
};
95
96
QT_END_NAMESPACE
97
98
#
endif
// HELPVIEWERIMPLPRIVATE_H
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
TRACE_OBJ
#define TRACE_OBJ
Definition
tracer.h:34
qttools
src
assistant
assistant
helpviewerimpl_p.h
Generated on
for Qt by
1.18.0