made the alignment of text persistent and editable

This commit is contained in:
Chris Cochrun 2022-04-14 06:30:12 -05:00
parent 2e46f403be
commit 672158a316
3 changed files with 16 additions and 12 deletions

View file

@ -22,8 +22,8 @@ Item {
property string chosenFont: "Quicksand"
property var text: "This is demo text"
property color backgroundColor
property var horizontalAlignment: Text.AlignHCenter
property var verticalAlignment: Text.AlignVCenter
property var hTextAlignment: Text.AlignHCenter
property var vTextAlignment: Text.AlignVCenter
//these properties are for giving video info to parents
property int mpvPosition: mpv.position
@ -119,8 +119,8 @@ Item {
/* minimumPointSize: 5 */
fontSizeMode: Text.Fit
font.family: chosenFont
horizontalAlignment: horizontalAlignment
verticalAlignment: verticalAlignment
horizontalAlignment: hTextAlignment
verticalAlignment: vTextAlignment
style: Text.Raised
anchors.fill: parent
clip: true

View file

@ -23,8 +23,8 @@ Item {
editMode: true
imageSource: imageBackground
videoSource: videoBackground
horizontalAlignment: hTextAlignment
verticalAlignment: vTextAlignment
hTextAlignment: root.hTextAlignment
vTextAlignment: root.vTextAlignment
preview: true
}
@ -56,7 +56,7 @@ Item {
function updateVAlignment(alignment) {
switch (alignment) {
case "top" :
representation.verticalAlignment = Text.AlignBottom;
representation.verticalAlignment = Text.AlignTop;
break;
case "center" :
representation.verticalAlignment = Text.AlignVCenter;

View file

@ -53,14 +53,14 @@ Item {
model: ["Left", "Center", "Right", "Justify"]
implicitWidth: 100
hoverEnabled: true
onCurrentTextChanged: updateHorizontalTextAlignment(currentText.toLowerCase());
onActivated: updateHorizontalTextAlignment(currentText.toLowerCase());
}
Controls.ComboBox {
id: vAlignmentBox
model: ["Top", "Center", "Bottom"]
implicitWidth: 100
hoverEnabled: true
onCurrentTextChanged: updateVerticalTextAlignment(currentText.toLowerCase());
onActivated: updateVerticalTextAlignment(currentText.toLowerCase());
}
Controls.ToolButton {
text: "B"
@ -290,6 +290,8 @@ Item {
songHAlignment = song.horizontalTextAlignment;
songVAlignment = song.verticalTextAlignment;
alignmentSetTimer.restart();
if (songBackgroundType == "image") {
slideEditor.videoBackground = "";
slideEditor.imageBackground = songBackground;
@ -338,17 +340,20 @@ Item {
function updateHorizontalTextAlignment(textAlignment) {
if (alignmentSetTimer.running)
return;
changeSlideHAlignment(textAlignment);
songsqlmodel.updateHorizontalTextAlignment(songIndex, textAlignment);
}
function updateVerticalTextAlignment(textAlignment) {
if (alignmentSetTimer.running)
return;
changeSlideVAlignment(textAlignment);
songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment)
}
function changeSlideHAlignment(alignment) {
print("AHHHHHHHHHHH")
switch (alignment) {
case "left" :
hAlignmentBox.currentIndex = 0;
@ -370,11 +375,10 @@ Item {
}
function changeSlideVAlignment(alignment) {
print("AHHHHHHHHHHH")
switch (alignment) {
case "top" :
vAlignmentBox.currentIndex = 0;
slideEditor.vTextAlignment = Text.AlignBottom;
slideEditor.vTextAlignment = Text.AlignTop;
break;
case "center" :
vAlignmentBox.currentIndex = 1;