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
Office
Calligra
Commits
044ce0f8
Commit
044ce0f8
authored
Apr 04, 2012
by
Halla Rempt
Browse files
Don't crash when d&d'ing a shape layer
The content of the shape layer isn't visible yet, though. CCBUG:297393
parent
2c1593ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
krita/image/kis_layer.cc
View file @
044ce0f8
...
...
@@ -190,7 +190,7 @@ void KisLayer::disableAlphaChannel(bool disable)
{
if
(
m_d
->
channelFlags
.
isEmpty
())
m_d
->
channelFlags
=
colorSpace
()
->
channelFlags
(
true
,
true
);
if
(
disable
)
m_d
->
channelFlags
&=
colorSpace
()
->
channelFlags
(
true
,
false
);
else
...
...
@@ -232,6 +232,7 @@ KisImageWSP KisLayer::image() const
void
KisLayer
::
setImage
(
KisImageWSP
image
)
{
qDebug
()
<<
">>>>>>>>>>>> "
<<
kisimage
;
m_d
->
image
=
image
;
for
(
uint
i
=
0
;
i
<
childCount
();
++
i
)
{
// Only layers know about the image
...
...
krita/image/kis_layer.h
View file @
044ce0f8
...
...
@@ -165,7 +165,7 @@ public:
/**
* Set the image this layer belongs to.
*/
void
setImage
(
KisImageWSP
image
);
virtual
void
setImage
(
KisImageWSP
image
);
/**
* Clones should be informed about updates of the original
...
...
krita/ui/flake/kis_shape_layer.cc
View file @
044ce0f8
...
...
@@ -87,7 +87,9 @@
class
ShapeLayerContainerModel
:
public
SimpleShapeContainerModel
{
public:
ShapeLayerContainerModel
(
KisShapeLayer
*
parent
)
:
q
(
parent
)
{}
ShapeLayerContainerModel
(
KisShapeLayer
*
parent
)
:
q
(
parent
)
{}
void
add
(
KoShape
*
child
)
{
SimpleShapeContainerModel
::
add
(
child
);
...
...
@@ -107,7 +109,13 @@ private:
struct
KisShapeLayer
::
Private
{
public:
Private
()
:
x
(
0
),
y
(
0
)
{}
Private
()
:
converter
(
0
)
,
canvas
(
0
)
,
controller
(
0
)
,
x
(
0
)
,
y
(
0
)
{}
KoViewConverter
*
converter
;
KisPaintDeviceSP
paintDevice
;
...
...
@@ -158,7 +166,7 @@ KisShapeLayer::~KisShapeLayer()
* Small hack alert: we set the image to null to disable
* updates those will be emitted on shape deletion
*/
setImage
(
0
);
KisLayer
::
setImage
(
0
);
foreach
(
KoShape
*
shape
,
shapes
())
{
shape
->
setParent
(
0
);
...
...
@@ -179,6 +187,8 @@ void KisShapeLayer::initShapeLayer(KoShapeBasedDocumentBase* controller)
m_d
->
canvas
->
setProjection
(
m_d
->
paintDevice
);
m_d
->
controller
=
controller
;
m_d
->
canvas
->
shapeManager
()
->
selection
()
->
disconnect
(
this
);
connect
(
m_d
->
canvas
->
shapeManager
()
->
selection
(),
SIGNAL
(
selectionChanged
()),
this
,
SIGNAL
(
selectionChanged
()));
connect
(
m_d
->
canvas
->
shapeManager
()
->
selection
(),
SIGNAL
(
currentLayerChanged
(
const
KoShapeLayer
*
)),
this
,
SIGNAL
(
currentLayerChanged
(
const
KoShapeLayer
*
)));
...
...
@@ -190,6 +200,14 @@ bool KisShapeLayer::allowAsChild(KisNodeSP node) const
return
node
->
inherits
(
"KisMask"
);
}
void
KisShapeLayer
::
setImage
(
KisImageWSP
_image
)
{
KisLayer
::
setImage
(
_image
);
delete
m_d
->
converter
;
m_d
->
converter
=
new
KisImageViewConverter
(
image
());
m_d
->
paintDevice
=
new
KisPaintDevice
(
image
()
->
colorSpace
());
}
QIcon
KisShapeLayer
::
icon
()
const
{
return
KIcon
(
"bookmark-new"
);
...
...
krita/ui/flake/kis_shape_layer.h
View file @
044ce0f8
...
...
@@ -66,6 +66,8 @@ public:
}
bool
allowAsChild
(
KisNodeSP
)
const
;
virtual
void
setImage
(
KisImageWSP
image
);
public:
// KoShape overrides
...
...
krita/ui/kis_view2.cpp
View file @
044ce0f8
...
...
@@ -432,7 +432,8 @@ void KisView2::dragEnterEvent(QDragEnterEvent *event)
void
KisView2
::
dropEvent
(
QDropEvent
*
event
)
{
KisImageWSP
kisimage
=
image
();
KisImageSP
kisimage
=
image
();
QPointF
pos
=
kisimage
->
documentToIntPixel
(
m_d
->
viewConverter
->
viewToDocument
(
event
->
pos
()
+
m_d
->
canvas
->
documentOffset
()
-
m_d
->
canvas
->
documentOrigin
()));
if
(
event
->
mimeData
()
->
hasFormat
(
"application/x-krita-node"
)
||
event
->
mimeData
()
->
hasImage
())
...
...
@@ -450,9 +451,9 @@ void KisView2::dropEvent(QDropEvent *event)
node
=
tempImage
->
rootLayer
()
->
firstChild
();
tempImage
->
removeNode
(
node
);
// layers store a li
s
k to the image, so update it
// layers store a li
n
k to the image, so update it
KisLayer
*
layer
=
dynamic_cast
<
KisLayer
*>
(
node
.
data
());
if
(
layer
)
{
if
(
layer
)
{
layer
->
setImage
(
kisimage
);
}
...
...
Write
Preview
Markdown
is supported
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