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
aa094ee8
Commit
aa094ee8
authored
Feb 09, 2010
by
Marco Bubke
Browse files
Add feedback for overwritten expressions
parent
3ac38c9f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.cpp
View file @
aa094ee8
...
...
@@ -141,37 +141,53 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
painter
->
restore
();
if
(
m_beginX
!=
m_feedbackNode
.
instanceValue
(
"x"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
if
(
m_beginXHasExpression
!=
m_feedbackNode
.
hasBindingProperty
(
"x"
))
{
painter
->
setPen
(
Qt
::
red
);
}
else
{
if
(
m_beginX
!=
m_feedbackNode
.
instanceValue
(
"x"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
}
painter
->
drawText
(
QPoint
(
2.0
,
12.0
),
QString
(
"x:"
));
painter
->
drawText
(
QPoint
(
14.0
,
12.0
),
m_feedbackNode
.
instanceValue
(
"x"
).
toString
());
if
(
m_beginY
!=
m_feedbackNode
.
instanceValue
(
"y"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
if
(
m_beginYHasExpression
!=
m_feedbackNode
.
hasBindingProperty
(
"y"
))
{
painter
->
setPen
(
Qt
::
red
);
}
else
{
if
(
m_beginY
!=
m_feedbackNode
.
instanceValue
(
"y"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
}
painter
->
drawText
(
QPoint
(
50.0
,
12.0
),
QString
(
"y:"
));
painter
->
drawText
(
QPoint
(
60.0
,
12.0
),
m_feedbackNode
.
instanceValue
(
"y"
).
toString
());
if
(
m_beginWidth
!=
m_feedbackNode
.
instanceValue
(
"width"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
if
(
m_beginWidthHasExpression
!=
m_feedbackNode
.
hasBindingProperty
(
"width"
))
{
painter
->
setPen
(
Qt
::
red
);
}
else
{
if
(
m_beginWidth
!=
m_feedbackNode
.
instanceValue
(
"width"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
}
painter
->
drawText
(
QPoint
(
2.0
,
24.0
),
QString
(
"w:"
));
painter
->
drawText
(
QPoint
(
14.0
,
24.0
),
m_feedbackNode
.
instanceValue
(
"width"
).
toString
());
if
(
m_beginHeight
!=
m_feedbackNode
.
instanceValue
(
"height"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
if
(
m_beginHeightHasExpression
!=
m_feedbackNode
.
hasBindingProperty
(
"height"
))
{
painter
->
setPen
(
Qt
::
red
);
}
else
{
if
(
m_beginHeight
!=
m_feedbackNode
.
instanceValue
(
"height"
))
painter
->
setPen
(
changeColor
);
else
painter
->
setPen
(
Qt
::
black
);
}
painter
->
drawText
(
QPoint
(
50.0
,
24.0
),
QString
(
"h:"
));
painter
->
drawText
(
QPoint
(
60.0
,
24.0
),
m_feedbackNode
.
instanceValue
(
"height"
).
toString
());
...
...
@@ -245,6 +261,10 @@ void FormEditorGraphicsView::setFeedbackNode(const QmlItemNode &node)
m_beginRightMargin
=
m_feedbackNode
.
instanceValue
(
"anchors.rightMargin"
);
m_beginTopMargin
=
m_feedbackNode
.
instanceValue
(
"anchors.topMargin"
);
m_beginBottomMargin
=
m_feedbackNode
.
instanceValue
(
"anchors.bottomMargin"
);
m_beginXHasExpression
=
m_feedbackNode
.
hasBindingProperty
(
"x"
);
m_beginYHasExpression
=
m_feedbackNode
.
hasBindingProperty
(
"y"
);
m_beginWidthHasExpression
=
m_feedbackNode
.
hasBindingProperty
(
"width"
);
m_beginHeightHasExpression
=
m_feedbackNode
.
hasBindingProperty
(
"height"
);
}
else
{
m_beginX
=
QVariant
();
m_beginY
=
QVariant
();
...
...
@@ -255,6 +275,10 @@ void FormEditorGraphicsView::setFeedbackNode(const QmlItemNode &node)
m_beginRightMargin
=
QVariant
();
m_beginTopMargin
=
QVariant
();
m_beginBottomMargin
=
QVariant
();
m_beginXHasExpression
=
false
;
m_beginYHasExpression
=
false
;
m_beginWidthHasExpression
=
false
;
m_beginHeightHasExpression
=
false
;
}
}
...
...
src/plugins/qmldesigner/components/formeditor/formeditorgraphicsview.h
View file @
aa094ee8
...
...
@@ -60,6 +60,10 @@ private:
QVariant
m_beginRightMargin
;
QVariant
m_beginTopMargin
;
QVariant
m_beginBottomMargin
;
bool
m_beginXHasExpression
;
bool
m_beginYHasExpression
;
bool
m_beginWidthHasExpression
;
bool
m_beginHeightHasExpression
;
};
}
// namespace QmlDesigner
...
...
src/plugins/qmldesigner/core/include/qmlobjectnode.h
View file @
aa094ee8
...
...
@@ -65,6 +65,7 @@ public:
QVariant
instanceValue
(
const
QString
&
name
)
const
;
bool
hasProperty
(
const
QString
&
name
)
const
;
bool
hasBindingProperty
(
const
QString
&
name
)
const
;
bool
propertyAffectedByCurrentState
(
const
QString
&
name
)
const
;
QVariant
modelValue
(
const
QString
&
name
)
const
;
bool
isInBaseState
()
const
;
...
...
src/plugins/qmldesigner/core/model/qmlobjectnode.cpp
View file @
aa094ee8
...
...
@@ -102,9 +102,29 @@ bool QmlObjectNode::hasProperty(const QString &name) const
if
(
!
isValid
())
throw
new
InvalidModelNodeException
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
if
(
currentState
().
hasPropertyChanges
(
modelNode
()))
{
QmlPropertyChanges
propertyChanges
=
currentState
().
propertyChanges
(
modelNode
());
if
(
propertyChanges
.
modelNode
().
hasProperty
(
name
))
return
true
;
}
return
modelNode
().
hasProperty
(
name
);
}
bool
QmlObjectNode
::
hasBindingProperty
(
const
QString
&
name
)
const
{
if
(
!
isValid
())
throw
new
InvalidModelNodeException
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
if
(
currentState
().
hasPropertyChanges
(
modelNode
()))
{
QmlPropertyChanges
propertyChanges
=
currentState
().
propertyChanges
(
modelNode
());
if
(
propertyChanges
.
modelNode
().
hasBindingProperty
(
name
))
return
true
;
}
return
modelNode
().
hasBindingProperty
(
name
);
}
NodeAbstractProperty
QmlObjectNode
::
nodeAbstractProperty
(
const
QString
&
name
)
const
{
return
modelNode
().
nodeAbstractProperty
(
name
);
...
...
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