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
43f4e060
Commit
43f4e060
authored
Mar 20, 2022
by
Jean-Baptiste Mardelle
Browse files
Titler: remember and restore last used text alignment.
CCBUG: 413572
parent
37dfd901
Pipeline
#152964
passed with stage
in 6 minutes and 58 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/kdenlivesettings.kcfg
View file @
43f4e060
...
...
@@ -1223,6 +1223,10 @@
<label>
Show titler background.
</label>
<default>
false
</default>
</entry>
<entry
name=
"titlerAlign"
type=
"Int"
>
<label>
Default text align for titler.
</label>
<default>
0
</default>
</entry>
</group>
<group
name=
"speech"
>
<entry
name=
"vosk_folder_path"
type=
"String"
>
...
...
src/titler/graphicsscenerectmove.cpp
View file @
43f4e060
...
...
@@ -8,6 +8,7 @@ SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
#include "graphicsscenerectmove.h"
#include "titler/gradientwidget.h"
#include "titler/titledocument.h"
#include "kdenlivesettings.h"
#include "kdenlive_debug.h"
#include <QApplication>
...
...
@@ -52,7 +53,7 @@ void MyQGraphicsEffect::draw(QPainter *painter)
MyTextItem
::
MyTextItem
(
const
QString
&
txt
,
QGraphicsItem
*
parent
)
:
QGraphicsTextItem
(
txt
,
parent
)
,
m_alignment
(
qApp
->
isLeftToRight
()
?
Qt
::
AlignRight
:
Qt
::
AlignLeft
)
,
m_alignment
(
QFlags
<
Qt
::
AlignmentFlag
>
()
)
{
//Disabled because cache makes text cursor invisible and borders ugly
//setCacheMode(QGraphicsItem::ItemCoordinateCache);
...
...
@@ -859,6 +860,7 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e)
textItem
->
setFlags
(
QGraphicsItem
::
ItemIsMovable
|
QGraphicsItem
::
ItemIsSelectable
);
textItem
->
setTextInteractionFlags
(
Qt
::
TextEditorInteraction
);
textItem
->
setFocus
(
Qt
::
MouseFocusReason
);
textItem
->
setAlignment
(
QFlags
<
Qt
::
AlignmentFlag
>
(
KdenliveSettings
::
titlerAlign
()));
emit
newText
(
textItem
);
m_selectedItem
=
textItem
;
m_selectedItem
->
setSelected
(
true
);
...
...
src/titler/graphicsscenerectmove.h
View file @
43f4e060
...
...
@@ -37,7 +37,7 @@ class MyTextItem : public QGraphicsTextItem
{
Q_OBJECT
public:
MyTextItem
(
const
QString
&
,
QGraphicsItem
*
parent
=
nullptr
);
MyTextItem
(
const
QString
&
txt
,
QGraphicsItem
*
parent
=
nullptr
);
void
setAlignment
(
Qt
::
Alignment
alignment
);
/** @brief returns an extended bounding containing shadow */
QRectF
boundingRect
()
const
override
;
...
...
src/titler/titlewidget.cpp
View file @
43f4e060
...
...
@@ -112,10 +112,14 @@ TitleWidget::TitleWidget(const QUrl &url, QString projectTitlePath, Monitor *mon
colorGroup
->
addButton
(
gradient_color
);
colorGroup
->
addButton
(
plain_color
);
auto
*
alignGroup
=
new
QButtonGroup
(
this
);
alignGroup
->
addButton
(
buttonAlignLeft
);
alignGroup
->
addButton
(
buttonAlignCenter
);
alignGroup
->
addButton
(
buttonAlignRight
);
m_textAlignGroup
=
new
QButtonGroup
(
this
);
m_textAlignGroup
->
addButton
(
buttonAlignLeft
,
0
);
m_textAlignGroup
->
addButton
(
buttonAlignCenter
,
1
);
m_textAlignGroup
->
addButton
(
buttonAlignRight
,
2
);
QAbstractButton
*
selectedButton
=
m_textAlignGroup
->
button
(
KdenliveSettings
::
titlerAlign
());
if
(
selectedButton
)
{
selectedButton
->
setChecked
(
true
);
}
textOutline
->
setMinimum
(
0
);
textOutline
->
setMaximum
(
200
);
...
...
@@ -235,9 +239,10 @@ TitleWidget::TitleWidget(const QUrl &url, QString projectTitlePath, Monitor *mon
connect
(
buttonRealSize
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotZoomOneToOne
);
connect
(
buttonItalic
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotUpdateText
);
connect
(
buttonUnder
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotUpdateText
);
connect
(
buttonAlignLeft
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotUpdateText
);
connect
(
buttonAlignRight
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotUpdateText
);
connect
(
buttonAlignCenter
,
&
QAbstractButton
::
clicked
,
this
,
&
TitleWidget
::
slotUpdateText
);
connect
(
m_textAlignGroup
,
QOverload
<
QAbstractButton
*>::
of
(
&
QButtonGroup
::
buttonClicked
),
this
,
[
this
]()
{
KdenliveSettings
::
setTitlerAlign
(
m_textAlignGroup
->
checkedId
());
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
),
this
,
[
&
]
()
{
...
...
@@ -273,12 +278,6 @@ TitleWidget::TitleWidget(const QUrl &url, QString projectTitlePath, Monitor *mon
buttonAlignLeft
->
setIconSize
(
iconSize
);
buttonAlignRight
->
setIconSize
(
iconSize
);
if
(
qApp
->
isLeftToRight
())
{
buttonAlignRight
->
setChecked
(
true
);
}
else
{
buttonAlignLeft
->
setChecked
(
true
);
}
m_unicodeAction
=
new
QAction
(
QIcon
::
fromTheme
(
QStringLiteral
(
"kdenlive-insert-unicode"
)),
QString
(),
this
);
m_unicodeAction
->
setShortcut
(
Qt
::
SHIFT
+
Qt
::
CTRL
+
Qt
::
Key_U
);
m_unicodeAction
->
setToolTip
(
getTooltipWithShortcut
(
i18n
(
"Insert Unicode character"
),
m_unicodeAction
));
...
...
@@ -3006,8 +3005,13 @@ void TitleWidget::prepareTools(QGraphicsItem *referenceItem)
buttonAlignCenter
->
setChecked
(
true
);
}
else
if
(
i
->
alignment
()
==
Qt
::
AlignRight
)
{
buttonAlignRight
->
setChecked
(
true
);
}
else
{
}
else
if
(
i
->
alignment
()
==
Qt
::
AlignLeft
)
{
buttonAlignLeft
->
setChecked
(
true
);
}
else
{
QAbstractButton
*
selectedButton
=
m_textAlignGroup
->
button
(
KdenliveSettings
::
titlerAlign
());
if
(
selectedButton
)
{
selectedButton
->
setChecked
(
true
);
}
}
QStringList
sInfo
=
i
->
shadowInfo
();
...
...
src/titler/titlewidget.h
View file @
43f4e060
...
...
@@ -112,6 +112,7 @@ private:
QGraphicsRectItem
*
m_frameBorder
;
QGraphicsRectItem
*
m_frameBackground
;
QGraphicsPixmapItem
*
m_frameImage
;
QButtonGroup
*
m_textAlignGroup
;
int
m_frameWidth
;
int
m_frameHeight
;
int
m_count
;
...
...
Farid Abdelnour
🎥
@frdbr
mentioned in issue
#951 (closed)
·
Mar 20, 2022
mentioned in issue
#951 (closed)
mentioned in issue #951
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