Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
1a9bd5b1
Commit
1a9bd5b1
authored
Sep 23, 2010
by
Thomas Hartmann
Browse files
QmlDesigner: Split isAnchoredBy()
Split isAnchoredBy() in isAnchoredBySigbling() and isAnchoredByChildren()
parent
80527b93
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/designercore/include/nodeinstance.h
View file @
1a9bd5b1
...
...
@@ -133,7 +133,8 @@ public:
QVariant
resetVariant
(
const
QString
&
name
)
const
;
bool
hasAnchor
(
const
QString
&
name
)
const
;
bool
isAnchoredBy
()
const
;
bool
isAnchoredBySibling
()
const
;
bool
isAnchoredByChildren
()
const
;
QPair
<
QString
,
NodeInstance
>
anchor
(
const
QString
&
name
)
const
;
int
penWidth
()
const
;
...
...
src/plugins/qmldesigner/designercore/include/qmlitemnode.h
View file @
1a9bd5b1
...
...
@@ -66,7 +66,8 @@ public:
bool
hasShowContent
()
const
;
bool
canReparent
()
const
;
bool
instanceIsAnchoredBy
()
const
;
bool
instanceIsAnchoredBySibling
()
const
;
bool
instanceIsAnchoredByChildren
()
const
;
QRectF
instanceBoundingRect
()
const
;
QTransform
instanceTransform
()
const
;
...
...
src/plugins/qmldesigner/designercore/instances/nodeinstance.cpp
View file @
1a9bd5b1
...
...
@@ -470,9 +470,14 @@ int NodeInstance::penWidth() const
return
m_nodeInstance
->
penWidth
();
}
bool
NodeInstance
::
isAnchoredBy
()
const
bool
NodeInstance
::
isAnchoredBy
Sibling
()
const
{
return
m_nodeInstance
->
isAnchoredBy
();
return
m_nodeInstance
->
isAnchoredBySibling
();
}
bool
NodeInstance
::
isAnchoredByChildren
()
const
{
return
m_nodeInstance
->
isAnchoredByChildren
();
}
QPair
<
QString
,
NodeInstance
>
NodeInstance
::
anchor
(
const
QString
&
name
)
const
...
...
src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp
View file @
1a9bd5b1
...
...
@@ -306,7 +306,12 @@ bool ObjectNodeInstance::hasAnchor(const QString &/*name*/) const
return
false
;
}
bool
ObjectNodeInstance
::
isAnchoredBy
()
const
bool
ObjectNodeInstance
::
isAnchoredBySibling
()
const
{
return
false
;
}
bool
ObjectNodeInstance
::
isAnchoredByChildren
()
const
{
return
false
;
}
...
...
src/plugins/qmldesigner/designercore/instances/objectnodeinstance.h
View file @
1a9bd5b1
...
...
@@ -133,7 +133,8 @@ public:
virtual
bool
hasAnchor
(
const
QString
&
name
)
const
;
virtual
QPair
<
QString
,
NodeInstance
>
anchor
(
const
QString
&
name
)
const
;
virtual
bool
isAnchoredBy
()
const
;
virtual
bool
isAnchoredBySibling
()
const
;
virtual
bool
isAnchoredByChildren
()
const
;
virtual
double
rotation
()
const
;
virtual
double
scale
()
const
;
...
...
src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.cpp
View file @
1a9bd5b1
...
...
@@ -591,8 +591,8 @@ bool isAnchoredTo(QDeclarativeItem *fromItem, QDeclarativeItem *toItem)
bool
areChildrenAnchoredTo
(
QDeclarativeItem
*
fromItem
,
QDeclarativeItem
*
toItem
)
{
foreach
(
Q
Object
*
childObject
,
fromItem
->
child
ren
())
{
QDeclarativeItem
*
childItem
=
qobject_cast
<
QDeclarativeItem
*>
(
childObject
);
foreach
(
Q
GraphicsItem
*
childGraphicsItem
,
fromItem
->
child
Items
())
{
QDeclarativeItem
*
childItem
=
qobject_cast
<
QDeclarativeItem
*>
(
child
GraphicsItem
->
toGraphics
Object
()
);
if
(
childItem
)
{
if
(
isAnchoredTo
(
childItem
,
toItem
))
return
true
;
...
...
@@ -605,14 +605,11 @@ bool areChildrenAnchoredTo(QDeclarativeItem *fromItem, QDeclarativeItem *toItem)
return
false
;
}
bool
QmlGraphicsItemNodeInstance
::
isAnchoredBy
()
const
bool
QmlGraphicsItemNodeInstance
::
isAnchoredBy
Sibling
()
const
{
if
(
areChildrenAnchoredTo
(
qmlGraphicsItem
(),
qmlGraphicsItem
()))
// search in children for a anchor to this item
return
true
;
if
(
qmlGraphicsItem
()
->
parent
())
{
foreach
(
QObject
*
siblingObject
,
qmlGraphicsItem
()
->
parent
()
->
children
())
{
// search in siblings for a anchor to this item
QDeclarativeItem
*
siblingItem
=
qobject_cast
<
QDeclarativeItem
*>
(
siblingObject
);
if
(
qmlGraphicsItem
()
->
parentItem
())
{
foreach
(
QGraphicsItem
*
siblingGraphicsItem
,
qmlGraphicsItem
()
->
parentItem
()
->
childItems
())
{
// search in siblings for a anchor to this item
QDeclarativeItem
*
siblingItem
=
qobject_cast
<
QDeclarativeItem
*>
(
siblingGraphicsItem
->
toGraphicsObject
());
if
(
siblingItem
)
{
if
(
isAnchoredTo
(
siblingItem
,
qmlGraphicsItem
()))
return
true
;
...
...
@@ -626,6 +623,14 @@ bool QmlGraphicsItemNodeInstance::isAnchoredBy() const
return
false
;
}
bool
QmlGraphicsItemNodeInstance
::
isAnchoredByChildren
()
const
{
if
(
areChildrenAnchoredTo
(
qmlGraphicsItem
(),
qmlGraphicsItem
()))
// search in children for a anchor to this item
return
true
;
return
false
;
}
QDeclarativeItem
*
QmlGraphicsItemNodeInstance
::
qmlGraphicsItem
()
const
{
if
(
object
()
==
0
)
...
...
src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.h
View file @
1a9bd5b1
...
...
@@ -64,7 +64,9 @@ public:
bool
hasAnchor
(
const
QString
&
name
)
const
;
QPair
<
QString
,
NodeInstance
>
anchor
(
const
QString
&
name
)
const
;
bool
isAnchoredBy
()
const
;
bool
isAnchoredBySibling
()
const
;
bool
isAnchoredByChildren
()
const
;
protected:
QmlGraphicsItemNodeInstance
(
QDeclarativeItem
*
item
,
bool
hasContent
);
QDeclarativeItem
*
qmlGraphicsItem
()
const
;
...
...
src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
View file @
1a9bd5b1
...
...
@@ -188,12 +188,17 @@ bool QmlItemNode::hasShowContent() const
bool
QmlItemNode
::
canReparent
()
const
{
return
QmlObjectNode
::
canReparent
()
&&
!
anchors
().
instanceHasAnchors
()
&&
!
instanceIsAnchoredBy
();
return
QmlObjectNode
::
canReparent
()
&&
!
anchors
().
instanceHasAnchors
()
&&
!
instanceIsAnchoredBy
Sibling
();
}
bool
QmlItemNode
::
instanceIsAnchoredBy
()
const
bool
QmlItemNode
::
instanceIsAnchoredBy
Sibling
()
const
{
return
nodeInstance
().
isAnchoredBy
();
return
nodeInstance
().
isAnchoredBySibling
();
}
bool
QmlItemNode
::
instanceIsAnchoredByChildren
()
const
{
return
nodeInstance
().
isAnchoredByChildren
();
}
QRectF
QmlItemNode
::
instanceBoundingRect
()
const
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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