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
8fc9b014
Commit
8fc9b014
authored
Mar 27, 2021
by
Rafał Lalik
Committed by
Julius Künzel
Mar 28, 2021
Browse files
Fix setting frame background color
Issue reported in Merge Request
!156
.
parent
7baf737f
Pipeline
#55751
passed with stage
in 10 minutes and 18 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/titler/patternsmodel.cpp
View file @
8fc9b014
...
...
@@ -67,7 +67,7 @@ QPixmap PatternsModel::paintScene(const QString & pattern)
QList
<
QGraphicsItem
*>
items
;
int
width
,
height
,
duration
,
missing
;
TitleDocument
::
loadFromXml
(
doc
,
items
,
width
,
height
,
nullptr
,
nullptr
,
&
duration
,
missing
);
TitleDocument
::
loadFromXml
(
doc
,
items
,
width
,
height
,
nullptr
,
nullptr
,
nullptr
,
&
duration
,
missing
);
QGraphicsScene
scene
(
0
,
0
,
width
,
height
);
...
...
src/titler/titledocument.cpp
View file @
8fc9b014
...
...
@@ -396,13 +396,14 @@ bool TitleDocument::saveDocument(const QUrl &url, QGraphicsRectItem *startv, QGr
return
result
;
}
int
TitleDocument
::
loadFromXml
(
const
QDomDocument
&
doc
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
const
QString
&
projectpath
)
int
TitleDocument
::
loadFromXml
(
const
QDomDocument
&
doc
,
GraphicsSceneRectMove
*
scene
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
const
QString
&
projectpath
)
{
m_projectPath
=
projectpath
;
QList
<
QGraphicsItem
*>
items
;
int
width
,
height
;
int
res
=
loadFromXml
(
doc
,
items
,
width
,
height
,
startv
,
endv
,
duration
,
m_missingElements
);
int
res
=
loadFromXml
(
doc
,
items
,
width
,
height
,
scene
,
startv
,
endv
,
duration
,
m_missingElements
);
if
(
m_width
!=
width
||
m_height
!=
height
)
{
KMessageBox
::
information
(
QApplication
::
activeWindow
(),
i18n
(
"This title clip was created with a different frame size."
),
i18n
(
"Title Profile"
));
...
...
@@ -417,7 +418,7 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QGraphicsRectItem *start
return
res
;
}
int
TitleDocument
::
loadFromXml
(
const
QDomDocument
&
doc
,
QList
<
QGraphicsItem
*>
&
gitems
,
int
&
width
,
int
&
height
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
int
&
missingElements
)
int
TitleDocument
::
loadFromXml
(
const
QDomDocument
&
doc
,
QList
<
QGraphicsItem
*>
&
gitems
,
int
&
width
,
int
&
height
,
GraphicsSceneRectMove
*
scene
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
int
&
missingElements
)
{
for
(
auto
*
i
:
gitems
)
{
delete
i
;
...
...
@@ -710,11 +711,15 @@ int TitleDocument::loadFromXml(const QDomDocument &doc, QList<QGraphicsItem *> &
// qCDebug(KDENLIVE_LOG) << items.item(i).attributes().namedItem("color").nodeValue();
QColor
color
=
QColor
(
stringToColor
(
itemNode
.
attributes
().
namedItem
(
QStringLiteral
(
"color"
)).
nodeValue
()));
// color.setAlpha(itemNode.attributes().namedItem("alpha").nodeValue().toInt());
for
(
auto
sceneItem
:
qAsConst
(
gitems
))
{
if
(
int
(
sceneItem
->
zValue
())
==
-
1100
)
{
static_cast
<
QGraphicsRectItem
*>
(
sceneItem
)
->
setBrush
(
QBrush
(
color
));
break
;
if
(
scene
)
{
QList
<
QGraphicsItem
*>
sceneItems
=
scene
->
items
();
for
(
auto
sceneItem
:
qAsConst
(
sceneItems
))
{
if
(
int
(
sceneItem
->
zValue
())
==
-
1100
)
{
static_cast
<
QGraphicsRectItem
*>
(
sceneItem
)
->
setBrush
(
QBrush
(
color
));
break
;
}
}
scene
->
setBackgroundBrush
(
QBrush
(
color
));
}
}
else
if
(
itemNode
.
nodeName
()
==
QLatin1String
(
"startviewport"
)
&&
(
startv
!=
nullptr
))
{
QString
rect
=
itemNode
.
attributes
().
namedItem
(
QStringLiteral
(
"rect"
)).
nodeValue
();
...
...
src/titler/titledocument.h
View file @
8fc9b014
...
...
@@ -34,6 +34,7 @@
class
QGraphicsScene
;
class
QGraphicsRectItem
;
class
QGraphicsItem
;
class
GraphicsSceneRectMove
;
class
TitleDocument
{
...
...
@@ -48,7 +49,7 @@ public:
QDomDocument
xml
(
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
bool
embed_images
=
false
);
/** @brief Load XML for this title. It calls static version for the function.
*/
int
loadFromXml
(
const
QDomDocument
&
doc
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
const
QString
&
projectpath
=
QString
());
int
loadFromXml
(
const
QDomDocument
&
doc
,
GraphicsSceneRectMove
*
scene
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
const
QString
&
projectpath
=
QString
());
/** \brief Get the background color (incl. alpha) from the document, if possibly
* \returns The background color of the document, inclusive alpha. If none found, returns (0,0,0,0) */
QColor
getBackgroundColor
()
const
;
...
...
@@ -71,7 +72,7 @@ public:
/**
* @brief General static function to load items into list from a xml file.
*/
static
int
loadFromXml
(
const
QDomDocument
&
doc
,
QList
<
QGraphicsItem
*>
&
gitems
,
int
&
width
,
int
&
height
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
int
&
missingElements
);
static
int
loadFromXml
(
const
QDomDocument
&
doc
,
QList
<
QGraphicsItem
*>
&
gitems
,
int
&
width
,
int
&
height
,
GraphicsSceneRectMove
*
scene
,
QGraphicsRectItem
*
startv
,
QGraphicsRectItem
*
endv
,
int
*
duration
,
int
&
missingElements
);
private:
QGraphicsScene
*
m_scene
;
...
...
src/titler/titlewidget.cpp
View file @
8fc9b014
...
...
@@ -2269,7 +2269,7 @@ void TitleWidget::setXml(const QDomDocument &doc, const QString &id)
delete
m_missingMessage
;
m_missingMessage
=
nullptr
;
}
m_count
=
m_titledocument
.
loadFromXml
(
doc
,
m_startViewport
,
m_endViewport
,
&
duration
,
m_projectTitlePath
);
m_count
=
m_titledocument
.
loadFromXml
(
doc
,
m_scene
,
m_startViewport
,
m_endViewport
,
&
duration
,
m_projectTitlePath
);
adjustFrameSize
();
if
(
m_titledocument
.
invalidCount
()
>
0
)
{
m_missingMessage
=
new
KMessageWidget
(
this
);
...
...
@@ -3474,7 +3474,7 @@ void TitleWidget::slotPatternDblClicked(const QModelIndex& idx)
QList
<
QGraphicsItem
*>
items
;
int
width
,
height
,
duration
,
missing
;
TitleDocument
::
loadFromXml
(
doc
,
items
,
width
,
height
,
nullptr
,
nullptr
,
&
duration
,
missing
);
TitleDocument
::
loadFromXml
(
doc
,
items
,
width
,
height
,
nullptr
,
nullptr
,
nullptr
,
&
duration
,
missing
);
for
(
QGraphicsItem
*
item
:
qAsConst
(
items
))
{
item
->
setZValue
(
m_count
++
);
...
...
Rafał Lalik
@fizyk
mentioned in commit
9ac90dcf
·
Mar 28, 2021
mentioned in commit
9ac90dcf
mentioned in commit 9ac90dcf3da6f49404acf19bfcf0db002328a012
Toggle commit list
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