Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Winkelmann
QmlSlidePrinter
Commits
8150619d
Commit
8150619d
authored
Nov 20, 2018
by
Michael Winkelmann
Browse files
Error output when there is no item
parent
4d9ddcfb
Changes
1
Hide whitespace changes
Inline
Side-by-side
main.cpp
View file @
8150619d
...
...
@@ -56,13 +56,21 @@ int main(int ac, char *av[]) {
view
->
engine
()
->
addImportPath
(
path
);
view
->
setSource
(
QUrl
::
fromLocalFile
(
inputQml
));
view
->
setGeometry
(
0
,
0
,
view
->
rootObject
()
->
width
(),
view
->
rootObject
()
->
height
());
auto
item
=
view
->
rootObject
();
if
(
!
item
)
{
qInfo
()
<<
QObject
::
tr
(
"No item in QML, no PDF output was produced!"
);
return
EXIT_SUCCESS
;
}
view
->
setGeometry
(
0
,
0
,
int
(
item
->
width
()),
int
(
item
->
height
()));
QTimer
::
singleShot
(
delay
,[
=
]()
{
QmlPrinter
printer
;
qInfo
()
<<
QObject
::
tr
(
"Writing PDF to %1"
).
arg
(
outputPdfDir
.
absolutePath
());
if
(
!
printer
.
printPdf
(
outputPdfDir
.
absolutePath
(),
view
->
rootObject
()
))
{
if
(
!
printer
.
printPdf
(
outputPdfDir
.
absolutePath
(),
item
))
{
qInfo
()
<<
QObject
::
tr
(
"No PDF output was produced!"
);
}
qGuiApp
->
quit
();
...
...
@@ -70,6 +78,5 @@ int main(int ac, char *av[]) {
QDesktopServices
::
openUrl
(
QUrl
::
fromLocalFile
(
outputPdfDir
.
absolutePath
()));
});
return
app
.
exec
();
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment