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
Marco Bubke
flatpak-qt-creator
Commits
299f2be2
Commit
299f2be2
authored
Apr 07, 2010
by
Marco Bubke
Committed by
Kai Koehne
Apr 08, 2010
Browse files
Let the designer start nodes which have invalid meta info
This is only a workaround!
parent
bbaf3b18
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/integration/componentview.cpp
View file @
299f2be2
...
...
@@ -116,7 +116,7 @@ void ComponentView::searchForComponentAndAddToList(const ModelNode &node)
item
->
setEditable
(
false
);
m_standardItemModel
->
appendRow
(
item
);
}
}
else
if
(
node
.
metaInfo
().
isComponent
()
&&
!
m_componentList
.
contains
(
node
.
type
()))
{
}
else
if
(
node
.
metaInfo
().
isValid
()
&&
node
.
metaInfo
().
isComponent
()
&&
!
m_componentList
.
contains
(
node
.
type
()))
{
m_componentList
.
append
(
node
.
type
());
m_componentList
.
sort
();
m_listChanged
=
true
;
...
...
src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp
View file @
299f2be2
...
...
@@ -190,7 +190,7 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::createItemRow(const ModelNode &n
QStandardItem
*
idItem
=
new
QStandardItem
;
idItem
->
setDragEnabled
(
true
);
idItem
->
setDropEnabled
(
node
.
metaInfo
().
isContainer
());
idItem
->
setDropEnabled
(
node
.
metaInfo
().
isValid
()
&&
node
.
metaInfo
().
isContainer
());
idItem
->
setEditable
(
true
);
idItem
->
setData
(
hash
,
Qt
::
UserRole
);
...
...
@@ -204,7 +204,7 @@ NavigatorTreeModel::ItemRow NavigatorTreeModel::createItemRow(const ModelNode &n
#endif
QStandardItem
*
visibilityItem
=
new
QStandardItem
;
visibilityItem
->
setDropEnabled
(
node
.
metaInfo
().
isContainer
());
visibilityItem
->
setDropEnabled
(
node
.
metaInfo
().
isValid
()
&&
node
.
metaInfo
().
isContainer
());
visibilityItem
->
setCheckable
(
true
);
visibilityItem
->
setEditable
(
false
);
visibilityItem
->
setData
(
hash
,
Qt
::
UserRole
);
...
...
src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp
View file @
299f2be2
...
...
@@ -165,23 +165,29 @@ void IdItemDelegate::paint(QPainter *painter,
ModelNode
node
=
m_TreeModel
->
nodeForIndex
(
index
);
QIcon
icon
=
node
.
metaInfo
().
icon
();
if
(
icon
.
isNull
())
{
// if node has no own icon, search for it in the itemlibrary
QList
<
ItemLibraryInfo
>
InfoList
=
node
.
metaInfo
().
metaInfo
().
itemLibraryRepresentations
(
node
.
metaInfo
());
foreach
(
const
ItemLibraryInfo
&
entry
,
InfoList
)
QIcon
icon
;
if
(
node
.
metaInfo
().
isValid
())
{
icon
=
node
.
metaInfo
().
icon
();
if
(
icon
.
isNull
())
{
if
(
entry
.
typeName
()
==
node
.
metaInfo
().
typeName
())
{
icon
=
entry
.
icon
();
break
;
// if node has no own icon, search for it in the itemlibrary
QList
<
ItemLibraryInfo
>
InfoList
=
node
.
metaInfo
().
metaInfo
().
itemLibraryRepresentations
(
node
.
metaInfo
());
foreach
(
const
ItemLibraryInfo
&
entry
,
InfoList
)
{
if
(
entry
.
typeName
()
==
node
.
metaInfo
().
typeName
())
{
icon
=
entry
.
icon
();
break
;
}
}
}
// if the library was also empty, use the default icon
if
(
icon
.
isNull
())
icon
=
QIcon
(
":/ItemLibrary/images/item-default-icon.png"
);
// if the library was also empty, use the default icon
}
}
if
(
icon
.
isNull
())
icon
=
QIcon
(
":/ItemLibrary/images/item-default-icon.png"
);
// If no icon is present, leave an empty space of 24 pixels anyway
int
pixmapSide
=
16
;
QPixmap
pixmap
=
icon
.
pixmap
(
pixmapSide
,
pixmapSide
);
...
...
src/plugins/qmldesigner/core/instances/dummynodeinstance.cpp
View file @
299f2be2
...
...
@@ -38,16 +38,12 @@ namespace QmlDesigner {
namespace
Internal
{
DummyNodeInstance
::
DummyNodeInstance
()
:
ObjectNodeInstance
(
0
)
:
ObjectNodeInstance
(
new
QObject
)
{
}
DummyNodeInstance
::
Pointer
DummyNodeInstance
::
create
(
const
NodeMetaInfo
&
metaInfo
,
QDeclarativeContext
*
context
)
DummyNodeInstance
::
Pointer
DummyNodeInstance
::
create
()
{
Q_UNUSED
(
context
);
qWarning
()
<<
"DummyNodeInstance created"
<<
metaInfo
.
typeName
();
foreach
(
const
NodeMetaInfo
&
metaInfo
,
metaInfo
.
superClasses
())
qWarning
()
<<
"
\t
"
<<
metaInfo
.
typeName
();
return
Pointer
(
new
DummyNodeInstance
);
}
...
...
@@ -104,17 +100,10 @@ QStringList DummyNodeInstance::localProperties()
return
QStringList
();
}
bool
DummyNodeInstance
::
i
sVisible
()
const
void
DummyNodeInstance
::
i
nitializePropertyWatcher
(
const
ObjectNodeInstance
::
Pointer
&
/*objectNodeInstance*/
)
{
return
false
;
}
void
DummyNodeInstance
::
setVisible
(
bool
/*isVisible*/
)
{
Q_ASSERT_X
(
0
,
Q_FUNC_INFO
,
"Cannot set a dummy node instance to visible/non-visible"
);
throw
InvalidNodeInstanceException
(
__LINE__
,
__FUNCTION__
,
__FILE__
);
}
}
// namespace Internal
}
// namespace QmlDesigner
src/plugins/qmldesigner/core/instances/dummynodeinstance.h
View file @
299f2be2
...
...
@@ -43,7 +43,7 @@ public:
typedef
QSharedPointer
<
DummyNodeInstance
>
Pointer
;
typedef
QWeakPointer
<
DummyNodeInstance
>
WeakPointer
;
static
Pointer
create
(
const
NodeMetaInfo
&
metaInfo
,
QDeclarativeContext
*
context
);
static
Pointer
create
();
void
paint
(
QPainter
*
painter
)
const
;
...
...
@@ -56,12 +56,12 @@ public:
double
opacity
()
const
;
void
setPropertyVariant
(
const
QString
&
name
,
const
QVariant
&
value
);
void
setBindingProperty
(
const
QString
&
name
,
const
QString
&
expression
);
QVariant
property
(
const
QString
&
name
)
const
;
QStringList
properties
();
QStringList
localProperties
();
bool
isVisible
()
const
;
void
setVisible
(
bool
isVisible
);
void
initializePropertyWatcher
(
const
ObjectNodeInstance
::
Pointer
&
objectNodeInstance
);
protected:
DummyNodeInstance
();
...
...
src/plugins/qmldesigner/core/instances/nodeinstance.cpp
View file @
299f2be2
...
...
@@ -132,7 +132,13 @@ Internal::ObjectNodeInstance::Pointer NodeInstance::createInstance(const NodeMet
{
Internal
::
ObjectNodeInstance
::
Pointer
instance
;
if
(
metaInfo
.
isSubclassOf
(
"Qt/QGraphicsView"
,
4
,
6
))
if
(
!
metaInfo
.
isValid
())
instance
=
Internal
::
DummyNodeInstance
::
create
();
else
if
(
metaInfo
.
isSubclassOf
(
"org.webkit/WebView"
,
1
,
0
))
instance
=
Internal
::
DummyNodeInstance
::
create
();
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/QWidget"
,
4
,
6
))
instance
=
Internal
::
DummyNodeInstance
::
create
();
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/QGraphicsView"
,
4
,
6
))
instance
=
Internal
::
GraphicsViewNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/QDeclarativeView"
,
4
,
6
))
instance
=
Internal
::
QDeclarativeViewNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
...
...
@@ -140,8 +146,6 @@ Internal::ObjectNodeInstance::Pointer NodeInstance::createInstance(const NodeMet
instance
=
Internal
::
GraphicsWidgetNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/Item"
,
4
,
6
))
instance
=
Internal
::
QmlGraphicsItemNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/QWidget"
,
4
,
6
))
instance
=
Internal
::
WidgetNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/QGraphicsScene"
,
4
,
6
))
instance
=
Internal
::
GraphicsSceneNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/Component"
,
4
,
6
))
...
...
@@ -156,10 +160,9 @@ Internal::ObjectNodeInstance::Pointer NodeInstance::createInstance(const NodeMet
instance
=
Internal
::
BehaviorNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
else
if
(
metaInfo
.
isSubclassOf
(
"Qt/QtObject"
,
4
,
6
))
instance
=
Internal
::
ObjectNodeInstance
::
create
(
metaInfo
,
context
,
objectToBeWrapped
);
else
instance
=
Internal
::
DummyNodeInstance
::
create
();
if
(
instance
.
isNull
())
{
instance
=
Internal
::
DummyNodeInstance
::
create
(
metaInfo
,
context
);
}
return
instance
;
}
...
...
src/plugins/qmldesigner/core/instances/nodeinstanceview.cpp
View file @
299f2be2
...
...
@@ -401,8 +401,6 @@ void NodeInstanceView::loadNodes(const QList<ModelNode> &nodeList)
// TODO: Set base state as current model state
void
NodeInstanceView
::
loadModel
(
Model
*
model
)
{
Q_ASSERT
(
rootModelNode
().
isValid
());
removeAllInstanceNodeRelationships
();
engine
()
->
rootContext
()
->
setBaseUrl
(
model
->
fileUrl
());
...
...
@@ -602,7 +600,6 @@ void NodeInstanceView::emitParentChanged(QObject *child)
NodeInstance
NodeInstanceView
::
loadNode
(
const
ModelNode
&
node
,
QObject
*
objectToBeWrapped
)
{
Q_ASSERT
(
node
.
isValid
());
NodeInstance
instance
(
NodeInstance
::
create
(
this
,
node
,
objectToBeWrapped
));
insertInstanceNodeRelationship
(
node
,
instance
);
...
...
src/plugins/qmldesigner/core/instances/objectnodeinstance.h
View file @
299f2be2
...
...
@@ -95,7 +95,7 @@ public:
NodeInstanceView
*
nodeInstanceView
()
const
;
void
setNodeInstanceView
(
NodeInstanceView
*
view
);
void
initializePropertyWatcher
(
const
Pointer
&
objectNodeInstance
);
virtual
void
initializePropertyWatcher
(
const
Pointer
&
objectNodeInstance
);
virtual
void
paint
(
QPainter
*
painter
)
const
;
virtual
bool
isTopLevel
()
const
;
...
...
src/plugins/qmldesigner/core/model/modelnode.cpp
View file @
299f2be2
...
...
@@ -250,7 +250,7 @@ A node might become invalid if e.g. it or one of its ancestors is deleted.
*/
bool
ModelNode
::
isValid
()
const
{
return
!
m_model
.
isNull
()
&&
!
m_view
.
isNull
()
&&
m_internalNode
&&
m_internalNode
->
isValid
();
return
!
m_model
.
isNull
()
&&
!
m_view
.
isNull
()
&&
m_internalNode
&&
m_internalNode
->
isValid
()
/*&& model()->metaInfo().hasNodeMetaInfo(m_internalNode->type(), m_internalNode->majorVersion(), m_internalNode->minorVersion())*/
;
}
/*!
...
...
src/plugins/qmldesigner/core/model/qmlitemnode.cpp
View file @
299f2be2
...
...
@@ -45,7 +45,7 @@ namespace QmlDesigner {
bool
QmlItemNode
::
isValid
()
const
{
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt/Item"
,
4
,
6
);
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt/Item"
,
4
,
6
);
}
bool
QmlItemNode
::
isRootNode
()
const
...
...
src/plugins/qmldesigner/core/model/qmlstate.cpp
View file @
299f2be2
...
...
@@ -228,6 +228,7 @@ void QmlModelState::setName(const QString &name)
bool
QmlModelState
::
isValid
()
const
{
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isValid
()
&&
(
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt/State"
,
4
,
6
)
||
isBaseState
());
}
...
...
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