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
a8f84a11
Commit
a8f84a11
authored
Oct 03, 2017
by
eekkelund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Controls] Buttonrow: added fixedWidth and made the selÃector draggable as in spec.
parent
b99b332e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
19 deletions
+51
-19
ButtonRowPage.qml
examples/touch/content/ButtonRowPage.qml
+5
-0
editfilter.h
src/controls/editfilter.h
+1
-0
ButtonRow.qml
src/controls/qml/ButtonRow.qml
+45
-19
No files found.
examples/touch/content/ButtonRowPage.qml
View file @
a8f84a11
...
...
@@ -43,8 +43,10 @@ Page {
Column
{
spacing
:
40
anchors.centerIn
:
parent
width
:
parent
.
width
ButtonRow
{
id
:
row
anchors.horizontalCenter
:
parent
.
horizontalCenter
model
:
ListModel
{
id
:
buttonModel
ListElement
{
...
...
@@ -73,11 +75,14 @@ Page {
Label
{
id
:
selector
anchors.horizontalCenter
:
parent
.
horizontalCenter
text
:
"
Nothing selected
"
}
ButtonRow
{
id
:
row2
enabled
:
false
anchors.horizontalCenter
:
parent
.
horizontalCenter
fixedWidth
:
parent
.
width
*
.
8
model
:
ListModel
{
ListElement
{
name
:
"
swim
"
...
...
src/controls/editfilter.h
View file @
a8f84a11
...
...
@@ -22,6 +22,7 @@
#include <QObject>
#include <QEvent>
#include <QString>
#include <QVariant>
#include "nemofocussingleton.h"
class
EditFilter
:
public
QObject
...
...
src/controls/qml/ButtonRow.qml
View file @
a8f84a11
...
...
@@ -35,12 +35,21 @@ import QtQuick.Controls.Styles.Nemo 1.0
Rectangle
{
id
:
main
width
:
childrenRect
.
width
implicitWidth
:
fixedWidth
?
fixedWidth
:
childrenRectWidth
()
color
:
Theme
.
fillDarkColor
height
:
Theme
.
itemHeightSmall
property
ListModel
model
:
ListModel
{}
property
bool
enabled
:
true
property
int
currentIndex
:
-
1
property
int
fixedWidth
function
childrenRectWidth
()
{
var
childWidth
=
0
for
(
var
i
=
0
;
i
<
rectangles
.
count
;
i
++
)
{
childWidth
=
childWidth
+
rectangles
.
itemAt
(
i
).
width
}
return
childWidth
}
Image
{
anchors.fill
:
parent
...
...
@@ -48,24 +57,51 @@ Rectangle {
source
:
"
images/disabled-overlay.png
"
fillMode
:
Image
.
Tile
}
Rectangle
{
id
:
selecter
x
:
rowElement
.
children
[
main
.
currentIndex
].
x
||
0
//x: main.currentIndex > -1 ? rowElement.children[main.currentIndex].x :
0
anchors.verticalCenter
:
rowElement
.
verticalCenter
width
:
rowElement
.
children
[
main
.
currentIndex
].
width
||
0
height
:
Theme
.
itemHeightMedium
color
:
Theme
.
accentColor
clip
:
true
visible
:
main
.
currentIndex
>
-
1
Behavior
on
x
{
NumberAnimation
{
duration
:
200
}
NumberAnimation
{
duration
:
200
;
easing.type
:
Easing
.
OutCubic
}
}
Behavior
on
width
{
NumberAnimation
{
duration
:
200
}
NumberAnimation
{
duration
:
200
;
easing.type
:
Easing
.
OutCubic
}
}
}
MouseArea
{
id
:
dragArea
anchors.fill
:
parent
enabled
:
main
.
enabled
drag.target
:
main
.
enabled
?
selecter
.
visible
?
selecter
:
null
:
null
drag.axis
:
Drag
.
XAxis
drag.minimumX
:
x
drag.maximumX
:
main
.
width
-
selecter
.
width
property
int
inBoundsX
hoverEnabled
:
true
onReleased
:
{
if
(
inBoundsX
>
-
1
)
{
if
(
mouseX
<
drag
.
minimumX
)
rowElement
.
childAt
(
inBoundsX
,
y
).
changeIndex
()
else
if
(
mouseX
>
drag
.
maximumX
+
selecter
.
width
)
rowElement
.
childAt
(
inBoundsX
+
selecter
.
width
,
y
).
changeIndex
()
else
rowElement
.
childAt
(
mouseX
,
y
).
changeIndex
()
selecter
.
x
=
rowElement
.
children
[
main
.
currentIndex
].
x
selecter
.
width
=
main
.
currentIndex
>
-
1
?
rowElement
.
children
[
main
.
currentIndex
].
width
:
0
}
}
onClicked
:
{
inBoundsX
=
-
1
rowElement
.
childAt
(
mouseX
,
y
).
changeIndex
()
selecter
.
x
=
rowElement
.
children
[
main
.
currentIndex
].
x
selecter
.
width
=
main
.
currentIndex
>
-
1
?
rowElement
.
children
[
main
.
currentIndex
].
width
:
0
}
onPositionChanged
:
if
(
mouseX
>=
drag
.
minimumX
&&
mouseX
<=
drag
.
maximumX
)
inBoundsX
=
mouseX
}
Row
{
...
...
@@ -76,19 +112,9 @@ Rectangle {
delegate
:
Rectangle
{
id
:
rowItem
height
:
Theme
.
itemHeightSmall
width
:
text
.
width
+
(
text
.
width
/
name
.
length
*
2
)
width
:
main
.
fixedWidth
?
(
main
.
fixedWidth
/
main
.
model
.
count
)
:
(
text
.
width
+
(
text
.
width
/
name
.
length
*
2
))
color
:
"
transparent
"
MouseArea
{
width
:
parent
.
width
height
:
parent
.
height
enabled
:
main
.
enabled
onClicked
:
{
main
.
currentIndex
=
index
}
}
function
changeIndex
()
{
main
.
currentIndex
=
index
}
Label
{
id
:
text
text
:
name
...
...
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