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
a2ecf104
Commit
a2ecf104
authored
Aug 14, 2022
by
Julius Künzel
💬
Browse files
[Qt6] Port some deprecated QVariant functions
parent
842958f2
Changes
8
Hide whitespace changes
Inline
Side-by-side
src/assets/keyframes/model/keyframemodel.cpp
View file @
a2ecf104
...
...
@@ -220,7 +220,11 @@ bool KeyframeModel::moveKeyframe(GenTime oldPos, GenTime pos, const QVariant &ne
if
(
ptr
->
m_selectedKeyframes
.
size
()
>
1
)
{
// We have several selected keyframes, move them all
double
offset
=
0.
;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if
(
newVal
.
isValid
()
&&
newVal
.
type
()
==
QVariant
::
Double
)
{
#else
if
(
newVal
.
isValid
()
&&
newVal
.
typeId
()
==
QMetaType
::
Double
)
{
#endif
int
row
=
static_cast
<
int
>
(
std
::
distance
(
m_keyframeList
.
begin
(),
m_keyframeList
.
find
(
oldPos
)));
double
oldVal
=
data
(
index
(
row
),
NormalizedValueRole
).
toDouble
();
offset
=
newVal
.
toDouble
()
-
oldVal
;
...
...
@@ -1023,7 +1027,7 @@ void KeyframeModel::parseRotoProperty(const QString &prop)
QJsonParseError
jsonError
;
QJsonDocument
doc
=
QJsonDocument
::
fromJson
(
prop
.
toLatin1
(),
&
jsonError
);
QVariant
data
=
doc
.
toVariant
();
if
(
data
.
canConvert
(
QMetaType
::
QVariantMap
))
{
if
(
data
.
canConvert
<
QVariantMap
>
(
))
{
QMap
<
QString
,
QVariant
>
map
=
data
.
toMap
();
QMap
<
QString
,
QVariant
>::
const_iterator
i
=
map
.
constBegin
();
while
(
i
!=
map
.
constEnd
())
{
...
...
src/assets/keyframes/model/rotoscoping/rotohelper.cpp
View file @
a2ecf104
...
...
@@ -68,7 +68,7 @@ QList<BPoint> RotoHelper::getPoints(const QVariant &value, const QSize frame)
QList
<
QVariant
>
data
=
value
.
toList
();
// skip tracking flag
if
(
data
.
count
()
&&
data
.
at
(
0
).
canConvert
(
QMetaType
::
QString
))
{
if
(
data
.
count
()
&&
data
.
at
(
0
).
canConvert
<
QString
>
(
))
{
data
.
removeFirst
();
}
...
...
src/assets/model/assetparametermodel.cpp
View file @
a2ecf104
...
...
@@ -907,7 +907,13 @@ QJsonDocument AssetParameterModel::toJson(bool includeFixed) const
QModelIndex
ix
=
index
(
m_rows
.
indexOf
(
fixed
.
first
),
0
);
currentParam
.
insert
(
QLatin1String
(
"name"
),
QJsonValue
(
fixed
.
first
));
currentParam
.
insert
(
QLatin1String
(
"value"
),
fixed
.
second
.
type
()
==
QVariant
::
Double
?
QJsonValue
(
fixed
.
second
.
toDouble
())
:
QJsonValue
(
fixed
.
second
.
toString
()));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
fixed
.
second
.
type
()
==
QVariant
::
Double
#else
fixed
.
second
.
typeId
()
==
QMetaType
::
Double
#endif
?
QJsonValue
(
fixed
.
second
.
toDouble
())
:
QJsonValue
(
fixed
.
second
.
toString
()));
int
type
=
data
(
ix
,
AssetParameterModel
::
TypeRole
).
toInt
();
double
min
=
data
(
ix
,
AssetParameterModel
::
MinRole
).
toDouble
();
double
max
=
data
(
ix
,
AssetParameterModel
::
MaxRole
).
toDouble
();
...
...
@@ -954,8 +960,15 @@ QJsonDocument AssetParameterModel::toJson(bool includeFixed) const
currentParam
.
insert
(
QLatin1String
(
"name"
),
QJsonValue
(
param
.
first
));
currentParam
.
insert
(
QLatin1String
(
"DisplayName"
),
QJsonValue
(
param
.
second
.
name
));
currentParam
.
insert
(
QLatin1String
(
"value"
),
param
.
second
.
value
.
type
()
==
QVariant
::
Double
?
QJsonValue
(
param
.
second
.
value
.
toDouble
())
:
QJsonValue
(
param
.
second
.
value
.
toString
()));
currentParam
.
insert
(
QLatin1String
(
"value"
),
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
param
.
second
.
value
.
type
()
==
QVariant
::
Double
#else
param
.
second
.
value
.
typeId
()
==
QMetaType
::
Double
#endif
?
QJsonValue
(
param
.
second
.
value
.
toDouble
())
:
QJsonValue
(
param
.
second
.
value
.
toString
()));
int
type
=
data
(
ix
,
AssetParameterModel
::
TypeRole
).
toInt
();
double
min
=
data
(
ix
,
AssetParameterModel
::
MinRole
).
toDouble
();
double
max
=
data
(
ix
,
AssetParameterModel
::
MaxRole
).
toDouble
();
...
...
@@ -1018,7 +1031,14 @@ QJsonDocument AssetParameterModel::valueAsJson(int pos, bool includeFixed) const
auto
value
=
m_keyframes
->
getInterpolatedValue
(
pos
,
ix
);
currentParam
.
insert
(
QLatin1String
(
"name"
),
QJsonValue
(
fixed
.
first
));
currentParam
.
insert
(
QLatin1String
(
"value"
),
QJsonValue
(
QStringLiteral
(
"0=%1"
).
arg
(
value
.
type
()
==
QVariant
::
Double
?
QString
::
number
(
value
.
toDouble
())
:
value
.
toString
())));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
value
.
type
()
==
QVariant
::
Double
#else
value
.
typeId
()
==
QMetaType
::
Double
#endif
?
QString
::
number
(
value
.
toDouble
())
:
value
.
toString
())));
int
type
=
data
(
ix
,
AssetParameterModel
::
TypeRole
).
toInt
();
double
min
=
data
(
ix
,
AssetParameterModel
::
MinRole
).
toDouble
();
double
max
=
data
(
ix
,
AssetParameterModel
::
MaxRole
).
toDouble
();
...
...
@@ -1066,8 +1086,16 @@ QJsonDocument AssetParameterModel::valueAsJson(int pos, bool includeFixed) const
}
currentParam
.
insert
(
QLatin1String
(
"name"
),
QJsonValue
(
param
.
first
));
currentParam
.
insert
(
QLatin1String
(
"value"
),
QJsonValue
(
QStringLiteral
(
"0=%1"
).
arg
(
value
.
type
()
==
QVariant
::
Double
?
QString
::
number
(
value
.
toDouble
())
:
value
.
toString
())));
currentParam
.
insert
(
QLatin1String
(
"value"
),
QJsonValue
(
QStringLiteral
(
"0=%1"
).
arg
(
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
value
.
type
()
==
QVariant
::
Double
#else
value
.
typeId
()
==
QMetaType
::
Double
#endif
?
QString
::
number
(
value
.
toDouble
())
:
value
.
toString
())));
int
type
=
data
(
ix
,
AssetParameterModel
::
TypeRole
).
toInt
();
double
min
=
data
(
ix
,
AssetParameterModel
::
MinRole
).
toDouble
();
double
max
=
data
(
ix
,
AssetParameterModel
::
MaxRole
).
toDouble
();
...
...
src/bin/projectsortproxymodel.cpp
View file @
a2ecf104
...
...
@@ -112,10 +112,18 @@ bool ProjectSortProxyModel::lessThan(const QModelIndex &left, const QModelIndex
// Let the normal alphabetical sort happen
const
QVariant
leftData
=
sourceModel
()
->
data
(
left
,
Qt
::
DisplayRole
);
const
QVariant
rightData
=
sourceModel
()
->
data
(
right
,
Qt
::
DisplayRole
);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if
(
leftData
.
type
()
==
QVariant
::
DateTime
)
{
#else
if
(
leftData
.
typeId
()
==
QMetaType
::
QDateTime
)
{
#endif
return
leftData
.
toDateTime
()
<
rightData
.
toDateTime
();
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if
(
leftData
.
type
()
==
QVariant
::
Int
)
{
#else
if
(
leftData
.
typeId
()
==
QMetaType
::
Int
)
{
#endif
return
leftData
.
toInt
()
<
rightData
.
toInt
();
}
return
m_collator
.
compare
(
leftData
.
toString
(),
rightData
.
toString
())
<
0
;
...
...
src/capture/mediacapture.h
View file @
a2ecf104
...
...
@@ -91,7 +91,7 @@ private:
std
::
unique_ptr
<
QAudioRecorder
>
m_audioRecorder
;
#else
// TODO: Qt6
//std::unique_ptr<QMediaCaptureSession> m_mediaCapture;
//
std::unique_ptr<QMediaCaptureSession> m_mediaCapture;
#endif
std
::
unique_ptr
<
QAudioInput
>
m_audioInput
;
QScopedPointer
<
AudioDevInfo
>
m_audioInfo
;
...
...
src/jobs/filtertask.cpp
View file @
a2ecf104
...
...
@@ -157,7 +157,11 @@ void FilterTask::run()
if
(
it
.
first
==
QLatin1String
(
"in"
)
||
it
.
first
==
QLatin1String
(
"out"
))
{
continue
;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if
(
it
.
second
.
type
()
==
QVariant
::
Double
)
{
#else
if
(
it
.
second
.
typeId
()
==
QMetaType
::
Double
)
{
#endif
filter
.
set
(
it
.
first
.
toUtf8
().
constData
(),
it
.
second
.
toDouble
());
}
else
{
filter
.
set
(
it
.
first
.
toUtf8
().
constData
(),
it
.
second
.
toString
().
toUtf8
().
constData
());
...
...
src/jobs/speedtask.cpp
View file @
a2ecf104
...
...
@@ -215,7 +215,11 @@ void SpeedTask::run()
// Process filter params
for
(
const
auto
&
it
:
m_filterParams
)
{
qDebug
()
<<
". . ."
<<
it
.
first
<<
" = "
<<
it
.
second
;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if
(
it
.
second
.
type
()
==
QVariant
::
Double
)
{
#else
if
(
it
.
second
.
typeId
()
==
QMetaType
::
Double
)
{
#endif
producerArgs
<<
QString
(
"%1=%2"
).
arg
(
it
.
first
,
QString
::
number
(
it
.
second
.
toDouble
()));
}
else
{
producerArgs
<<
QString
(
"%1=%2"
).
arg
(
it
.
first
,
it
.
second
.
toString
());
...
...
src/jobs/stabilizetask.cpp
View file @
a2ecf104
...
...
@@ -150,7 +150,11 @@ void StabilizeTask::run()
qDebug
()
<<
" = = = = = CONFIGURING FILTER PARAMS = = = = = "
;
for
(
const
auto
&
it
:
m_filterParams
)
{
qDebug
()
<<
". . ."
<<
it
.
first
<<
" = "
<<
it
.
second
;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if
(
it
.
second
.
type
()
==
QVariant
::
Double
)
{
#else
if
(
it
.
second
.
typeId
()
==
QMetaType
::
Double
)
{
#endif
producerArgs
<<
QString
(
"%1=%2"
).
arg
(
it
.
first
,
QString
::
number
(
it
.
second
.
toDouble
()));
}
else
{
producerArgs
<<
QString
(
"%1=%2"
).
arg
(
it
.
first
,
it
.
second
.
toString
());
...
...
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