making songeditor align text
This commit is contained in:
parent
86a5bbf93c
commit
e22ac445c5
6 changed files with 145 additions and 38 deletions
|
@ -160,7 +160,7 @@ Item {
|
|||
} else if (textIndex <= root.text.length) {
|
||||
previewSlide.text = root.text[textIndex];
|
||||
print(root.text[textIndex]);
|
||||
--textIndex
|
||||
--textIndex;
|
||||
}
|
||||
} else if (itemType === "video") {
|
||||
clearText();
|
||||
|
|
|
@ -22,8 +22,8 @@ Item {
|
|||
property string chosenFont: "Quicksand"
|
||||
property var text: "This is demo text"
|
||||
property color backgroundColor
|
||||
property var horizontalAlignment
|
||||
property var verticalAlignment
|
||||
property var horizontalAlignment: Text.AlignHCenter
|
||||
property var verticalAlignment: 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: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: horizontalAlignment
|
||||
verticalAlignment: verticalAlignment
|
||||
style: Text.Raised
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
|
|
|
@ -13,7 +13,8 @@ Item {
|
|||
|
||||
property string imageBackground
|
||||
property string videoBackground
|
||||
property string textAlignment
|
||||
property var hTextAlignment
|
||||
property var vTextAlignment
|
||||
|
||||
Presenter.Slide {
|
||||
id: representation
|
||||
|
@ -22,14 +23,17 @@ Item {
|
|||
editMode: true
|
||||
imageSource: imageBackground
|
||||
videoSource: videoBackground
|
||||
horizontalAlignment: hTextAlignment
|
||||
verticalAlignment: vTextAlignment
|
||||
preview: true
|
||||
}
|
||||
|
||||
Component.onCompleted: updateHAlignment(textAlignment)
|
||||
Component.onCompleted: {
|
||||
}
|
||||
|
||||
function loadVideo() {
|
||||
representation.loadVideo();
|
||||
representation.pause();
|
||||
representation.pauseVideo();
|
||||
}
|
||||
|
||||
function updateHAlignment(alignment) {
|
||||
|
@ -48,4 +52,18 @@ Item {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function updateVAlignment(alignment) {
|
||||
switch (alignment) {
|
||||
case "top" :
|
||||
representation.verticalAlignment = Text.AlignBottom;
|
||||
break;
|
||||
case "center" :
|
||||
representation.verticalAlignment = Text.AlignVCenter;
|
||||
break;
|
||||
case "bottom" :
|
||||
representation.verticalAlignment = Text.AlignBottom;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ Item {
|
|||
property string songBackground
|
||||
property string songBackgroundType
|
||||
property string songHAlignment
|
||||
property string songVAlignment
|
||||
|
||||
GridLayout {
|
||||
id: mainLayout
|
||||
|
@ -48,16 +49,18 @@ Item {
|
|||
hoverEnabled: true
|
||||
}
|
||||
Controls.ComboBox {
|
||||
id: hAlignmentBox
|
||||
model: ["Left", "Center", "Right", "Justify"]
|
||||
implicitWidth: 100
|
||||
hoverEnabled: true
|
||||
onCurrentTextChanged: updateTextAlignment(currentText.toLowerCase());
|
||||
onCurrentTextChanged: updateHorizontalTextAlignment(currentText.toLowerCase());
|
||||
}
|
||||
Controls.ComboBox {
|
||||
id: vAlignmentBox
|
||||
model: ["Top", "Center", "Bottom"]
|
||||
implicitWidth: 100
|
||||
hoverEnabled: true
|
||||
onCurrentTextChanged: print(currentText.toLowerCase());
|
||||
onCurrentTextChanged: updateVerticalTextAlignment(currentText.toLowerCase());
|
||||
}
|
||||
Controls.ToolButton {
|
||||
text: "B"
|
||||
|
@ -226,7 +229,6 @@ Item {
|
|||
Layout.bottomMargin: 30
|
||||
Layout.rightMargin: 20
|
||||
Layout.leftMargin: 20
|
||||
textAlignment: songHAlignment
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +287,9 @@ Item {
|
|||
songVorder = song.vorder;
|
||||
songBackground = song.background;
|
||||
songBackgroundType = song.backgroundType;
|
||||
songHAlignment = song.textAlignment;
|
||||
songHAlignment = song.horizontalTextAlignment;
|
||||
songVAlignment = song.verticalTextAlignment;
|
||||
|
||||
if (songBackgroundType == "image") {
|
||||
slideEditor.videoBackground = "";
|
||||
slideEditor.imageBackground = songBackground;
|
||||
|
@ -294,6 +298,10 @@ Item {
|
|||
slideEditor.videoBackground = songBackground;
|
||||
slideEditor.loadVideo();
|
||||
}
|
||||
|
||||
changeSlideHAlignment(songHAlignment);
|
||||
changeSlideVAlignment(songVAlignment);
|
||||
|
||||
print(song);
|
||||
}
|
||||
|
||||
|
@ -328,7 +336,54 @@ Item {
|
|||
print("changed background");
|
||||
}
|
||||
|
||||
function updateTextAlignment(textAlignment) {
|
||||
songsqlmodel.updateTextAlignment(songIndex, textAlignment)
|
||||
|
||||
function updateHorizontalTextAlignment(textAlignment) {
|
||||
changeSlideHAlignment(textAlignment);
|
||||
songsqlmodel.updateHorizontalTextAlignment(songIndex, textAlignment);
|
||||
}
|
||||
|
||||
function updateVerticalTextAlignment(textAlignment) {
|
||||
changeSlideVAlignment(textAlignment);
|
||||
songsqlmodel.updateVerticalTextAlignment(songIndex, textAlignment)
|
||||
}
|
||||
|
||||
function changeSlideHAlignment(alignment) {
|
||||
print("AHHHHHHHHHHH")
|
||||
switch (alignment) {
|
||||
case "left" :
|
||||
hAlignmentBox.currentIndex = 0;
|
||||
slideEditor.hTextAlignment = Text.AlignLeft;
|
||||
break;
|
||||
case "center" :
|
||||
hAlignmentBox.currentIndex = 1;
|
||||
slideEditor.hTextAlignment = Text.AlignHCenter;
|
||||
break;
|
||||
case "right" :
|
||||
hAlignmentBox.currentIndex = 2;
|
||||
slideEditor.hTextAlignment = Text.AlignRight;
|
||||
break;
|
||||
case "justify" :
|
||||
hAlignmentBox.currentIndex = 3;
|
||||
slideEditor.hTextAlignment = Text.AlignJustify;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function changeSlideVAlignment(alignment) {
|
||||
print("AHHHHHHHHHHH")
|
||||
switch (alignment) {
|
||||
case "top" :
|
||||
vAlignmentBox.currentIndex = 0;
|
||||
slideEditor.vTextAlignment = Text.AlignBottom;
|
||||
break;
|
||||
case "center" :
|
||||
vAlignmentBox.currentIndex = 1;
|
||||
slideEditor.vTextAlignment = Text.AlignVCenter;
|
||||
break;
|
||||
case "bottom" :
|
||||
vAlignmentBox.currentIndex = 2;
|
||||
slideEditor.vTextAlignment = Text.AlignBottom;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue