Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Yuya Nishihara
Quick Tiled View
Commits
f50a401a
Commit
f50a401a
authored
Sep 07, 2021
by
Yuya Nishihara
Browse files
implement major splitter handle
parent
15e732dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
TileView.qml
View file @
f50a401a
import
QtQuick
2.15
import
QtQuick
.
Controls
2.15
import
QtQml
2.15
// Binding.restoreMode
Control
{
id
:
root
...
...
@@ -91,5 +92,67 @@ Control {
}
}
}
Item
{
anchors.fill
:
parent
Repeater
{
model
:
root
.
majorCount
Rectangle
{
id
:
majorHandle
required
property
int
index
// TODO: race on majorOrientation changed
anchors.left
:
root
.
majorOrientation
!==
Qt
.
Horizontal
?
parent
.
left
:
undefined
anchors.right
:
root
.
majorOrientation
!==
Qt
.
Horizontal
?
parent
.
right
:
undefined
anchors.top
:
root
.
majorOrientation
===
Qt
.
Horizontal
?
parent
.
top
:
undefined
anchors.bottom
:
root
.
majorOrientation
===
Qt
.
Horizontal
?
parent
.
bottom
:
undefined
width
:
5
height
:
5
visible
:
index
>
0
color
:
"
gray
"
onXChanged
:
{
if
(
root
.
majorOrientation
!==
Qt
.
Horizontal
||
!
majorDragHandler
.
active
)
return
;
let
positions
=
root
.
_majorPositions
;
positions
[
index
]
=
x
/
contentArea
.
width
;
root
.
_majorPositions
=
positions
;
}
onYChanged
:
{
if
(
root
.
majorOrientation
===
Qt
.
Horizontal
||
!
majorDragHandler
.
active
)
return
;
let
positions
=
root
.
_majorPositions
;
positions
[
index
]
=
y
/
contentArea
.
height
;
root
.
_majorPositions
=
positions
;
}
Binding
on
x
{
when
:
root
.
majorOrientation
===
Qt
.
Horizontal
&&
!
majorDragHandler
.
active
value
:
contentArea
.
width
*
root
.
_majorPositions
[
majorHandle
.
index
]
restoreMode
:
Binding
.
RestoreNone
}
Binding
on
y
{
when
:
root
.
majorOrientation
!==
Qt
.
Horizontal
&&
!
majorDragHandler
.
active
value
:
contentArea
.
height
*
root
.
_majorPositions
[
majorHandle
.
index
]
restoreMode
:
Binding
.
RestoreNone
}
HoverHandler
{
cursorShape
:
root
.
majorOrientation
===
Qt
.
Horizontal
?
Qt
.
SplitHCursor
:
Qt
.
SplitVCursor
}
DragHandler
{
id
:
majorDragHandler
xAxis.enabled
:
root
.
majorOrientation
===
Qt
.
Horizontal
yAxis.enabled
:
root
.
majorOrientation
!==
Qt
.
Horizontal
// TODO: minimum/maximum
}
}
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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