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
Tobias Hunger
qt-creator
Commits
387f906b
Commit
387f906b
authored
Mar 25, 2010
by
Marco Bubke
Committed by
Kai Koehne
Mar 30, 2010
Browse files
Fix the reflection of the visible property in the Formeditor
Task-Number: BAUHAUS-449
parent
24829c76
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
View file @
387f906b
...
...
@@ -61,7 +61,8 @@ FormEditorItem::FormEditorItem(const QmlItemNode &qmlItemNode, FormEditorScene*
m_snappingLineCreator
(
this
),
m_qmlItemNode
(
qmlItemNode
),
m_borderWidth
(
1.0
),
m_highlightBoundingRect
(
false
)
m_highlightBoundingRect
(
false
),
m_isContentVisible
(
true
)
{
setCacheMode
(
QGraphicsItem
::
DeviceCoordinateCache
);
setup
();
...
...
@@ -79,6 +80,8 @@ void FormEditorItem::setup()
if
(
QGraphicsItem
::
parentItem
()
==
scene
()
->
formLayerItem
())
m_borderWidth
=
0.0
;
setContentVisible
(
qmlItemNode
().
instanceValue
(
"visible"
).
toBool
());
setFlag
(
QGraphicsItem
::
ItemIsMovable
,
true
);
updateGeometry
();
updateVisibilty
();
...
...
@@ -171,6 +174,23 @@ void FormEditorItem::setHighlightBoundingRect(bool highlight)
}
}
void
FormEditorItem
::
setContentVisible
(
bool
visible
)
{
if
(
visible
==
m_isContentVisible
)
return
;
m_isContentVisible
=
visible
;
update
();
}
bool
FormEditorItem
::
isContentVisible
()
const
{
if
(
parentItem
())
return
parentItem
()
->
isContentVisible
()
&&
m_isContentVisible
;
return
m_isContentVisible
;
}
FormEditorItem
::~
FormEditorItem
()
{
scene
()
->
removeItemFromHash
(
this
);
...
...
@@ -248,7 +268,8 @@ void FormEditorItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *,
painter
->
save
();
painter
->
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
qmlItemNode
().
paintInstance
(
painter
);
if
(
isContentVisible
())
qmlItemNode
().
paintInstance
(
painter
);
painter
->
setRenderHint
(
QPainter
::
Antialiasing
,
false
);
...
...
src/plugins/qmldesigner/components/formeditor/formeditoritem.h
View file @
387f906b
...
...
@@ -100,6 +100,9 @@ public:
void
setHighlightBoundingRect
(
bool
highlight
);
void
setContentVisible
(
bool
visible
);
bool
isContentVisible
()
const
;
protected:
AbstractFormEditorTool
*
tool
()
const
;
void
paintBoundingRect
(
QPainter
*
painter
)
const
;
...
...
@@ -122,6 +125,7 @@ private: // variables
QRectF
m_boundingRect
;
double
m_borderWidth
;
bool
m_highlightBoundingRect
;
bool
m_isContentVisible
;
};
...
...
src/plugins/qmldesigner/components/formeditor/formeditorscene.cpp
View file @
387f906b
...
...
@@ -168,6 +168,9 @@ void FormEditorScene::synchronizeOtherProperty(const QmlItemNode &qmlItemNode, c
if
(
propertyName
==
"clip"
)
item
->
setFlag
(
QGraphicsItem
::
ItemClipsChildrenToShape
,
qmlItemNode
.
instanceValue
(
"clip"
).
toBool
());
if
(
propertyName
==
"visible"
)
item
->
setContentVisible
(
qmlItemNode
.
instanceValue
(
"visible"
).
toBool
());
if
(
item
)
item
->
update
();
}
...
...
src/plugins/qmldesigner/core/include/nodeinstance.h
View file @
387f906b
...
...
@@ -119,7 +119,6 @@ public:
QVariant
property
(
const
QString
&
name
)
const
;
QVariant
defaultValue
(
const
QString
&
name
)
const
;
bool
isVisible
()
const
;
bool
isValid
()
const
;
void
makeInvalid
();
bool
hasContent
()
const
;
...
...
@@ -172,9 +171,6 @@ private: // functions
void
paintUpdate
();
void
show
();
void
hide
();
QObject
*
internalObject
()
const
;
// should be not used outside of the nodeinstances!!!!
...
...
src/plugins/qmldesigner/core/instances/graphicsobjectnodeinstance.cpp
View file @
387f906b
...
...
@@ -38,7 +38,6 @@ namespace Internal {
GraphicsObjectNodeInstance
::
GraphicsObjectNodeInstance
(
QGraphicsObject
*
graphicsObject
,
bool
hasContent
)
:
ObjectNodeInstance
(
graphicsObject
),
m_isVisible
(
true
),
m_hasContent
(
hasContent
)
{
}
...
...
@@ -54,16 +53,6 @@ bool GraphicsObjectNodeInstance::hasContent() const
return
m_hasContent
;
}
bool
GraphicsObjectNodeInstance
::
isVisible
()
const
{
return
m_isVisible
;
}
void
GraphicsObjectNodeInstance
::
setVisible
(
bool
isVisible
)
{
m_isVisible
=
isVisible
;
}
QPointF
GraphicsObjectNodeInstance
::
position
()
const
{
return
graphicsObject
()
->
pos
();
...
...
@@ -148,19 +137,11 @@ bool GraphicsObjectNodeInstance::isGraphicsObject() const
void
GraphicsObjectNodeInstance
::
setPropertyVariant
(
const
QString
&
name
,
const
QVariant
&
value
)
{
if
(
name
==
"visible"
)
{
setVisible
(
value
.
toBool
());
return
;
}
ObjectNodeInstance
::
setPropertyVariant
(
name
,
value
);
}
QVariant
GraphicsObjectNodeInstance
::
property
(
const
QString
&
name
)
const
{
if
(
name
==
"visible"
)
return
isVisible
();
return
ObjectNodeInstance
::
property
(
name
);
}
...
...
@@ -187,17 +168,16 @@ void GraphicsObjectNodeInstance::paint(QPainter *painter) const
{
painter
->
save
();
Q_ASSERT
(
graphicsObject
());
if
(
isVisible
())
{
if
(
hasContent
())
graphicsObject
()
->
paint
(
painter
,
0
);
foreach
(
QGraphicsItem
*
graphicsItem
,
graphicsObject
()
->
childItems
())
{
QGraphicsObject
*
graphicsObject
=
qgraphicsitem_cast
<
QGraphicsObject
*>
(
graphicsItem
);
if
(
graphicsObject
&&
!
nodeInstanceView
()
->
hasInstanceForObject
(
graphicsObject
))
paintRecursively
(
graphicsItem
,
painter
);
}
if
(
hasContent
())
graphicsObject
()
->
paint
(
painter
,
0
);
foreach
(
QGraphicsItem
*
graphicsItem
,
graphicsObject
()
->
childItems
())
{
QGraphicsObject
*
graphicsObject
=
qgraphicsitem_cast
<
QGraphicsObject
*>
(
graphicsItem
);
if
(
graphicsObject
&&
!
nodeInstanceView
()
->
hasInstanceForObject
(
graphicsObject
))
paintRecursively
(
graphicsItem
,
painter
);
}
painter
->
restore
();
}
...
...
src/plugins/qmldesigner/core/instances/graphicsobjectnodeinstance.h
View file @
387f906b
...
...
@@ -67,9 +67,6 @@ public:
bool
equalGraphicsItem
(
QGraphicsItem
*
item
)
const
;
bool
isVisible
()
const
;
void
setVisible
(
bool
isVisible
);
void
setPropertyVariant
(
const
QString
&
name
,
const
QVariant
&
value
);
QVariant
property
(
const
QString
&
name
)
const
;
...
...
@@ -82,7 +79,6 @@ protected:
void
paintRecursively
(
QGraphicsItem
*
graphicsItem
,
QPainter
*
painter
)
const
;
static
QPair
<
QGraphicsObject
*
,
bool
>
createGraphicsObject
(
const
NodeMetaInfo
&
metaInfo
,
QDeclarativeContext
*
context
);
private:
// variables
bool
m_isVisible
;
bool
m_hasContent
;
};
...
...
src/plugins/qmldesigner/core/instances/nodeinstance.cpp
View file @
387f906b
...
...
@@ -422,24 +422,6 @@ QVariant NodeInstance::defaultValue(const QString &name) const
return
m_nodeInstance
->
resetValue
(
name
);
}
/*!
\brief Returns if the NodeInstance is visible.
\returns true if the NodeInstance is visible
*/
bool
NodeInstance
::
isVisible
()
const
{
return
m_nodeInstance
->
isVisible
();
}
void
NodeInstance
::
show
()
{
m_nodeInstance
->
setVisible
(
true
);
}
void
NodeInstance
::
hide
()
{
m_nodeInstance
->
setVisible
(
false
);
}
/*!
\brief Returns if the NodeInstance is valid.
\returns true if the NodeInstance is valid
...
...
src/plugins/qmldesigner/core/instances/nodeinstanceview.cpp
View file @
387f906b
...
...
@@ -144,8 +144,7 @@ void NodeInstanceView::modelAboutToBeDetached(Model * model)
*/
void
NodeInstanceView
::
nodeCreated
(
const
ModelNode
&
createdNode
)
{
NodeInstance
instance
(
loadNode
(
createdNode
));
instance
.
show
();
loadNode
(
createdNode
);
}
/*! \brief Notifing the view that a node was created.
...
...
@@ -663,7 +662,6 @@ QRectF NodeInstanceView::sceneRect() const
return
QRectF
();
}
}
QFileSystemWatcher
*
NodeInstanceView
::
fileSystemWatcher
()
{
...
...
@@ -702,3 +700,5 @@ void NodeInstanceView::refreshLocalFileProperty(const QString &path)
}
}
}
}
src/plugins/qmldesigner/core/instances/objectnodeinstance.cpp
View file @
387f906b
...
...
@@ -725,15 +725,6 @@ int ObjectNodeInstance::penWidth() const
return
0
;
}
bool
ObjectNodeInstance
::
isVisible
()
const
{
return
false
;
}
void
ObjectNodeInstance
::
setVisible
(
bool
/*isVisible*/
)
{
}
static
bool
metaObjectHasNotPropertyName
(
NodeInstanceMetaObject
*
metaObject
,
const
QString
&
propertyName
)
{
for
(
int
i
=
0
;
i
<
metaObject
->
count
();
i
++
)
{
...
...
src/plugins/qmldesigner/core/instances/objectnodeinstance.h
View file @
387f906b
...
...
@@ -144,8 +144,6 @@ public:
virtual
QVariant
property
(
const
QString
&
name
)
const
;
virtual
void
resetProperty
(
const
QString
&
name
);
virtual
void
refreshProperty
(
const
QString
&
name
);
virtual
bool
isVisible
()
const
;
virtual
void
setVisible
(
bool
isVisible
);
void
createDynamicProperty
(
const
QString
&
name
,
const
QString
&
typeName
);
void
setDeleteHeldInstance
(
bool
deleteInstance
);
...
...
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