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 {
...
@@ -43,8 +43,10 @@ Page {
Column
{
Column
{
spacing
:
40
spacing
:
40
anchors.centerIn
:
parent
anchors.centerIn
:
parent
width
:
parent
.
width
ButtonRow
{
ButtonRow
{
id
:
row
id
:
row
anchors.horizontalCenter
:
parent
.
horizontalCenter
model
:
ListModel
{
model
:
ListModel
{
id
:
buttonModel
id
:
buttonModel
ListElement
{
ListElement
{
...
@@ -73,11 +75,14 @@ Page {
...
@@ -73,11 +75,14 @@ Page {
Label
{
Label
{
id
:
selector
id
:
selector
anchors.horizontalCenter
:
parent
.
horizontalCenter
text
:
"
Nothing selected
"
text
:
"
Nothing selected
"
}
}
ButtonRow
{
ButtonRow
{
id
:
row2
id
:
row2
enabled
:
false
enabled
:
false
anchors.horizontalCenter
:
parent
.
horizontalCenter
fixedWidth
:
parent
.
width
*
.
8
model
:
ListModel
{
model
:
ListModel
{
ListElement
{
ListElement
{
name
:
"
swim
"
name
:
"
swim
"
...
...
src/controls/editfilter.h
View file @
a8f84a11
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include <QObject>
#include <QObject>
#include <QEvent>
#include <QEvent>
#include <QString>
#include <QString>
#include <QVariant>
#include "nemofocussingleton.h"
#include "nemofocussingleton.h"
class
EditFilter
:
public
QObject
class
EditFilter
:
public
QObject
...
...
src/controls/qml/ButtonRow.qml
View file @
a8f84a11
...
@@ -35,12 +35,21 @@ import QtQuick.Controls.Styles.Nemo 1.0
...
@@ -35,12 +35,21 @@ import QtQuick.Controls.Styles.Nemo 1.0
Rectangle
{
Rectangle
{
id
:
main
id
:
main
width
:
childrenRect
.
width
implicitWidth
:
fixedWidth
?
fixedWidth
:
childrenRectWidth
()
color
:
Theme
.
fillDarkColor
color
:
Theme
.
fillDarkColor
height
:
Theme
.
itemHeightSmall
height
:
Theme
.
itemHeightSmall
property
ListModel
model
:
ListModel
{}
property
ListModel
model
:
ListModel
{}
property
bool
enabled
:
true
property
bool
enabled
:
true
property
int
currentIndex
:
-
1
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
{
Image
{
anchors.fill
:
parent
anchors.fill
:
parent
...
@@ -48,24 +57,51 @@ Rectangle {
...
@@ -48,24 +57,51 @@ Rectangle {
source
:
"
images/disabled-overlay.png
"
source
:
"
images/disabled-overlay.png
"
fillMode
:
Image
.
Tile
fillMode
:
Image
.
Tile
}
}
Rectangle
{
Rectangle
{
id
:
selecter
id
:
selecter
x
:
rowElement
.
children
[
main
.
currentIndex
].
x
||
0
//x: main.currentIndex > -1 ? rowElement.children[main.currentIndex].x :
0
anchors.verticalCenter
:
rowElement
.
verticalCenter
anchors.verticalCenter
:
rowElement
.
verticalCenter
width
:
rowElement
.
children
[
main
.
currentIndex
].
width
||
0
height
:
Theme
.
itemHeightMedium
height
:
Theme
.
itemHeightMedium
color
:
Theme
.
accentColor
color
:
Theme
.
accentColor
clip
:
true
visible
:
main
.
currentIndex
>
-
1
visible
:
main
.
currentIndex
>
-
1
Behavior
on
x
{
Behavior
on
x
{
NumberAnimation
{
duration
:
200
}
NumberAnimation
{
duration
:
200
;
easing.type
:
Easing
.
OutCubic
}
}
}
Behavior
on
width
{
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
{
Row
{
...
@@ -76,19 +112,9 @@ Rectangle {
...
@@ -76,19 +112,9 @@ Rectangle {
delegate
:
Rectangle
{
delegate
:
Rectangle
{
id
:
rowItem
id
:
rowItem
height
:
Theme
.
itemHeightSmall
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
"
color
:
"
transparent
"
MouseArea
{
function
changeIndex
()
{
main
.
currentIndex
=
index
}
width
:
parent
.
width
height
:
parent
.
height
enabled
:
main
.
enabled
onClicked
:
{
main
.
currentIndex
=
index
}
}
Label
{
Label
{
id
:
text
id
:
text
text
:
name
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