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
571ed262
Commit
571ed262
authored
Jan 14, 2019
by
Sergey Chupligin
Committed by
Sergey Chupligin
Jan 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ListViewItemWithActions] Simplicity of actions delegate
parent
c6fc74ed
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
78 additions
and
22 deletions
+78
-22
ListViewPage.qml
examples/touch/content/ListViewPage.qml
+5
-16
controls.pro
src/controls/controls.pro
+1
-0
ActionButton.qml
src/controls/qml/ActionButton.qml
+55
-0
ListViewItemWithActions.qml
src/controls/qml/ListViewItemWithActions.qml
+16
-6
qmldir
src/controls/qml/qmldir
+1
-0
No files found.
examples/touch/content/ListViewPage.qml
View file @
571ed262
...
@@ -43,23 +43,12 @@ Page {
...
@@ -43,23 +43,12 @@ Page {
width
:
parent
.
width
width
:
parent
.
width
height
:
Theme
.
itemHeightLarge
height
:
Theme
.
itemHeightLarge
actions
:
Rectangle
{
actions
:[
id
:
itemActions
ActionButton
{
height
:
Theme
.
itemHeightLarge
iconSource
:
"
image://theme/times
"
width
:
height
color
:
"
transparent
"
Image
{
id
:
removeButton
width
:
parent
.
width
*
0.6
height
:
width
source
:
"
image://theme/times
"
anchors.centerIn
:
parent
}
}
}
]
}
}
section.property
:
"
size
"
section.property
:
"
size
"
}
}
...
...
src/controls/controls.pro
View file @
571ed262
...
@@ -9,6 +9,7 @@ THEME_IMPORT_PATH = QtQuick/Controls/Styles/Nemo/themes
...
@@ -9,6 +9,7 @@ THEME_IMPORT_PATH = QtQuick/Controls/Styles/Nemo/themes
QML_FILES
+=
\
QML_FILES
+=
\
qml
/
Button
.
qml
\
qml
/
Button
.
qml
\
qml
/
ApplicationWindow
.
qml
\
qml
/
ApplicationWindow
.
qml
\
qml
/
ActionButton
.
qml
\
qml
/
Page
.
qml
\
qml
/
Page
.
qml
\
qml
/
Spinner
.
qml
\
qml
/
Spinner
.
qml
\
qml
/
Label
.
qml
\
qml
/
Label
.
qml
\
...
...
src/controls/qml/ActionButton.qml
0 → 100644
View file @
571ed262
/****************************************************************************************
**
** Copyright (C) 2019 Chupligin Sergey <neochapay@gmail.com>
** All rights reserved.
**
** You may use this file under the terms of BSD license as follows:
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the author nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR
** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
****************************************************************************************/
import
QtQuick
2.6
Item
{
id
:
actionButton
property
alias
iconSource
:
actionButtonImage
.
source
signal
clicked
();
height
:
parent
.
height
width
:
parent
.
width
Image
{
id
:
actionButtonImage
width
:
parent
.
height
*
0.6
height
:
width
anchors.centerIn
:
parent
MouseArea
{
anchors.fill
:
parent
onClicked
:
actionButton
.
clicked
()
}
}
}
src/controls/qml/ListViewItemWithActions.qml
View file @
571ed262
...
@@ -50,7 +50,7 @@ Item {
...
@@ -50,7 +50,7 @@ Item {
property
bool
showActions
:
true
property
bool
showActions
:
true
property
alias
actions
:
actionsLoader
.
sourceComponent
property
list
<
Item
>
actions
signal
clicked
signal
clicked
...
@@ -74,10 +74,20 @@ Item {
...
@@ -74,10 +74,20 @@ Item {
anchors.right
:
listArea
.
left
anchors.right
:
listArea
.
left
height
:
listArea
.
height
height
:
listArea
.
height
width
:
childrenRect
.
wid
th
width
:
height
*
actions
.
leng
th
Loader
{
Row
{
id
:
actionsLoader
id
:
actionsRow
width
:
actionsArea
.
width
height
:
actionsArea
.
height
children
:
actions
}
Component.onCompleted
:
{
if
(
actions
.
length
>
3
)
{
console
.
warn
(
"
Use more 3 actions is not good idea!
"
)
}
}
}
}
}
...
@@ -96,7 +106,7 @@ Item {
...
@@ -96,7 +106,7 @@ Item {
height
:
parent
.
height
height
:
parent
.
height
width
:
Theme
.
itemSpacingSmall
/
4
-
Theme
.
itemSpacingSmall
/
4
*
listArea
.
x
/
actionsArea
.
width
width
:
Theme
.
itemSpacingSmall
/
4
-
Theme
.
itemSpacingSmall
/
4
*
listArea
.
x
/
actionsArea
.
width
color
:
Theme
.
accentColor
color
:
Theme
.
accentColor
visible
:
(
actionsLoader
.
item
&&
showActions
)
visible
:
(
height
*
actions
.
length
>
0
&&
showActions
)
}
}
Rectangle
{
Rectangle
{
...
@@ -233,7 +243,7 @@ Item {
...
@@ -233,7 +243,7 @@ Item {
}
}
onPressAndHold
:
{
onPressAndHold
:
{
if
(
actions
Loader
.
item
&&
showActions
)
{
if
(
actions
.
length
>
0
&&
showActions
)
{
listArea
.
x
=
actionsArea
.
width
listArea
.
x
=
actionsArea
.
width
}
}
}
}
...
...
src/controls/qml/qmldir
View file @
571ed262
...
@@ -30,6 +30,7 @@ TimePicker 1.0 TimePicker.qml
...
@@ -30,6 +30,7 @@ TimePicker 1.0 TimePicker.qml
ScrollDecorator 1.0 ScrollDecorator.qml
ScrollDecorator 1.0 ScrollDecorator.qml
TextField 1.0 TextField.qml
TextField 1.0 TextField.qml
ProgressBar 1.0 ProgressBar.qml
ProgressBar 1.0 ProgressBar.qml
ActionButton 1.0 ActionButton.qml
# MIRRORED CONTROLS:
# MIRRORED CONTROLS:
# These are the controls that we take directly from official QQC.
# 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