Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
258
Issues
258
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
beb7d916
Commit
beb7d916
authored
Apr 28, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix aspect ratio not working on title images
BUG: 420676
parent
488a1d8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
23 deletions
+35
-23
src/titler/titlewidget.cpp
src/titler/titlewidget.cpp
+19
-7
src/ui/titlewidget_ui.ui
src/ui/titlewidget_ui.ui
+16
-16
No files found.
src/titler/titlewidget.cpp
View file @
beb7d916
...
...
@@ -225,6 +225,9 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, QString projectTit
connect
(
buttonAlignCenter
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotUpdateText
);
connect
(
edit_gradient
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotEditGradient
);
connect
(
edit_rect_gradient
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotEditGradient
);
connect
(
preserveAspectRatio
,
static_cast
<
void
(
QCheckBox
::*
)(
int
)
>
(
&
QCheckBox
::
stateChanged
),
[
&
]
()
{
slotValueChanged
(
ValueWidth
);
});
displayBg
->
setChecked
(
KdenliveSettings
::
titlerShowbg
());
connect
(
displayBg
,
static_cast
<
void
(
QCheckBox
::*
)(
int
)
>
(
&
QCheckBox
::
stateChanged
),
[
&
]
(
int
state
)
{
...
...
@@ -1238,6 +1241,8 @@ void TitleWidget::slotValueChanged(int type)
// Scaling factor
double
scale
=
1
;
double
scalex
=
t
.
scalex
;
double
scaley
=
t
.
scaley
;
// We want to keep the aspect ratio of the image as the user does not yet have the possibility
// to restore the original ratio. You rarely want to change it anyway.
...
...
@@ -1245,18 +1250,23 @@ void TitleWidget::slotValueChanged(int type)
case
ValueWidth
:
// Add 0.5 because otherwise incrementing by 1 might have no effect
length
=
val
/
(
cos
(
alpha
)
+
1
/
phi
*
sin
(
alpha
))
+
0.5
;
scale
=
length
/
i
->
boundingRect
().
width
();
scalex
=
length
/
i
->
boundingRect
().
width
();
if
(
preserveAspectRatio
->
isChecked
())
{
scaley
=
scalex
;
}
break
;
case
ValueHeight
:
length
=
val
/
(
phi
*
sin
(
alpha
)
+
cos
(
alpha
))
+
0.5
;
scale
=
length
/
i
->
boundingRect
().
height
();
scaley
=
length
/
i
->
boundingRect
().
height
();
if
(
preserveAspectRatio
->
isChecked
())
{
scalex
=
scaley
;
}
break
;
}
t
.
scalex
=
scale
;
t
.
scaley
=
scale
;
t
.
scalex
=
scalex
;
t
.
scaley
=
scaley
;
QTransform
qtrans
;
qtrans
.
scale
(
scale
,
scale
);
qtrans
.
scale
(
scale
x
,
scaley
);
qtrans
.
rotate
(
t
.
rotatex
,
Qt
::
XAxis
);
qtrans
.
rotate
(
t
.
rotatey
,
Qt
::
YAxis
);
qtrans
.
rotate
(
t
.
rotatez
,
Qt
::
ZAxis
);
...
...
@@ -2921,8 +2931,10 @@ void TitleWidget::prepareTools(QGraphicsItem *referenceItem)
updateCoordinates
(
referenceItem
);
updateDimension
(
referenceItem
);
enableToolbars
(
TITLE_IMAGE
);
QSignalBlocker
bk
(
preserveAspectRatio
);
Transform
t
=
m_transformations
.
value
(
referenceItem
);
preserveAspectRatio
->
setChecked
(
t
.
scalex
==
t
.
scaley
);
}
else
{
showToolbars
(
TITLE_SELECT
);
...
...
src/ui/titlewidget_ui.ui
View file @
beb7d916
...
...
@@ -351,14 +351,14 @@
<property
name=
"flat"
>
<bool>
false
</bool>
</property>
<property
name=
"color"
>
<property
name=
"color"
stdset=
"0"
>
<color>
<red>
255
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</property>
<property
name=
"defaultColor"
>
<property
name=
"defaultColor"
stdset=
"0"
>
<color>
<red>
255
</red>
<green>
0
</green>
...
...
@@ -643,8 +643,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
628
</width>
<height>
729
</height>
<width>
544
</width>
<height>
506
</height>
</rect>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_9"
>
...
...
@@ -781,7 +781,7 @@
<item
row=
"5"
column=
"0"
colspan=
"7"
>
<widget
class=
"QGroupBox"
name=
"shadowBox"
>
<property
name=
"title"
>
<string>
Sh
&
a
dow
</string>
<string>
Sh
a
&
dow
</string>
</property>
<property
name=
"checkable"
>
<bool>
true
</bool>
...
...
@@ -821,14 +821,14 @@
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"color"
>
<property
name=
"color"
stdset=
"0"
>
<color
alpha=
"100"
>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</property>
<property
name=
"alphaChannelEnabled"
>
<property
name=
"alphaChannelEnabled"
stdset=
"0"
>
<bool>
true
</bool>
</property>
</widget>
...
...
@@ -982,14 +982,14 @@
<property
name=
"flat"
>
<bool>
false
</bool>
</property>
<property
name=
"color"
>
<property
name=
"color"
stdset=
"0"
>
<color>
<red>
255
</red>
<green>
255
</green>
<blue>
255
</blue>
</color>
</property>
<property
name=
"defaultColor"
>
<property
name=
"defaultColor"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
...
...
@@ -1047,14 +1047,14 @@
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"color"
>
<property
name=
"color"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</property>
<property
name=
"defaultColor"
>
<property
name=
"defaultColor"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
...
...
@@ -1112,14 +1112,14 @@
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"color"
>
<property
name=
"color"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</property>
<property
name=
"defaultColor"
>
<property
name=
"defaultColor"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
...
...
@@ -1162,7 +1162,7 @@
<item
row=
"0"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"preserveAspectRatio"
>
<property
name=
"enabled"
>
<bool>
fals
e
</bool>
<bool>
tru
e
</bool>
</property>
<property
name=
"text"
>
<string>
Preserve aspect ratio
</string>
...
...
@@ -1231,14 +1231,14 @@
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"color"
>
<property
name=
"color"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
<blue>
0
</blue>
</color>
</property>
<property
name=
"defaultColor"
>
<property
name=
"defaultColor"
stdset=
"0"
>
<color>
<red>
0
</red>
<green>
0
</green>
...
...
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