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
c4a4b35a
Commit
c4a4b35a
authored
Nov 27, 2014
by
Taneli Peltoniemi
Browse files
Changed so that if we take a picture of the area, we won't print the children.
parent
1c18a7b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
qmlprinter.cpp
View file @
c4a4b35a
...
...
@@ -52,6 +52,7 @@ void QmlPrinter::paintItem(QQuickItem *item, QQuickWindow *window, QPainter *pai
if
(
!
item
||
!
item
->
isVisible
())
return
;
bool
drawChildren
=
true
;
if
(
isCustomPrintItem
(
item
->
metaObject
()
->
className
()))
{
painter
->
save
();
if
(
item
->
clip
())
{
...
...
@@ -63,6 +64,7 @@ void QmlPrinter::paintItem(QQuickItem *item, QQuickWindow *window, QPainter *pai
QImage
image
=
window
->
grabWindow
();
painter
->
drawImage
(
rect
.
x
(),
rect
.
y
(),
image
,
rect
.
x
(),
rect
.
y
(),
rect
.
width
(),
rect
.
height
());
painter
->
restore
();
drawChildren
=
false
;
}
else
if
(
item
->
flags
().
testFlag
(
QQuickItem
::
ItemHasContents
))
{
painter
->
save
();
if
(
item
->
clip
())
{
...
...
@@ -85,12 +87,15 @@ void QmlPrinter::paintItem(QQuickItem *item, QQuickWindow *window, QPainter *pai
painter
->
drawImage
(
rect
,
image
,
QRect
(
rect
.
x
(),
rect
.
y
(),
rect
.
width
(),
rect
.
height
()));
}
drawChildren
=
false
;
}
painter
->
restore
();
}
const
QObjectList
children
=
item
->
children
();
foreach
(
QObject
*
obj
,
children
)
{
paintItem
(
qobject_cast
<
QQuickItem
*>
(
obj
),
window
,
painter
);
if
(
drawChildren
)
{
const
QObjectList
children
=
item
->
children
();
foreach
(
QObject
*
obj
,
children
)
{
paintItem
(
qobject_cast
<
QQuickItem
*>
(
obj
),
window
,
painter
);
}
}
}
...
...
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