Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
BalaSwecha
Density
Commits
48354a27
Commit
48354a27
authored
Oct 30, 2014
by
vikram
Browse files
created objects dynamically so that they can be destroyed instead of hiding in case of reset
parent
5c49f2fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
qml/view/Main.qml
View file @
48354a27
...
...
@@ -20,7 +20,8 @@ Item {
DropArea
{
id
:
mainWin
width
:
parent
.
width
height
:
parent
.
height
anchors
{
fill
:
parent
}
...
...
@@ -122,7 +123,7 @@ Item {
volArea
.
reset
()
densityArea
.
reset
()
if
(
activeImageObject
!==
null
)
{
activeImageObject
.
opacity
=
0
activeImageObject
.
destroy
()
}
}
...
...
qml/view/ObjImage.qml
View file @
48354a27
...
...
@@ -50,11 +50,7 @@ Item {
onPressed
:
{
if
(
objImgId
.
state
==
"
inGrid
"
)
{
parentReset
()
var
newObj
=
Qt
.
createQmlObject
(
getQmlObjectString
(),
objImgId
.
parent
,
"
objImgId
"
);
drag
.
source
=
newObj
drag
.
source
=
getDuplicateObject
()
}
}
...
...
@@ -80,9 +76,6 @@ Item {
visible
:
imgText
.
textVisible
text
:
imgName
wrapMode
:
Text
.
WordWrap
}
}
...
...
@@ -157,8 +150,8 @@ Item {
PropertyAnimation
{
duration
:
400
;
}
}
function
get
QmlObjectString
()
{
var
s
tr
=
"
import QtQuick 2.0; ObjImage {
"
+
"
\n
"
+
function
get
DuplicateObject
()
{
var
qmlS
tr
=
"
import QtQuick 2.0; ObjImage {
"
+
"
\n
"
+
"
width:
"
+
objImgId
.
width
+
"
\n
"
+
"
height:
"
+
objImgId
.
height
+
"
\n
"
+
"
imgSource :
\"
"
+
objImgId
.
imgSource
+
"
\"\n
"
+
...
...
@@ -169,7 +162,8 @@ Item {
"
x :
"
+
x
+
"
\n
"
+
"
y :
"
+
y
+
"
\n
"
+
"
z :
"
+
z
+
"
\n
}
"
+
"
\n
"
return
str
return
objImgId
.
parent
.
getNewObject
(
qmlStr
)
}
...
...
qml/view/ObjectCollectionWin.qml
View file @
48354a27
...
...
@@ -17,29 +17,37 @@ Item {
rows
:
1
columns
:
12
spacing
:
5
property
int
cellWidth
:
objectCollWin
.
width
/
columns
property
int
cellHeight
:
objectCollWin
.
height
/
rows
Repeater
{
model
:
objGrid
.
rows
*
objGrid
.
columns
ObjImage
{
width
:
objGrid
.
cellWidth
-
objList
.
getHorizontalSpacing
(
index
,
5
)
height
:
objGrid
.
cellHeight
-
objList
.
getVerticalSpacing
(
index
,
5
)
imgSource
:
objList
.
getSource
(
index
,
""
)
imgName
:
objList
.
getName
(
index
,
""
)
weight
:
objList
.
getWeight
(
index
,
"
00.00
"
)
density
:
objList
.
getDensity
(
index
,
"
00.00
"
)
opacity
:
objList
.
validIndex
(
index
)
?
1
:
0
}
Item
{
Component.onCompleted
:
objGrid
.
getNewObject
(
"
import QtQuick 2.0; ObjImage {
"
+
"
\n
"
+
"
width:
"
+
(
objGrid
.
cellWidth
-
objList
.
getHorizontalSpacing
(
index
,
5
))
+
"
\n
"
+
"
height:
"
+
(
objGrid
.
cellHeight
-
objList
.
getVerticalSpacing
(
index
,
5
))
+
"
\n
"
+
"
imgSource :
\"
"
+
objList
.
getSource
(
index
,
""
)
+
"
\"\n
"
+
"
imgName :
\"
"
+
objList
.
getName
(
index
,
""
)
+
"
\"\n
"
+
"
weight :
"
+
objList
.
getWeight
(
index
,
"
00.00
"
)
+
"
\n
"
+
"
density:
"
+
objList
.
getDensity
(
index
,
"
00.00
"
)
+
"
\n
"
+
"
opacity :
"
+
(
objList
.
validIndex
(
index
)
?
1
:
0
)
+
"
\n
"
+
"
}
"
+
"
\n
"
)
}
}
function
parentReset
()
{
objGrid
.
parent
.
parentReset
()
}
function
getNewObject
(
qmlDynamicObj
)
{
return
Qt
.
createQmlObject
(
qmlDynamicObj
,
objGrid
,
"
objImgId
"
);
}
}
function
parentReset
()
{
...
...
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