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
aa5ce3b9
Commit
aa5ce3b9
authored
Jan 11, 2010
by
Marco Bubke
Browse files
Fix the border handling
Task-number: BAUHAUS-259
parent
84732bea
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/resizemanipulator.cpp
View file @
aa5ce3b9
...
...
@@ -185,7 +185,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
boundingRect
.
setTop
(
boundingRect
.
top
()
-
minimumHeight
+
boundingRect
.
height
());
formEditorItem
->
qmlItemNode
().
setSize
(
boundingRect
.
size
());
formEditorItem
->
qmlItemNode
().
setPosition
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
formEditorItem
->
qmlItemNode
().
setPosition
WithBorder
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
if
(
anchors
.
instanceHasAnchor
(
AnchorLine
::
Top
))
{
...
...
@@ -226,7 +226,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
boundingRect
.
setWidth
(
minimumWidth
);
formEditorItem
->
qmlItemNode
().
setSize
(
boundingRect
.
size
());
formEditorItem
->
qmlItemNode
().
setPosition
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
formEditorItem
->
qmlItemNode
().
setPosition
WithBorder
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
if
(
anchors
.
instanceHasAnchor
(
AnchorLine
::
Top
))
{
anchors
.
setMargin
(
AnchorLine
::
Top
,
...
...
@@ -266,7 +266,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
boundingRect
.
setLeft
(
boundingRect
.
left
()
-
minimumWidth
+
boundingRect
.
width
());
formEditorItem
->
qmlItemNode
().
setSize
(
boundingRect
.
size
());
formEditorItem
->
qmlItemNode
().
setPosition
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
formEditorItem
->
qmlItemNode
().
setPosition
WithBorder
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
if
(
anchors
.
instanceHasAnchor
(
AnchorLine
::
Left
))
{
anchors
.
setMargin
(
AnchorLine
::
Left
,
...
...
@@ -320,7 +320,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
boundingRect
.
setTop
(
boundingRect
.
top
()
-
minimumHeight
+
boundingRect
.
height
());
formEditorItem
->
qmlItemNode
().
setSize
(
boundingRect
.
size
());
formEditorItem
->
qmlItemNode
().
setPosition
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
formEditorItem
->
qmlItemNode
().
setPosition
WithBorder
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
if
(
anchors
.
instanceHasAnchor
(
AnchorLine
::
Top
))
{
anchors
.
setMargin
(
AnchorLine
::
Top
,
...
...
@@ -370,7 +370,7 @@ void ResizeManipulator::update(const QPointF& updatePoint, Snapping useSnapping)
boundingRect
.
setLeft
(
boundingRect
.
left
()
-
minimumWidth
+
boundingRect
.
width
());
formEditorItem
->
qmlItemNode
().
setSize
(
boundingRect
.
size
());
formEditorItem
->
qmlItemNode
().
setPosition
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
formEditorItem
->
qmlItemNode
().
setPosition
WithBorder
(
m_beginToParentTransform
.
map
(
boundingRect
.
topLeft
()));
if
(
anchors
.
instanceHasAnchor
(
AnchorLine
::
Left
))
{
anchors
.
setMargin
(
AnchorLine
::
Left
,
...
...
src/plugins/qmldesigner/core/include/nodeinstance.h
View file @
aa5ce3b9
...
...
@@ -129,6 +129,8 @@ public:
bool
isAnchoredBy
()
const
;
QPair
<
QString
,
NodeInstance
>
anchor
(
const
QString
&
name
)
const
;
int
penWidth
()
const
;
private:
// functions
NodeInstance
(
const
QSharedPointer
<
Internal
::
ObjectNodeInstance
>
&
abstractInstance
);
...
...
src/plugins/qmldesigner/core/include/qmlitemnode.h
View file @
aa5ce3b9
...
...
@@ -76,6 +76,7 @@ public:
void
setSize
(
const
QSizeF
&
size
);
void
setPosition
(
const
QPointF
&
position
);
void
setPositionWithBorder
(
const
QPointF
&
position
);
void
selectNode
();
void
deselectNode
();
...
...
src/plugins/qmldesigner/core/instances/nodeinstance.cpp
View file @
aa5ce3b9
...
...
@@ -455,6 +455,11 @@ bool NodeInstance::hasAnchor(const QString &name) const
return
m_nodeInstance
->
hasAnchor
(
name
);
}
int
NodeInstance
::
penWidth
()
const
{
return
m_nodeInstance
->
penWidth
();
}
bool
NodeInstance
::
isAnchoredBy
()
const
{
return
m_nodeInstance
->
isAnchoredBy
();
...
...
src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp
View file @
aa5ce3b9
...
...
@@ -661,6 +661,11 @@ QSizeF ObjectNodeInstance::size() const
return
QSizeF
();
}
int
ObjectNodeInstance
::
penWidth
()
const
{
return
0
;
}
bool
ObjectNodeInstance
::
isVisible
()
const
{
return
false
;
...
...
src/plugins/qmldesigner/core/instances/objectnodeinstance.h
View file @
aa5ce3b9
...
...
@@ -122,6 +122,8 @@ public:
virtual
QTransform
sceneTransform
()
const
;
virtual
double
opacity
()
const
;
virtual
int
penWidth
()
const
;
virtual
bool
hasAnchor
(
const
QString
&
name
)
const
;
virtual
QPair
<
QString
,
NodeInstance
>
anchor
(
const
QString
&
name
)
const
;
virtual
bool
isAnchoredBy
()
const
;
...
...
src/plugins/qmldesigner/core/instances/qmlgraphicsitemnodeinstance.cpp
View file @
aa5ce3b9
...
...
@@ -40,7 +40,7 @@
#include
<private/qmlgraphicsanchors_p.h>
#include
<private/qmlgraphicsanchors_p_p.h>
#include
<private/qmlgraphicsrectangle_p.h>
#include
<private/qmlexpression_p.h>
#include
<cmath>
...
...
@@ -226,6 +226,14 @@ void QmlGraphicsItemNodeInstance::resetVertical()
setPropertyVariant
(
"height"
,
qmlGraphicsItem
()
->
implicitHeight
());
}
int
QmlGraphicsItemNodeInstance
::
penWidth
()
const
{
QmlGraphicsRectangle
*
qmlGraphcisRectangle
=
qobject_cast
<
QmlGraphicsRectangle
*>
(
object
());
if
(
qmlGraphcisRectangle
)
return
qmlGraphcisRectangle
->
border
()
->
width
();
return
GraphicsObjectNodeInstance
::
penWidth
();
}
void
QmlGraphicsItemNodeInstance
::
resetProperty
(
const
QString
&
name
)
{
...
...
src/plugins/qmldesigner/core/instances/qmlgraphicsitemnodeinstance.h
View file @
aa5ce3b9
...
...
@@ -60,6 +60,8 @@ public:
QVariant
property
(
const
QString
&
name
)
const
;
void
resetProperty
(
const
QString
&
name
);
int
penWidth
()
const
;
bool
hasAnchor
(
const
QString
&
name
)
const
;
QPair
<
QString
,
NodeInstance
>
anchor
(
const
QString
&
name
)
const
;
bool
isAnchoredBy
()
const
;
...
...
src/plugins/qmldesigner/core/model/qmlitemnode.cpp
View file @
aa5ce3b9
...
...
@@ -200,8 +200,8 @@ void QmlItemNode::paintInstance(QPainter *painter) const
void
QmlItemNode
::
setSize
(
const
QSizeF
&
size
)
{
RewriterTransaction
transaction
=
qmlModelView
()
->
beginRewriterTransaction
();
setVariantProperty
(
"width"
,
qRound
(
size
.
width
()));
setVariantProperty
(
"height"
,
qRound
(
size
.
height
()));
setVariantProperty
(
"width"
,
qRound
(
size
.
width
())
-
(
nodeInstance
().
penWidth
())
);
setVariantProperty
(
"height"
,
qRound
(
size
.
height
())
-
(
nodeInstance
().
penWidth
())
);
}
void
QmlItemNode
::
setPosition
(
const
QPointF
&
position
)
...
...
@@ -211,6 +211,13 @@ void QmlItemNode::setPosition(const QPointF &position)
setVariantProperty
(
"y"
,
qRound
(
position
.
y
()));
}
void
QmlItemNode
::
setPositionWithBorder
(
const
QPointF
&
position
)
{
RewriterTransaction
transaction
=
qmlModelView
()
->
beginRewriterTransaction
();
setVariantProperty
(
"x"
,
qRound
(
position
.
x
())
+
(
nodeInstance
().
penWidth
()
/
2
));
setVariantProperty
(
"y"
,
qRound
(
position
.
y
())
+
(
nodeInstance
().
penWidth
()
/
2
));
}
void
QmlItemNode
::
selectNode
()
{
modelNode
().
selectNode
();
...
...
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