Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
7a00c571
Commit
7a00c571
authored
Mar 22, 2021
by
Jean-Baptiste Mardelle
Browse files
Fix various timeline ruler repaint issues
parent
fe6d5e0b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/Ruler.qml
View file @
7a00c571
...
...
@@ -45,12 +45,12 @@ Item {
// labelSpacing cannot be smaller than 1 frame
rulerRoot
.
labelSpacing
=
timeline
.
scaleFactor
>
rulerRoot
.
labelSize
*
1.3
?
timeline
.
scaleFactor
:
Math
.
floor
(
rulerRoot
.
labelSize
/
timeline
.
scaleFactor
)
*
timeline
.
scaleFactor
}
else
{
rulerRoot
.
tickSpacing
=
Math
.
floor
(
3
*
root
.
font
Unit
/
timeline
.
scaleFactor
)
*
timeline
.
scaleFactor
rulerRoot
.
tickSpacing
=
Math
.
floor
(
3
*
root
.
base
Unit
/
timeline
.
scaleFactor
)
*
timeline
.
scaleFactor
rulerRoot
.
labelSpacing
=
(
Math
.
floor
(
rulerRoot
.
labelSize
/
rulerRoot
.
tickSpacing
)
+
1
)
*
rulerRoot
.
tickSpacing
}
rulerRoot
.
labelMod
=
Math
.
max
(
1
,
Math
.
ceil
((
rulerRoot
.
labelSize
+
root
.
font
Unit
)
/
rulerRoot
.
tickSpacing
))
rulerRoot
.
labelMod
=
Math
.
max
(
1
,
Math
.
ceil
((
rulerRoot
.
labelSize
+
root
.
base
Unit
)
/
rulerRoot
.
tickSpacing
))
//console.log('LABELMOD: ', Math.ceil((rulerRoot.labelSize + root.fontUnit) / rulerRoot.tickSpacing)))
tickRepeater
.
model
=
Math
.
ceil
(
scrollView
.
width
/
rulerRoot
.
tickSpacing
)
+
2
tickRepeater
.
model
=
Math
.
ceil
(
rulercontainer
.
width
/
rulerRoot
.
tickSpacing
)
+
2
}
function
adjustFormat
()
{
...
...
@@ -62,7 +62,7 @@ Item {
function
repaintRuler
()
{
// Enforce repaint
tickRepeater
.
model
=
0
tickRepeater
.
model
=
Math
.
ceil
(
scrollView
.
width
/
rulerRoot
.
tickSpacing
)
+
2
tickRepeater
.
model
=
Math
.
ceil
(
rulercontainer
.
width
/
rulerRoot
.
tickSpacing
)
+
2
}
// Timeline preview stuff
...
...
@@ -131,7 +131,7 @@ Item {
leftPadding
:
2
rightPadding
:
2
font
:
miniFont
color
:
activePalette
.
text
color
:
'
#FFF
'
}
MouseArea
{
z
:
10
...
...
@@ -182,7 +182,7 @@ Item {
anchors.right
:
parent
.
right
Repeater
{
id
:
tickRepeater
model
:
Math
.
ceil
(
scrollView
.
width
/
rulerRoot
.
tickSpacing
)
+
2
model
:
Math
.
ceil
(
rulercontainer
.
width
/
rulerRoot
.
tickSpacing
)
+
2
property
int
offset
:
Math
.
floor
(
scrollView
.
contentX
/
rulerRoot
.
tickSpacing
)
Item
{
property
int
realPos
:
(
tickRepeater
.
offset
+
index
)
*
rulerRoot
.
tickSpacing
/
timeline
.
scaleFactor
...
...
@@ -208,29 +208,6 @@ Item {
}
}
// Guide zone delimiter
Rectangle
{
width
:
rulerRoot
.
width
height
:
1
anchors.top
:
parent
.
top
anchors.topMargin
:
guideLabelHeight
color
:
activePalette
.
shadow
}
// monitor zone
Rectangle
{
width
:
rulerRoot
.
width
height
:
1
anchors.bottom
:
parent
.
bottom
anchors.bottomMargin
:
zoneHeight
color
:
activePalette
.
shadow
Rectangle
{
width
:
rulerRoot
.
width
height
:
1
anchors.top
:
parent
.
bottom
color
:
activePalette
.
light
}
}
RulerZone
{
id
:
zone
Binding
{
...
...
src/timeline2/view/qml/timeline.qml
View file @
7a00c571
...
...
@@ -326,6 +326,9 @@ Rectangle {
function
getItemAtPos
(
tk
,
posx
,
isComposition
)
{
var
track
=
Logic
.
getTrackById
(
tk
)
if
(
track
==
undefined
||
track
.
children
==
undefined
)
{
return
undefined
}
var
container
=
track
.
children
[
0
]
var
tentativeClip
=
undefined
for
(
var
i
=
0
;
i
<
container
.
children
.
length
;
i
++
)
{
...
...
@@ -1197,7 +1200,7 @@ Rectangle {
onDoubleClicked
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
&&
root
.
showSubtitles
&&
root
.
activeTool
===
0
&&
mouse
.
y
>
ruler
.
height
&&
mouse
.
y
<
(
ruler
.
height
+
subtitleTrack
.
height
))
{
timeline
.
addSubtitle
((
scrollView
.
contentX
+
mouseX
)
/
timeline
.
scaleFactor
)
}
else
if
(
mouse
.
y
<
ruler
.
h
eight
)
{
}
else
if
(
mouse
.
y
<
ruler
.
guideLabelH
eight
)
{
timeline
.
switchGuide
((
scrollView
.
contentX
+
mouseX
)
/
timeline
.
scaleFactor
,
false
)
}
}
...
...
@@ -1339,6 +1342,30 @@ Rectangle {
}
Item
{
// Guide zone delimiter
Rectangle
{
width
:
rulercontainer
.
width
height
:
1
anchors.top
:
parent
.
top
anchors.topMargin
:
ruler
.
guideLabelHeight
color
:
activePalette
.
dark
visible
:
ruler
.
guideLabelHeight
>
0
}
// monitor zone
Rectangle
{
width
:
rulercontainer
.
width
height
:
1
anchors.top
:
parent
.
top
anchors.topMargin
:
ruler
.
height
-
ruler
.
zoneHeight
color
:
activePalette
.
dark
Rectangle
{
width
:
rulercontainer
.
width
height
:
1
anchors.top
:
parent
.
bottom
color
:
activePalette
.
light
}
}
Flickable
{
// Non-slider scroll area for the Ruler.
id
:
rulercontainer
...
...
@@ -1348,6 +1375,9 @@ Rectangle {
contentWidth
:
Math
.
max
(
parent
.
width
,
timeline
.
fullDuration
*
timeScale
)
interactive
:
false
clip
:
true
onWidthChanged
:
{
ruler
.
adjustStepSize
()
}
Ruler
{
id
:
ruler
width
:
rulercontainer
.
contentWidth
...
...
@@ -1360,13 +1390,16 @@ Rectangle {
anchors.bottom
:
parent
.
bottom
x
:
cursor
.
x
-
(
width
/
2
)
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
NoButton
cursorShape
:
ruler
.
resizeActive
?
Qt
.
SizeHorCursor
:
dragProxyArea
.
drag
.
active
?
Qt
.
ClosedHandCursor
:
tracksArea
.
cursorShape
}
}
}
MouseArea
{
anchors.top
:
parent
.
top
height
:
rulercontainer
.
height
width
:
rulercontainer
.
width
acceptedButtons
:
Qt
.
NoButton
cursorShape
:
ruler
.
resizeActive
?
Qt
.
SizeHorCursor
:
tracksArea
.
cursorShape
}
Item
{
id
:
baseContainer
width
:
root
.
width
-
headerWidth
...
...
@@ -1423,9 +1456,6 @@ Rectangle {
anchors.left
:
scrollView
.
right
anchors.bottom
:
scrollView
.
bottom
}
//ScrollBar.horizontal.interactive: false
//ScrollBar.vertical.interactive: false
//Component.onCompleted: contentItem.interactive = false
contentWidth
:
tracksContainerArea
.
width
contentHeight
:
tracksContainerArea
.
height
Item
{
...
...
@@ -1808,18 +1838,18 @@ Rectangle {
DelegateModel
{
id
:
guidesDelegateModel
model
:
guidesModel
Item
{
id
:
guideRoot
z
:
20
Rectangle
{
id
:
guideBase
width
:
1
height
:
tracksContainer
.
height
x
:
model
.
frame
*
timeScale
;
color
:
model
.
color
}
Item
{
id
:
guideRoot
z
:
20
Rectangle
{
id
:
guideBase
width
:
1
height
:
tracksContainer
.
height
x
:
model
.
frame
*
timeScale
;
color
:
model
.
color
}
}
}
DelegateModel
{
...
...
@@ -1837,8 +1867,10 @@ Rectangle {
Connections
{
target
:
timeline
function
onFrameFormatChanged
()
{
ruler
.
adjustFormat
()
}
function
onSelectionChanged
()
{
onFrameFormatChanged
:
{
ruler
.
adjustFormat
()
}
onSelectionChanged
:
{
if
(
dragProxy
.
draggedItem
>
-
1
&&
!
timeline
.
exists
(
dragProxy
.
draggedItem
))
{
endDrag
()
}
...
...
src/timeline2/view/timelinewidget.cpp
View file @
7a00c571
...
...
@@ -196,8 +196,6 @@ void TimelineWidget::setModel(const std::shared_ptr<TimelineItemModel> &model, M
setVisible
(
true
);
loading
=
false
;
m_proxy
->
checkDuration
();
// Ensure timeline timecode get correctly painted
m_proxy
->
frameFormatChanged
();
}
void
TimelineWidget
::
mousePressEvent
(
QMouseEvent
*
event
)
...
...
Write
Preview
Supports
Markdown
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