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
Multimedia
Kdenlive
Commits
78aed6b7
Commit
78aed6b7
authored
Mar 19, 2020
by
Jean-Baptiste Mardelle
Browse files
Double click track resizer resets to default height
parent
cd277a3d
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/TrackHead.qml
View file @
78aed6b7
...
...
@@ -516,9 +516,11 @@ Rectangle {
property
double
startY
property
double
originalY
drag.smoothed
:
false
property
bool
dragStarted
:
false
onPressed
:
{
root
.
autoScrolling
=
false
dragStarted
=
false
startY
=
mapToItem
(
null
,
x
,
y
).
y
originalY
=
trackHeadRoot
.
height
// reusing originalX to accumulate delta for bubble help
}
...
...
@@ -527,15 +529,21 @@ Rectangle {
if
(
!
trimInMouseArea
.
containsMouse
)
{
parent
.
opacity
=
0
}
if
(
mouse
.
modifiers
&
Qt
.
ShiftModifier
)
{
if
(
mouse
.
modifiers
&
Qt
.
ShiftModifier
&&
dragStarted
)
{
timeline
.
adjustAllTrackHeight
(
trackHeadRoot
.
trackId
,
trackHeadRoot
.
myTrackHeight
)
}
}
onEntered
:
parent
.
opacity
=
0.3
onExited
:
parent
.
opacity
=
0
onDoubleClicked
:
{
timeline
.
defaultTrackHeight
(
mouse
.
modifiers
&
Qt
.
ShiftModifier
?
-
1
:
trackHeadRoot
.
trackId
)
}
onPositionChanged
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
)
{
parent
.
opacity
=
0.5
if
(
!
dragStarted
&&
Math
.
abs
(
mapToItem
(
null
,
x
,
y
).
y
-
startY
)
>
2
)
{
dragStarted
=
true
}
var
newHeight
=
originalY
+
(
mapToItem
(
null
,
x
,
y
).
y
-
startY
)
newHeight
=
Math
.
max
(
root
.
collapsedHeight
,
newHeight
)
trackHeadRoot
.
myTrackHeight
=
newHeight
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
78aed6b7
...
...
@@ -1034,6 +1034,26 @@ void TimelineController::adjustAllTrackHeight(int trackId, int height)
m_model
->
dataChanged
(
modelStart
,
modelEnd
,
{
TimelineModel
::
HeightRole
});
}
void
TimelineController
::
defaultTrackHeight
(
int
trackId
)
{
if
(
trackId
>
-
1
)
{
m_model
->
getTrackById
(
trackId
)
->
setProperty
(
QStringLiteral
(
"kdenlive:trackheight"
),
QString
::
number
(
KdenliveSettings
::
trackheight
()));
QModelIndex
modelStart
=
m_model
->
makeTrackIndexFromID
(
trackId
);
m_model
->
dataChanged
(
modelStart
,
modelStart
,
{
TimelineModel
::
HeightRole
});
return
;
}
auto
it
=
m_model
->
m_allTracks
.
cbegin
();
while
(
it
!=
m_model
->
m_allTracks
.
cend
())
{
int
target_track
=
(
*
it
)
->
getId
();
m_model
->
getTrackById
(
target_track
)
->
setProperty
(
QStringLiteral
(
"kdenlive:trackheight"
),
QString
::
number
(
KdenliveSettings
::
trackheight
()));
++
it
;
}
int
tracksCount
=
m_model
->
getTracksCount
();
QModelIndex
modelStart
=
m_model
->
makeTrackIndexFromID
(
m_model
->
getTrackIndexFromPosition
(
0
));
QModelIndex
modelEnd
=
m_model
->
makeTrackIndexFromID
(
m_model
->
getTrackIndexFromPosition
(
tracksCount
-
1
));
m_model
->
dataChanged
(
modelStart
,
modelEnd
,
{
TimelineModel
::
HeightRole
});
}
void
TimelineController
::
setPosition
(
int
position
)
{
// Process seek request
...
...
src/timeline2/view/timelinecontroller.h
View file @
78aed6b7
...
...
@@ -295,6 +295,10 @@ public:
*/
Q_INVOKABLE
void
adjustAllTrackHeight
(
int
trackId
,
int
height
);
/** @brief Reset track @trackId height to default track height. Adjusts all tracks if @trackId == -1
*/
Q_INVOKABLE
void
defaultTrackHeight
(
int
trackId
);
Q_INVOKABLE
bool
exists
(
int
itemId
);
Q_INVOKABLE
int
headerWidth
()
const
;
...
...
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