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
9194ffee
Commit
9194ffee
authored
Dec 01, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix regression and lift layout flicker
Related to
#818
parent
3cdb86cd
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/assets/view/widgets/lumaliftgainparam.cpp
View file @
9194ffee
...
...
@@ -32,7 +32,7 @@ static const double GAIN_FACTOR = 4.0;
LumaLiftGainParam
::
LumaLiftGainParam
(
std
::
shared_ptr
<
AssetParameterModel
>
model
,
QModelIndex
index
,
QWidget
*
parent
)
:
AbstractParamWidget
(
std
::
move
(
model
),
index
,
parent
)
{
m_flowLayout
=
new
FlowLayout
(
this
,
2
,
2
,
2
);
m_flowLayout
=
new
FlowLayout
(
this
,
10
,
10
,
4
);
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Preferred
);
m_lift
=
new
ColorWheel
(
QStringLiteral
(
"lift"
),
i18n
(
"Lift"
),
NegQColor
(),
this
);
m_lift
->
setFactorDefaultZero
(
LIFT_FACTOR
,
0
,
0.5
);
...
...
src/effects/effectstack/view/effectstackview.cpp
View file @
9194ffee
...
...
@@ -187,7 +187,6 @@ void EffectStackView::dropEvent(QDropEvent *event)
void
EffectStackView
::
setModel
(
std
::
shared_ptr
<
EffectStackModel
>
model
,
const
QSize
frameSize
)
{
qDebug
()
<<
"MUTEX LOCK!!!!!!!!!!!! setmodel"
;
disconnect
(
&
m_timerHeight
,
&
QTimer
::
timeout
,
this
,
&
EffectStackView
::
updateTreeHeight
);
m_mutex
.
lock
();
unsetModel
(
false
);
m_effectsTree
->
setFixedHeight
(
0
);
...
...
@@ -236,7 +235,9 @@ void EffectStackView::loadEffects()
return
;
}
int
active
=
qBound
(
0
,
m_model
->
getActiveEffect
(),
max
-
1
);
bool
hasLift
=
false
;
QModelIndex
activeIndex
;
connect
(
&
m_timerHeight
,
&
QTimer
::
timeout
,
this
,
&
EffectStackView
::
updateTreeHeight
);
for
(
int
i
=
0
;
i
<
max
;
i
++
)
{
std
::
shared_ptr
<
AbstractEffectItem
>
item
=
m_model
->
getEffectStackRow
(
i
);
QSize
size
;
...
...
@@ -247,6 +248,9 @@ void EffectStackView::loadEffects()
std
::
shared_ptr
<
EffectItemModel
>
effectModel
=
std
::
static_pointer_cast
<
EffectItemModel
>
(
item
);
CollapsibleEffectView
*
view
=
nullptr
;
// We need to rebuild the effect view
if
(
effectModel
->
getAssetId
()
==
QLatin1String
(
"lift_gamma_gain"
))
{
hasLift
=
true
;
}
QImage
effectIcon
=
m_thumbnailer
->
requestImage
(
effectModel
->
getAssetId
(),
&
size
,
QSize
(
QStyle
::
PM_SmallIconSize
,
QStyle
::
PM_SmallIconSize
));
view
=
new
CollapsibleEffectView
(
effectModel
,
m_sourceFrameSize
,
effectIcon
,
this
);
connect
(
view
,
&
CollapsibleEffectView
::
deleteEffect
,
m_model
.
get
(),
&
EffectStackModel
::
removeEffect
);
...
...
@@ -275,10 +279,20 @@ void EffectStackView::loadEffects()
m_effectsTree
->
setCurrentIndex
(
activeIndex
);
}
}
if
(
!
hasLift
)
{
updateTreeHeight
();
}
if
(
activeIndex
.
isValid
())
{
doActivateEffect
(
active
,
activeIndex
,
true
);
if
(
active
>
0
)
{
if
(
hasLift
)
{
// Some effects have a complex timed layout, so we need to wait a bit before getting the correct position for the effect
QTimer
::
singleShot
(
100
,
this
,
&
EffectStackView
::
slotFocusEffect
);
}
else
{
slotFocusEffect
();
}
}
}
connect
(
&
m_timerHeight
,
&
QTimer
::
timeout
,
this
,
&
EffectStackView
::
updateTreeHeight
);
qDebug
()
<<
"MUTEX UNLOCK!!!!!!!!!!!! loadEffects"
;
}
...
...
@@ -386,6 +400,7 @@ void EffectStackView::unsetModel(bool reset)
disconnect
(
m_model
.
get
(),
&
EffectStackModel
::
dataChanged
,
this
,
&
EffectStackView
::
refresh
);
disconnect
(
m_model
.
get
(),
&
EffectStackModel
::
enabledStateChanged
,
this
,
&
EffectStackView
::
changeEnabledState
);
disconnect
(
this
,
&
EffectStackView
::
removeCurrentEffect
,
m_model
.
get
(),
&
EffectStackModel
::
removeCurrentEffect
);
disconnect
(
&
m_timerHeight
,
&
QTimer
::
timeout
,
this
,
&
EffectStackView
::
updateTreeHeight
);
}
if
(
reset
)
{
QMutexLocker
lock
(
&
m_mutex
);
...
...
@@ -465,10 +480,6 @@ void EffectStackView::doActivateEffect(int row, QModelIndex activeIx, bool force
if
(
w
)
{
w
->
slotActivateEffect
(
true
);
}
if
(
force
&&
row
>
0
)
{
// Some effects have a complex timed layout, so we need to wait a bit before getting the correct position for the effect
QTimer
::
singleShot
(
100
,
this
,
&
EffectStackView
::
slotFocusEffect
);
}
}
void
EffectStackView
::
slotFocusEffect
()
...
...
src/utils/flowlayout.cpp
View file @
9194ffee
...
...
@@ -42,6 +42,7 @@
#include <QWidget>
#include <QDebug>
#include <QtMath>
#include <QTimer>
FlowLayout
::
FlowLayout
(
QWidget
*
parent
,
int
margin
,
int
hSpacing
,
int
vSpacing
)
:
QLayout
(
parent
)
...
...
@@ -156,10 +157,12 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
QSize
min
=
wid
->
minimumSize
();
int
columns
=
qMin
(
qFloor
((
double
)
rect
.
width
()
/
min
.
width
()),
m_itemList
.
size
());
columns
=
qMax
(
1
,
columns
);
int
realWidth
=
rect
.
width
()
/
columns
-
horizontalSpacing
();
int
realWidth
=
qMin
(
wid
->
maximumWidth
(),
rect
.
width
()
/
columns
-
horizontalSpacing
());
realWidth
-=
realWidth
%
40
;
realWidth
=
qMax
(
realWidth
,
wid
->
minimumWidth
());
int
totalHeight
=
y
-
rect
.
y
()
+
mrg
.
bottom
()
+
qCeil
((
double
)
m_itemList
.
size
()
/
columns
)
*
(
realWidth
+
verticalSpacing
());
m_minimumSize
=
QSize
(
rect
.
w
idth
()
,
totalHeight
);
QSize
hint
=
QSize
(
qMin
(
wid
->
maximumWidth
(),
realWidth
),
qMin
(
wid
->
maximumWidth
()
,
realWidth
)
)
;
m_minimumSize
=
QSize
(
columns
*
realW
idth
,
totalHeight
);
QSize
hint
=
QSize
(
realWidth
,
realWidth
);
if
(
testOnly
)
{
return
totalHeight
;
}
...
...
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