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
7313d42b
Commit
7313d42b
authored
Apr 16, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix effect param refresh issue and crash on undo add effect.
Fixes
#633
parent
463060ab
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/assets/view/assetparameterview.cpp
View file @
7313d42b
...
...
@@ -235,26 +235,22 @@ void AssetParameterView::refresh(const QModelIndex &topLeft, const QModelIndex &
// We are expecting indexes that are children of the root index, which is "invalid"
Q_ASSERT
(
!
topLeft
.
parent
().
isValid
());
// We make sure the range is valid
if
(
m_mainKeyframeWidget
)
{
m_mainKeyframeWidget
->
slotRefresh
();
auto
type
=
m_model
->
data
(
m_model
->
index
(
topLeft
.
row
(),
0
),
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
if
(
type
==
ParamType
::
ColorWheel
)
{
// Some special widgets, like colorwheel handle multiple params so we can have cases where param index row is greater than the number of widgets.
// Should be better managed
m_widgets
[
0
]
->
slotRefresh
();
return
;
}
size_t
max
;
if
(
!
bottomRight
.
isValid
())
{
max
=
m_widgets
.
size
()
-
1
;
}
else
{
auto
type
=
m_model
->
data
(
m_model
->
index
(
topLeft
.
row
(),
0
),
AssetParameterModel
::
TypeRole
).
value
<
ParamType
>
();
if
(
type
==
ParamType
::
ColorWheel
)
{
// Some special widgets, like colorwheel handle multiple params so we can have cases where param index row is greater than the number of widgets.
// Should be better managed
m_widgets
[
0
]
->
slotRefresh
();
return
;
}
size_t
max
;
if
(
!
bottomRight
.
isValid
())
{
max
=
m_widgets
.
size
()
-
1
;
}
else
{
max
=
(
size_t
)
bottomRight
.
row
();
}
Q_ASSERT
(
max
<
m_widgets
.
size
());
for
(
size_t
i
=
(
size_t
)
topLeft
.
row
();
i
<=
max
;
++
i
)
{
m_widgets
[
i
]
->
slotRefresh
();
}
max
=
(
size_t
)
bottomRight
.
row
();
}
Q_ASSERT
(
max
<
m_widgets
.
size
());
for
(
size_t
i
=
(
size_t
)
topLeft
.
row
();
i
<=
max
;
++
i
)
{
m_widgets
[
i
]
->
slotRefresh
();
}
}
...
...
src/assets/view/widgets/boolparamwidget.cpp
View file @
7313d42b
...
...
@@ -41,7 +41,8 @@ BoolParamWidget::BoolParamWidget(std::shared_ptr<AssetParameterModel> model, QMo
slotRefresh
();
// emit the signal of the base class when appropriate
connect
(
this
->
m_checkBox
,
&
QCheckBox
::
stateChanged
,
[
this
](
int
)
{
emit
valueChanged
(
m_index
,
QString
::
number
(
m_checkBox
->
isChecked
()),
true
);
});
connect
(
this
->
m_checkBox
,
&
QCheckBox
::
stateChanged
,
[
this
](
int
)
{
emit
valueChanged
(
m_index
,
QString
::
number
(
m_checkBox
->
isChecked
()),
true
);
});
}
void
BoolParamWidget
::
slotShowComment
(
bool
show
)
...
...
@@ -53,6 +54,7 @@ void BoolParamWidget::slotShowComment(bool show)
void
BoolParamWidget
::
slotRefresh
()
{
QSignalBlocker
bk
(
m_checkBox
);
bool
checked
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toInt
();
m_checkBox
->
setChecked
(
checked
);
}
...
...
src/assets/view/widgets/coloreditwidget.cpp
View file @
7313d42b
...
...
@@ -134,6 +134,7 @@ void ColorEditWidget::slotShowComment(bool) {}
void
ColorEditWidget
::
slotRefresh
()
{
QSignalBlocker
bk
(
this
);
QString
color
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toString
();
m_button
->
setColor
(
stringToColor
(
color
));
}
...
...
src/assets/view/widgets/doubleparamwidget.cpp
View file @
7313d42b
...
...
@@ -57,6 +57,7 @@ DoubleParamWidget::DoubleParamWidget(std::shared_ptr<AssetParameterModel> model,
void
DoubleParamWidget
::
slotRefresh
()
{
QSignalBlocker
bk
(
m_doubleWidget
);
QLocale
locale
;
locale
.
setNumberOptions
(
QLocale
::
OmitGroupSeparator
);
double
value
=
locale
.
toDouble
(
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toString
());
...
...
src/assets/view/widgets/fontparamwidget.cpp
View file @
7313d42b
...
...
@@ -48,6 +48,7 @@ void FontParamWidget::slotShowComment(bool show)
void
FontParamWidget
::
slotRefresh
()
{
QSignalBlocker
bk
(
fontfamilywidget
);
const
QString
family
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toString
();
fontfamilywidget
->
setCurrentFont
(
QFont
(
family
));
}
...
...
src/assets/view/widgets/positioneditwidget.cpp
View file @
7313d42b
...
...
@@ -91,6 +91,7 @@ void PositionEditWidget::slotUpdatePosition()
void
PositionEditWidget
::
slotRefresh
()
{
const
QSignalBlocker
bk
(
m_slider
);
int
min
=
m_model
->
data
(
m_index
,
AssetParameterModel
::
ParentInRole
).
toInt
();
int
max
=
min
+
m_model
->
data
(
m_index
,
AssetParameterModel
::
ParentDurationRole
).
toInt
();
const
QSignalBlocker
blocker
(
m_slider
);
...
...
src/assets/view/widgets/switchparamwidget.cpp
View file @
7313d42b
...
...
@@ -59,5 +59,6 @@ void SwitchParamWidget::slotShowComment(bool show)
void
SwitchParamWidget
::
slotRefresh
()
{
const
QSignalBlocker
bk
(
m_checkBox
);
m_checkBox
->
setChecked
(
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
)
==
m_model
->
data
(
m_index
,
AssetParameterModel
::
MaxRole
));
}
src/assets/view/widgets/urlparamwidget.cpp
View file @
7313d42b
...
...
@@ -66,5 +66,6 @@ void UrlParamWidget::slotShowComment(bool show)
void
UrlParamWidget
::
slotRefresh
()
{
const
QSignalBlocker
bk
(
urlwidget
);
urlwidget
->
setUrl
(
QUrl
::
fromLocalFile
(
m_model
->
data
(
m_index
,
AssetParameterModel
::
ValueRole
).
toString
()));
}
src/effects/effectstack/view/effectstackview.cpp
View file @
7313d42b
...
...
@@ -436,12 +436,14 @@ void EffectStackView::doActivateEffect(int row, QModelIndex activeIx, bool force
// Effect is already active
return
;
}
if
(
row
!=
currentActive
&&
currentActive
>
-
1
)
{
if
(
row
!=
currentActive
&&
currentActive
>
-
1
&&
currentActive
<
m_model
->
rowCount
()
)
{
auto
item
=
m_model
->
getEffectStackRow
(
currentActive
);
QModelIndex
ix
=
m_model
->
getIndexFromItem
(
item
);
CollapsibleEffectView
*
w
=
static_cast
<
CollapsibleEffectView
*>
(
m_effectsTree
->
indexWidget
(
ix
));
if
(
w
)
{
w
->
slotActivateEffect
(
false
);
if
(
item
)
{
QModelIndex
ix
=
m_model
->
getIndexFromItem
(
item
);
CollapsibleEffectView
*
w
=
static_cast
<
CollapsibleEffectView
*>
(
m_effectsTree
->
indexWidget
(
ix
));
if
(
w
)
{
w
->
slotActivateEffect
(
false
);
}
}
}
m_model
->
setActiveEffect
(
row
);
...
...
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