Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
7fe0ab96
Commit
7fe0ab96
authored
Sep 23, 2016
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(InvertedMouseArea): use coding conventions
parent
aa790dc0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
24 deletions
+24
-24
InvertedMouseArea.qml
tests/ui/components/invertedMouseArea/InvertedMouseArea.qml
+24
-24
No files found.
tests/ui/components/invertedMouseArea/InvertedMouseArea.qml
View file @
7fe0ab96
...
...
@@ -5,16 +5,18 @@ import QtQuick 2.0
// ===================================================================
Item
{
property
var
mouseArea
id
:
item
property
var
_mouseArea
signal
pressed
function
createMouseArea
()
{
if
(
mouseArea
==
null
)
{
mouseArea
=
builder
.
createObject
(
this
)
function
_
createMouseArea
()
{
if
(
_
mouseArea
==
null
)
{
_
mouseArea
=
builder
.
createObject
(
this
)
}
mouseArea
.
parent
=
(
function
()
{
_
mouseArea
.
parent
=
(
function
()
{
// Search root.
var
p
=
item
...
...
@@ -26,14 +28,14 @@ Item {
})()
}
function
deleteMouseArea
()
{
if
(
mouseArea
!=
null
)
{
mouseArea
.
destroy
()
mouseArea
=
null
function
_
deleteMouseArea
()
{
if
(
_
mouseArea
!=
null
)
{
_
mouseArea
.
destroy
()
_
mouseArea
=
null
}
}
function
isInItem
(
point
)
{
function
_
isInItem
(
point
)
{
return
(
point
.
x
>=
item
.
x
&&
point
.
y
>=
item
.
y
&&
...
...
@@ -42,13 +44,21 @@ Item {
)
}
id
:
item
// It's necessary to use a `enabled` variable.
// See: http://doc.qt.io/qt-5/qml-qtqml-component.html#completed-signal
//
// The creation order of components in a view is undefined,
// so the mouse area mustt be created only when `enabled == true`.
//
// In the first view render, `enabled` must equal false.
Component.onCompleted
:
enabled
&&
_createMouseArea
()
Component.onDestruction
:
_deleteMouseArea
()
onEnabledChanged
:
{
deleteMouseArea
()
_
deleteMouseArea
()
if
(
enabled
)
{
createMouseArea
()
_
createMouseArea
()
}
}
...
...
@@ -64,7 +74,7 @@ Item {
// Propagate event.
mouse
.
accepted
=
false
if
(
!
isInItem
(
if
(
!
_
isInItem
(
mapToItem
(
item
.
parent
,
mouse
.
x
,
mouse
.
y
)
))
{
// Outside!!!
...
...
@@ -73,14 +83,4 @@ Item {
}
}
}
// It's necessary to use a `enabled` variable.
// See: http://doc.qt.io/qt-5/qml-qtqml-component.html#completed-signal
//
// The creation order of components in a view is undefined,
// so the mouse area mustt be created only when `enabled == true`.
//
// In the first view render, `enabled` must equal false.
Component
.
onCompleted
:
enabled
&&
createMouseArea
()
Component
.
onDestruction
:
deleteMouseArea
()
}
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