Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Q
qtquickcontrols-nemo
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
NemoMobile
qtquickcontrols-nemo
Commits
77b312ac
Commit
77b312ac
authored
Jan 30, 2017
by
Sergey Chupligin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ListView] add item actons
parent
b5071ab1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
210 additions
and
134 deletions
+210
-134
ListViewPage.qml
examples/touch/content/ListViewPage.qml
+2
-2
ListView.qml
src/controls/ListView.qml
+4
-0
ListViewItemWithActions.qml
src/controls/ListViewItemWithActions.qml
+200
-0
MediumListViewItem.qml
src/controls/MediumListViewItem.qml
+0
-125
controls.pro
src/controls/controls.pro
+2
-5
qmldir
src/controls/qmldir
+2
-2
No files found.
examples/touch/content/ListViewPage.qml
View file @
77b312ac
...
...
@@ -28,12 +28,12 @@ Page {
ListElement
{
name
:
"
Whale
"
;
desc
:
""
;
size
:
"
Huge
"
}
}
Medium
ListView
{
ListView
{
id
:
view
anchors.fill
:
parent
clip
:
true
model
:
animalsModel
delegate
:
MediumListViewItem
{
delegate
:
ListViewItemWithActions
{
label
:
name
description
:
desc
}
...
...
src/controls/
Medium
ListView.qml
→
src/controls/ListView.qml
View file @
77b312ac
...
...
@@ -5,6 +5,9 @@ import QtQuick.Controls.Styles.Nemo 1.0
ListView
{
id
:
listView
signal
hideAllActions
(
int
hideIndex
)
section.criteria
:
ViewSection
.
FullString
section.delegate
:
Component
{
id
:
sectionHeading
...
...
@@ -59,5 +62,6 @@ ListView {
}
}
}
src/controls/ListViewItemWithActions.qml
0 → 100644
View file @
77b312ac
import
QtQuick
2.1
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtGraphicalEffects
1.0
Item
{
id
:
root
width
:
parent
.
width
height
:
60
property
string
label
:
""
property
string
description
:
""
property
string
subdescription
:
""
property
string
icon
:
""
property
string
page
:
""
property
alias
actions
:
actionsLoader
.
sourceComponent
signal
clicked
function
hideAllActions
()
{
root
.
ListView
.
view
.
hideAllActions
(
index
)
}
Connections
{
target
:
root
.
ListView
.
view
onHideAllActions
:
{
if
(
hideIndex
!=
index
)
{
listArea
.
x
=
0
}
}
}
Rectangle
{
id
:
actionsArea
color
:
"
#474747
"
anchors.right
:
listArea
.
left
height
:
listArea
.
height
width
:
childrenRect
.
width
Loader
{
id
:
actionsLoader
}
}
Rectangle
{
id
:
listArea
width
:
root
.
width
height
:
root
.
height
color
:
"
transparent
"
Behavior
on
x
{
NumberAnimation
{
duration
:
200
}
}
Rectangle
{
anchors.fill
:
parent
color
:
"
#11ffffff
"
visible
:
mouse
.
pressed
}
Image
{
id
:
itemIcon
height
:
parent
.
height
-
10
width
:
height
anchors
{
left
:
parent
.
left
leftMargin
:
20
top
:
parent
.
top
topMargin
:
5
}
sourceSize.width
:
width
sourceSize.height
:
height
source
:
(
icon
!=
""
)
?
icon
:
"
images/listview-icon-template-s.svg
"
//visible: (icon != "")
}
Rectangle
{
id
:
dataArea
width
:
parent
.
width
-
itemIcon
.
width
-
arrowItem
.
width
-
60
height
:
labelItem
.
height
+
(
description
!=
""
?
descriptionItem
.
height
:
0
)
+
(
subdescription
!=
""
?
subDescriptionItem
.
height
:
0
)
clip
:
true
anchors
{
left
:
itemIcon
.
right
leftMargin
:
20
verticalCenter
:
itemIcon
.
verticalCenter
}
color
:
"
transparent
"
Text
{
id
:
labelItem
color
:
"
#ffffff
"
text
:
label
anchors
{
left
:
parent
.
left
right
:
parent
.
right
}
font.pixelSize
:
30
clip
:
true
}
Text
{
id
:
descriptionItem
color
:
"
#ffffff
"
text
:
description
anchors
{
left
:
parent
.
left
right
:
parent
.
right
top
:
labelItem
.
bottom
}
font.pixelSize
:
18
clip
:
true
visible
:
description
!=
""
}
Text
{
id
:
subDescriptionItem
color
:
"
#ffffff
"
text
:
subdescription
anchors
{
left
:
parent
.
left
right
:
parent
.
right
top
:
descriptionItem
.
bottom
}
font.pixelSize
:
18
clip
:
true
visible
:
subdescription
!=
""
}
Item
{
width
:
15
height
:
parent
.
height
anchors
{
top
:
parent
.
top
right
:
parent
.
right
}
visible
:
!
mouse
.
pressed
LinearGradient
{
anchors.fill
:
parent
start
:
Qt
.
point
(
0
,
0
)
end
:
Qt
.
point
(
15
,
0
)
gradient
:
Gradient
{
GradientStop
{
position
:
0.0
;
color
:
"
transparent
"
}
GradientStop
{
position
:
1.0
;
color
:
"
black
"
}
}
}
}
}
Image
{
id
:
arrowItem
height
:
parent
.
height
-
10
width
:
height
anchors
{
right
:
parent
.
right
rightMargin
:
20
verticalCenter
:
parent
.
verticalCenter
}
sourceSize.width
:
width
sourceSize.height
:
height
source
:
"
images/listview-icon-arrow.svg
"
//visible: (page != "")
}
MouseArea
{
id
:
mouse
anchors.fill
:
parent
onClicked
:
{
//if actions is hide
if
(
listArea
.
x
===
0
)
{
root
.
clicked
()
}
else
{
listArea
.
x
=
0
}
}
onPressed
:
{
hideAllActions
()
}
onPressAndHold
:
{
if
(
actionsLoader
.
item
)
{
listArea
.
x
=
actionsArea
.
width
}
}
}
}
}
src/controls/MediumListViewItem.qml
deleted
100644 → 0
View file @
b5071ab1
import
QtQuick
2.1
import
QtQuick
.
Controls
.
Nemo
1.0
import
QtGraphicalEffects
1.0
Item
{
id
:
root
width
:
parent
.
width
height
:
60
property
string
label
:
""
property
string
description
:
""
property
string
icon
:
""
property
string
page
:
""
signal
clicked
Rectangle
{
anchors.fill
:
parent
color
:
"
#11ffffff
"
visible
:
mouse
.
pressed
}
Image
{
id
:
itemIcon
height
:
parent
.
height
-
10
width
:
height
anchors
{
left
:
parent
.
left
leftMargin
:
20
top
:
parent
.
top
topMargin
:
5
}
sourceSize.width
:
width
sourceSize.height
:
height
source
:
(
icon
!=
""
)
?
icon
:
"
images/listview-icon-template-s.svg
"
//visible: (icon != "")
}
Rectangle
{
id
:
dataArea
width
:
parent
.
width
-
itemIcon
.
width
-
arrowItem
.
width
-
60
height
:
(
description
!=
""
)
?
childrenRect
.
height
:
labelItem
.
height
clip
:
true
anchors
{
left
:
itemIcon
.
right
leftMargin
:
20
verticalCenter
:
itemIcon
.
verticalCenter
}
color
:
"
transparent
"
Text
{
id
:
labelItem
color
:
"
#ffffff
"
text
:
label
anchors
{
left
:
parent
.
left
right
:
parent
.
right
}
font.pixelSize
:
30
clip
:
true
}
Text
{
id
:
descriptionItem
color
:
"
#ffffff
"
text
:
description
anchors
{
left
:
parent
.
left
right
:
parent
.
right
top
:
labelItem
.
bottom
}
font.pixelSize
:
18
clip
:
true
visible
:
text
!=
""
}
Item
{
width
:
15
height
:
parent
.
height
anchors
{
top
:
parent
.
top
right
:
parent
.
right
}
visible
:
!
mouse
.
pressed
LinearGradient
{
anchors.fill
:
parent
start
:
Qt
.
point
(
0
,
0
)
end
:
Qt
.
point
(
15
,
0
)
gradient
:
Gradient
{
GradientStop
{
position
:
0.0
;
color
:
"
transparent
"
}
GradientStop
{
position
:
1.0
;
color
:
"
black
"
}
}
}
}
}
Image
{
id
:
arrowItem
height
:
parent
.
height
-
10
width
:
height
anchors
{
right
:
parent
.
right
rightMargin
:
20
verticalCenter
:
parent
.
verticalCenter
}
sourceSize.width
:
width
sourceSize.height
:
height
source
:
"
images/listview-icon-arrow.svg
"
//visible: (page != "")
}
MouseArea
{
id
:
mouse
anchors.fill
:
parent
onClicked
:
root
.
clicked
()
}
}
src/controls/controls.pro
View file @
77b312ac
...
...
@@ -18,9 +18,8 @@ QML_FILES += \
Header
.
qml
\
HeaderToolsLayout
.
qml
\
Slider
.
qml
\
MediumListView
.
qml
\
MediumListViewItem
.
qml
\
MediumListViewElement
.
qml
ListView
.
qml
\
ListViewItemWithActions
.
qml
OTHER_FILES
+=
qmldir
\
$$
QML_FILES
...
...
@@ -54,5 +53,3 @@ images.files = $$_PRO_FILE_PWD_/images
images.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
INSTALLS += target qmlfiles images
DISTFILES +=
src/controls/qmldir
View file @
77b312ac
...
...
@@ -19,8 +19,8 @@ QueryDialog 1.0 QueryDialog.qml
Header 1.0 Header.qml
HeaderToolsLayout 1.0 HeaderToolsLayout.qml
Slider 1.0 Slider.qml
MediumListView 1.0 Medium
ListView.qml
MediumListViewItem 1.0 MediumListViewItem
.qml
ListView 1.0
ListView.qml
ListViewItemWithActions 1.0 ListViewItemWithActions
.qml
# MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC.
...
...
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