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
0a02b85e
Commit
0a02b85e
authored
Mar 01, 2011
by
Thomas Hartmann
Browse files
QmlDesigner: get rid of Qt/ - use QtQuick/ instead
Qt 4.7 imports are converted to QtQuick 1.0 imports.
parent
26a3014e
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp
View file @
0a02b85e
...
...
@@ -327,7 +327,7 @@ QString FormEditorWidget::contextHelpId() const
QString
helpId
;
if
(
!
nodes
.
isEmpty
())
{
helpId
=
nodes
.
first
().
type
();
helpId
.
replace
(
"Qt/"
,
"QML."
);
helpId
.
replace
(
"Qt
Quick
/"
,
"QML."
);
}
return
helpId
;
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontroller.cpp
View file @
0a02b85e
...
...
@@ -275,7 +275,7 @@ QList<RewriterView::Error> DesignDocumentController::loadMaster(QPlainTextEdit *
//m_d->masterModel = Model::create(m_d->textModifier, m_d->searchPath, errors);
m_d
->
masterModel
=
Model
::
create
(
"Qt/Rectangle"
,
4
,
7
);
m_d
->
masterModel
=
Model
::
create
(
"Qt
Quick
/Rectangle"
,
1
,
0
);
#if defined(VIEWLOGGER)
m_d
->
viewLogger
=
new
Internal
::
ViewLogger
(
m_d
->
model
.
data
());
...
...
@@ -284,7 +284,7 @@ QList<RewriterView::Error> DesignDocumentController::loadMaster(QPlainTextEdit *
m_d
->
masterModel
->
setFileUrl
(
m_d
->
searchPath
);
m_d
->
subComponentModel
=
Model
::
create
(
"Qt/Rectangle"
,
4
,
7
);
m_d
->
subComponentModel
=
Model
::
create
(
"Qt
Quick
/Rectangle"
,
1
,
0
);
m_d
->
subComponentModel
->
setFileUrl
(
m_d
->
searchPath
);
m_d
->
subComponentManager
=
new
SubComponentManager
(
m_d
->
masterModel
->
metaInfo
(),
this
);
...
...
@@ -775,7 +775,7 @@ QString DesignDocumentController::contextHelpId() const
QString
helpId
;
if
(
!
nodes
.
isEmpty
())
{
helpId
=
nodes
.
first
().
type
();
helpId
.
replace
(
"Qt/"
,
"QML."
);
helpId
.
replace
(
"Qt
Quick
/"
,
"QML."
);
}
return
helpId
;
...
...
src/plugins/qmldesigner/components/integration/designdocumentcontrollerview.cpp
View file @
0a02b85e
...
...
@@ -155,7 +155,7 @@ void DesignDocumentControllerView::fromClipboard()
QString
DesignDocumentControllerView
::
toText
()
const
{
QScopedPointer
<
Model
>
outputModel
(
Model
::
create
(
"Qt/Rectangle"
));
QScopedPointer
<
Model
>
outputModel
(
Model
::
create
(
"Qt
Quick
/Rectangle"
,
1
,
0
));
outputModel
->
setMetaInfo
(
model
()
->
metaInfo
());
QPlainTextEdit
textEdit
;
textEdit
.
setPlainText
(
"import Qt 4.7; Item {}"
);
...
...
@@ -177,7 +177,7 @@ QString DesignDocumentControllerView::toText() const
void
DesignDocumentControllerView
::
fromText
(
QString
text
)
{
QScopedPointer
<
Model
>
inputModel
(
Model
::
create
(
"Qt/Rectangle"
));
QScopedPointer
<
Model
>
inputModel
(
Model
::
create
(
"Qt
Quick
/Rectangle"
,
1
,
0
));
inputModel
->
setMetaInfo
(
model
()
->
metaInfo
());
inputModel
->
setFileUrl
(
model
()
->
fileUrl
());
QPlainTextEdit
textEdit
;
...
...
src/plugins/qmldesigner/components/propertyeditor/gradientlineqmladaptor.cpp
View file @
0a02b85e
...
...
@@ -131,13 +131,13 @@ void GradientLineQmlAdaptor::writeGradient()
modelNode
.
removeProperty
(
gradientName
());
}
ModelNode
gradientNode
=
modelNode
.
view
()
->
createModelNode
(
"Qt/Gradient"
,
4
,
7
);
ModelNode
gradientNode
=
modelNode
.
view
()
->
createModelNode
(
"Qt
Quick
/Gradient"
,
1
,
0
);
if
(
!
oldId
.
isNull
())
gradientNode
.
setId
(
oldId
);
for
(
int
i
=
0
;
i
<
stops
.
size
();
i
++
)
{
ModelNode
gradientStopNode
=
modelNode
.
view
()
->
createModelNode
(
"Qt/GradientStop"
,
4
,
7
);
ModelNode
gradientStopNode
=
modelNode
.
view
()
->
createModelNode
(
"Qt
Quick
/GradientStop"
,
1
,
0
);
gradientStopNode
.
variantProperty
(
"position"
)
=
roundReal
(
stops
.
at
(
i
).
first
);
gradientStopNode
.
variantProperty
(
"color"
)
=
normalizeColor
(
stops
.
at
(
i
).
second
);
gradientNode
.
nodeListProperty
(
"stops"
).
reparentHere
(
gradientStopNode
);
...
...
src/plugins/qmldesigner/components/propertyeditor/propertyeditor.cpp
View file @
0a02b85e
...
...
@@ -509,8 +509,8 @@ void PropertyEditor::updateSize()
void
PropertyEditor
::
setupPanes
()
{
QApplication
::
setOverrideCursor
(
QCursor
(
Qt
::
WaitCursor
));
setupPane
(
"Qt/Rectangle"
);
setupPane
(
"Qt/Text"
);
setupPane
(
"Qt
Quick
/Rectangle"
);
setupPane
(
"Qt
Quick
/Text"
);
resetView
();
m_setupCompleted
=
true
;
QApplication
::
restoreOverrideCursor
();
...
...
@@ -884,7 +884,8 @@ QString PropertyEditor::qmlFileName(const NodeMetaInfo &nodeInfo) const
{
if
(
nodeInfo
.
typeName
().
split
(
'/'
).
last
()
==
"QDeclarativeItem"
)
return
"Qt/ItemPane.qml"
;
return
nodeInfo
.
typeName
()
+
QLatin1String
(
"Pane.qml"
);
const
QString
fixedTypeName
=
nodeInfo
.
typeName
().
replace
(
"QtQuick/"
,
"Qt/"
);
return
fixedTypeName
+
QLatin1String
(
"Pane.qml"
);
}
QUrl
PropertyEditor
::
fileToUrl
(
const
QString
&
filePath
)
const
{
...
...
src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
View file @
0a02b85e
...
...
@@ -76,7 +76,7 @@ void StatesEditorView::removeState(int nodeId)
try
{
if
(
nodeId
>
0
&&
hasModelNodeForInternalId
(
nodeId
))
{
ModelNode
stateNode
(
modelNodeForInternalId
(
nodeId
));
Q_ASSERT
(
stateNode
.
metaInfo
().
isSubclassOf
(
"QtQuick/State"
,
4
,
7
));
Q_ASSERT
(
stateNode
.
metaInfo
().
isSubclassOf
(
"QtQuick/State"
,
-
1
,
-
1
));
NodeListProperty
parentProperty
=
stateNode
.
parentProperty
().
toNodeListProperty
();
if
(
parentProperty
.
count
()
<=
1
)
{
...
...
src/plugins/qmldesigner/designercore/instances/nodeinstanceserver.cpp
View file @
0a02b85e
...
...
@@ -612,7 +612,7 @@ void NodeInstanceServer::resetInstanceProperty(const PropertyAbstractContainer &
const
QString
name
=
propertyContainer
.
name
();
if
(
activeStateInstance
().
isValid
()
&&
!
instance
.
isSubclassOf
(
"Qt/PropertyChanges"
))
{
if
(
activeStateInstance
().
isValid
()
&&
!
instance
.
isSubclassOf
(
"Qt
Quick
/PropertyChanges"
))
{
bool
statePropertyWasReseted
=
activeStateInstance
().
resetStateProperty
(
instance
,
name
,
instance
.
resetVariant
(
name
));
if
(
!
statePropertyWasReseted
)
instance
.
resetProperty
(
name
);
...
...
@@ -632,7 +632,7 @@ void NodeInstanceServer::setInstancePropertyBinding(const PropertyBindingContain
const
QString
expression
=
bindingContainer
.
expression
();
if
(
activeStateInstance
().
isValid
()
&&
!
instance
.
isSubclassOf
(
"Qt/PropertyChanges"
))
{
if
(
activeStateInstance
().
isValid
()
&&
!
instance
.
isSubclassOf
(
"Qt
Quick
/PropertyChanges"
))
{
bool
stateBindingWasUpdated
=
activeStateInstance
().
updateStateBinding
(
instance
,
name
,
expression
);
if
(
!
stateBindingWasUpdated
)
{
if
(
bindingContainer
.
isDynamic
())
...
...
@@ -666,7 +666,7 @@ void NodeInstanceServer::setInstancePropertyVariant(const PropertyValueContainer
const
QVariant
value
=
valueContainer
.
value
();
if
(
activeStateInstance
().
isValid
()
&&
!
instance
.
isSubclassOf
(
"Qt/PropertyChanges"
))
{
if
(
activeStateInstance
().
isValid
()
&&
!
instance
.
isSubclassOf
(
"Qt
Quick
/PropertyChanges"
))
{
bool
stateValueWasUpdated
=
activeStateInstance
().
updateStateVariant
(
instance
,
name
,
value
);
if
(
!
stateValueWasUpdated
)
{
if
(
valueContainer
.
isDynamic
())
...
...
src/plugins/qmldesigner/designercore/model/model.cpp
View file @
0a02b85e
...
...
@@ -95,7 +95,7 @@ ModelPrivate::ModelPrivate(Model *model) :
m_writeLock
(
false
),
m_internalIdCounter
(
1
)
{
m_rootInternalNode
=
createNode
(
"Qt/Item"
,
4
,
7
,
PropertyListType
(),
true
);
m_rootInternalNode
=
createNode
(
"Qt
Quick
/Item"
,
1
,
0
,
PropertyListType
(),
true
);
}
ModelPrivate
::~
ModelPrivate
()
...
...
src/plugins/qmldesigner/designercore/model/qmlchangeset.cpp
View file @
0a02b85e
...
...
@@ -55,12 +55,12 @@ void QmlModelStateOperation::setTarget(const ModelNode &target)
bool
QmlPropertyChanges
::
isValid
()
const
{
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt/PropertyChanges"
,
4
,
7
);
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt
Quick
/PropertyChanges"
,
-
1
,
-
1
);
}
bool
QmlModelStateOperation
::
isValid
()
const
{
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"QDeclarativeStateOperation"
,
4
,
7
);
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"
Qt/
QDeclarativeStateOperation"
,
-
1
,
-
1
);
}
void
QmlPropertyChanges
::
removeProperty
(
const
QString
&
name
)
...
...
src/plugins/qmldesigner/designercore/model/qmlitemnode.cpp
View file @
0a02b85e
...
...
@@ -50,7 +50,7 @@ namespace QmlDesigner {
bool
QmlItemNode
::
isValid
()
const
{
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt/Item"
,
4
,
7
);
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isValid
()
&&
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt
Quick
/Item"
,
-
1
,
-
1
);
}
bool
QmlItemNode
::
isRootNode
()
const
...
...
@@ -306,7 +306,7 @@ QmlModelState QmlModelStateGroup::addState(const QString &name)
PropertyListType
propertyList
;
propertyList
.
append
(
qMakePair
(
QString
(
"name"
),
QVariant
(
name
)));
ModelNode
newState
=
modelNode
().
view
()
->
createModelNode
(
"Qt/State"
,
4
,
7
,
propertyList
);
ModelNode
newState
=
modelNode
().
view
()
->
createModelNode
(
"Qt
Quick
/State"
,
1
,
0
,
propertyList
);
modelNode
().
nodeListProperty
(
"states"
).
reparentHere
(
newState
);
return
newState
;
...
...
src/plugins/qmldesigner/designercore/model/qmlmodelview.cpp
View file @
0a02b85e
...
...
@@ -133,7 +133,7 @@ QmlItemNode QmlModelView::createQmlItemNodeFromImage(const QString &imageName, c
}
propertyPairList
.
append
(
qMakePair
(
QString
(
"source"
),
QVariant
(
relativeImageName
)));
newNode
=
createQmlItemNode
(
"Qt/Image"
,
4
,
7
,
propertyPairList
);
newNode
=
createQmlItemNode
(
"Qt
Quick
/Image"
,
1
,
0
,
propertyPairList
);
parentNode
.
nodeAbstractProperty
(
"data"
).
reparentHere
(
newNode
);
Q_ASSERT
(
newNode
.
isValid
());
...
...
src/plugins/qmldesigner/designercore/model/qmlstate.cpp
View file @
0a02b85e
...
...
@@ -183,7 +183,7 @@ void QmlModelState::addChangeSetIfNotExists(const ModelNode &node)
return
;
//changeSet already there
}
ModelNode
newChangeSet
=
modelNode
().
view
()
->
createModelNode
(
"Qt/PropertyChanges"
,
4
,
7
);
ModelNode
newChangeSet
=
modelNode
().
view
()
->
createModelNode
(
"Qt
Quick
/PropertyChanges"
,
1
,
0
);
modelNode
().
nodeListProperty
(
"changes"
).
reparentHere
(
newChangeSet
);
QmlPropertyChanges
(
newChangeSet
).
setTarget
(
node
);
...
...
@@ -250,7 +250,7 @@ bool QmlModelState::isValid() const
{
return
QmlModelNodeFacade
::
isValid
()
&&
modelNode
().
metaInfo
().
isValid
()
&&
(
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt/State"
,
4
,
7
)
||
isBaseState
());
(
modelNode
().
metaInfo
().
isSubclassOf
(
"Qt
Quick
/State"
,
1
,
0
)
||
isBaseState
());
}
/**
...
...
@@ -284,7 +284,7 @@ QmlModelState QmlModelState::duplicate(const QString &name) const
// QmlModelState newState(stateGroup().addState(name));
PropertyListType
propertyList
;
propertyList
.
append
(
qMakePair
(
QString
(
"name"
),
QVariant
(
name
)));
QmlModelState
newState
(
qmlModelView
()
->
createModelNode
(
"Qt/State"
,
4
,
7
,
propertyList
)
);
QmlModelState
newState
(
qmlModelView
()
->
createModelNode
(
"Qt
Quick
/State"
,
1
,
0
,
propertyList
)
);
foreach
(
const
ModelNode
&
childNode
,
modelNode
().
nodeListProperty
(
"changes"
).
toModelNodeList
())
{
ModelNode
newModelNode
(
qmlModelView
()
->
createModelNode
(
childNode
.
type
(),
childNode
.
majorVersion
(),
childNode
.
minorVersion
()));
...
...
src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
View file @
0a02b85e
...
...
@@ -83,24 +83,24 @@ static inline QString deEscape(const QString &value)
return
result
;
}
static
inline
int
fixUpMajorVersionForQt
Quick
(
const
QString
&
value
,
int
i
)
static
inline
int
fixUpMajorVersionForQt
(
const
QString
&
value
,
int
i
)
{
if
(
i
==
1
&&
value
==
"Qt
Quick
"
)
return
4
;
if
(
i
==
4
&&
value
==
"Qt"
)
return
1
;
else
return
i
;
}
static
inline
int
fixUpMinorVersionForQt
Quick
(
const
QString
&
value
,
int
i
)
static
inline
int
fixUpMinorVersionForQt
(
const
QString
&
value
,
int
i
)
{
if
(
i
==
0
&&
value
==
"Qt
Quick
"
)
return
7
;
if
(
i
==
7
&&
value
==
"Qt"
)
return
0
;
else
return
i
;
}
static
inline
QString
fixUpPackeNameForQt
Quick
(
const
QString
&
value
)
static
inline
QString
fixUpPackeNameForQt
(
const
QString
&
value
)
{
if
(
value
==
"Qt
Quick
"
)
return
"Qt"
;
if
(
value
==
"Qt"
)
return
"Qt
Quick
"
;
return
value
;
}
...
...
@@ -224,6 +224,12 @@ static bool isComponentType(const QString &type)
return
type
==
QLatin1String
(
"Component"
)
||
type
==
QLatin1String
(
"Qt/Component"
)
||
type
==
QLatin1String
(
"QtQuick/Component"
);
}
static
bool
isPropertyChangesType
(
const
QString
&
type
)
{
return
type
==
QLatin1String
(
"PropertyChanges"
)
||
type
==
QLatin1String
(
"QtQuick/PropertyChanges"
)
||
type
==
QLatin1String
(
"Qt/PropertyChanges"
);
}
}
// anonymous namespace
namespace
QmlDesigner
{
...
...
@@ -263,11 +269,11 @@ public:
const
Interpreter
::
QmlObjectValue
*
qmlValue
=
dynamic_cast
<
const
Interpreter
::
QmlObjectValue
*>
(
value
);
if
(
qmlValue
)
{
typeName
=
fixUpPackeNameForQt
Quick
(
qmlValue
->
packageName
())
+
QLatin1String
(
"/"
)
+
qmlValue
->
className
();
typeName
=
fixUpPackeNameForQt
(
qmlValue
->
packageName
())
+
QLatin1String
(
"/"
)
+
qmlValue
->
className
();
//### todo this is just a hack to support QtQuick 1.0
majorVersion
=
fixUpMajorVersionForQt
Quick
(
qmlValue
->
packageName
(),
qmlValue
->
version
().
majorVersion
());
minorVersion
=
fixUpMinorVersionForQt
Quick
(
qmlValue
->
packageName
(),
qmlValue
->
version
().
minorVersion
());
majorVersion
=
fixUpMajorVersionForQt
(
qmlValue
->
packageName
(),
qmlValue
->
version
().
majorVersion
());
minorVersion
=
fixUpMinorVersionForQt
(
qmlValue
->
packageName
(),
qmlValue
->
version
().
minorVersion
());
}
else
{
for
(
UiQualifiedId
*
iter
=
astTypeNode
;
iter
;
iter
=
iter
->
next
)
if
(
!
iter
->
next
&&
iter
->
name
)
...
...
@@ -561,9 +567,9 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
differenceHandler
.
modelMissesImport
(
newImport
);
}
else
{
QString
importUri
=
flatten
(
import
->
importUri
);
if
(
importUri
==
QLatin1String
(
"Qt
Quick
"
)
&&
version
==
QLatin1String
(
"
1.0
"
))
{
importUri
=
QLatin1String
(
"Qt"
);
version
=
QLatin1String
(
"
4.7
"
);
if
(
importUri
==
QLatin1String
(
"Qt"
)
&&
version
==
QLatin1String
(
"
4.7
"
))
{
importUri
=
QLatin1String
(
"Qt
Quick
"
);
version
=
QLatin1String
(
"
1.0
"
);
}
const
Import
newImport
=
...
...
@@ -707,7 +713,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
if
(
UiArrayBinding
*
array
=
cast
<
UiArrayBinding
*>
(
member
))
{
const
QString
astPropertyName
=
flatten
(
array
->
qualifiedId
);
if
(
typeName
==
QLatin1String
(
"Qt/
PropertyChanges
"
)
||
context
->
lookupProperty
(
QString
(),
array
->
qualifiedId
))
{
if
(
is
PropertyChanges
Type
(
typeName
)
||
context
->
lookupProperty
(
QString
(),
array
->
qualifiedId
))
{
AbstractProperty
modelProperty
=
modelNode
.
property
(
astPropertyName
);
QList
<
UiObjectMember
*>
arrayMembers
;
for
(
UiArrayMemberList
*
iter
=
array
->
members
;
iter
;
iter
=
iter
->
next
)
...
...
@@ -741,7 +747,7 @@ void TextToModelMerger::syncNode(ModelNode &modelNode,
const
Interpreter
::
Value
*
propertyType
=
0
;
const
Interpreter
::
ObjectValue
*
containingObject
=
0
;
QString
name
;
if
(
context
->
lookupProperty
(
QString
(),
binding
->
qualifiedId
,
&
propertyType
,
&
containingObject
,
&
name
)
||
typeName
==
QLatin1String
(
"Qt/
PropertyChanges
"
))
{
if
(
context
->
lookupProperty
(
QString
(),
binding
->
qualifiedId
,
&
propertyType
,
&
containingObject
,
&
name
)
||
is
PropertyChanges
Type
(
typeName
))
{
AbstractProperty
modelProperty
=
modelNode
.
property
(
astPropertyName
);
if
(
context
->
isArrayProperty
(
propertyType
,
containingObject
,
name
))
{
syncArrayProperty
(
modelProperty
,
QList
<
QmlJS
::
AST
::
UiObjectMember
*>
()
<<
member
,
context
,
differenceHandler
);
...
...
@@ -849,7 +855,7 @@ QString TextToModelMerger::syncScriptBinding(ModelNode &modelNode,
return
QString
();
if
(
isLiteralValue
(
script
))
{
if
(
modelNode
.
type
()
==
QLatin1String
(
"Qt/PropertyChanges"
))
{
if
(
isPropertyChangesType
(
modelNode
.
type
()
))
{
AbstractProperty
modelProperty
=
modelNode
.
property
(
astPropertyName
);
const
QVariant
variantValue
(
deEscape
(
stripQuotes
(
astValue
)));
syncVariantProperty
(
modelProperty
,
variantValue
,
QString
(),
differenceHandler
);
...
...
@@ -874,7 +880,7 @@ QString TextToModelMerger::syncScriptBinding(ModelNode &modelNode,
syncVariantProperty
(
modelProperty
,
enumValue
,
QString
(),
differenceHandler
);
// TODO: parse type
return
astPropertyName
;
}
else
{
// Not an enum, so:
if
(
modelNode
.
type
()
==
QLatin1String
(
"Qt/PropertyChanges"
)
||
context
->
lookupProperty
(
prefix
,
script
->
qualifiedId
))
{
if
(
isPropertyChangesType
(
modelNode
.
type
()
)
||
context
->
lookupProperty
(
prefix
,
script
->
qualifiedId
))
{
AbstractProperty
modelProperty
=
modelNode
.
property
(
astPropertyName
);
syncExpressionProperty
(
modelProperty
,
astValue
,
QString
(),
differenceHandler
);
// TODO: parse type
return
astPropertyName
;
...
...
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