-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.qml
More file actions
80 lines (69 loc) · 2.09 KB
/
main.qml
File metadata and controls
80 lines (69 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import QtQuick 2.6
import QtQuick.Controls 2.0
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
Window {
id: rootwin
visible: true
width: 1280
height: 960
title: qsTr("Pdf View")
Button {
text: qsTr("打开PDF")
onClicked: {
if (Qt.platform.os === "osx") {
PdfProvider.loadFile("../../../210207_Client@xuin.pdf",
rootwin.width, rootwin.height, 0)
} else {
PdfProvider.loadFile("210207_Client@xuin.pdf",
rootwin.width, rootwin.height, 0)
}
pdfModel.clear()
for (var i=0;i<PdfProvider.pageCnt;++i) {
pdfModel.append({"page": i})
}
pdfView.visible = true;
}
}
ListModel {
id: pdfModel;
}
Rectangle {
id: pdfView
visible: false
width: parent.width
anchors.top: parent.top
anchors.bottom: parent.bottom
color: "#E4E7ED"
clip: true
ListView {
width: parent.width
height: parent.height
topMargin: 32
bottomMargin: 32
spacing: 24
model: pdfModel
delegate: Item {
id: content
width: 953;height: 1347
anchors.horizontalCenter: parent.horizontalCenter
RectangularGlow {
id: effect
anchors.centerIn: content;
width: content.width - glowRadius - glowRadius * spread
height: content.height - glowRadius - glowRadius * spread
glowRadius: 80
spread: 0.02
color: "#CFCFCF"
cornerRadius: 0
}
Image {
anchors.fill: parent;
fillMode: Image.PreserveAspectFit
source: "image://pdfpage/" + String(page)
}
}
ScrollBar.vertical: ScrollBar { width: 16 }
}
}
}