Implemented the view for "Time signatures" inspector

This commit is contained in:
pereverzev_v 2020-05-27 17:09:04 +02:00
parent 2a2106c7c0
commit 89b4e459d2
4 changed files with 137 additions and 0 deletions

View file

@ -161,5 +161,7 @@
<file>view/qml/notation/brackets/BracePopup.qml</file>
<file>view/qml/notation/brackets/BraceSettings.qml</file>
<file>view/qml/notation/brackets/internal/BracketPopupSection.qml</file>
<file>view/qml/notation/timesignatures/TimeSignatureSettings.qml</file>
<file>view/qml/notation/timesignatures/TimeSignaturePopup.qml</file>
</qresource>
</RCC>

View file

@ -27,6 +27,7 @@ import "ambituses"
import "images"
import "chordsymbols"
import "brackets"
import "timesignatures"
InspectorSectionView {
id: root
@ -233,5 +234,12 @@ InspectorSectionView {
model: root.model ? root.model.modelByType(Inspector.TYPE_BRACE) : null
onPopupContentHeightChanged: updateContentHeight(popupContentHeight)
}
TimeSignatureSettings {
popupPositionX: mapToGlobal(grid.x, grid.y).x - mapToGlobal(x, y).x
popupAvailableWidth: root.width
model: root.model ? root.model.modelByType(Inspector.TYPE_TIME_SIGNATURE) : null
onPopupContentHeightChanged: updateContentHeight(popupContentHeight)
}
}
}

View file

@ -0,0 +1,103 @@
import QtQuick 2.9
import QtQuick.Controls 2.2
import MuseScore.Inspectors 3.3
import "../../common"
StyledPopup {
id: root
property QtObject model: null
implicitHeight: contentColumn.implicitHeight + topPadding + bottomPadding
width: parent.width
Column {
id: contentColumn
width: parent.width
spacing: 12
Column {
spacing: 8
height: childrenRect.height
width: parent.width
StyledTextLabel {
anchors.left: parent.left
text: qsTr("Scale")
}
Item {
height: childrenRect.height
width: parent.width
IncrementalPropertyControl {
id: horizontalScaleControl
anchors.left: parent.left
anchors.right: parent.horizontalCenter
anchors.rightMargin: 2
icon: IconNameTypes.HORIZONTAL
isIndeterminate: root.model ? root.model.horizontalScale.isUndefined : false
currentValue: root.model ? root.model.horizontalScale.value : 0
step: 1
decimals: 0
maxValue: 300
minValue: 1
validator: IntInputValidator {
top: horizontalScaleControl.maxValue
bottom: horizontalScaleControl.minValue
}
onValueEdited: { root.model.horizontalScale.value = newValue }
}
IncrementalPropertyControl {
id: verticalScaleControl
anchors.left: parent.horizontalCenter
anchors.leftMargin: 2
anchors.right: parent.right
icon: IconNameTypes.VERTICAL
isIndeterminate: root.model ? root.model.verticalScale.isUndefined : false
currentValue: root.model ? root.model.verticalScale.value : 0
step: 1
decimals: 0
maxValue: 300
minValue: 1
validator: IntInputValidator {
top: verticalScaleControl.maxValue
bottom: verticalScaleControl.minValue
}
onValueEdited: { root.model.verticalScale.value = newValue }
}
}
}
CheckBox {
isIndeterminate: model ? model.shouldShowCourtesy.isUndefined : false
checked: model && !isIndeterminate ? model.shouldShowCourtesy.value : false
text: qsTr("Show courtesy time signature on previous system")
onClicked: { model.shouldShowCourtesy.value = !checked }
}
FlatButton {
text: qsTr("Change time signature")
onClicked: {
if (root.model) {
root.model.showTimeSignatureProperties()
}
}
}
}
}

View file

@ -0,0 +1,24 @@
import QtQuick 2.9
import QtQuick.Layouts 1.3
import MuseScore.Inspectors 3.3
import "../../common"
PopupViewButton {
id: root
property alias model: timeSignaturePopup.model
icon: IconNameTypes.TIME_SIGNATURE
text: qsTr("Time signatures")
visible: root.model ? !root.model.isEmpty : false
TimeSignaturePopup {
id: timeSignaturePopup
x: popupPositionX
y: popupPositionY
arrowX: parent.x + parent.width / 2
width: popupAvailableWidth
}
}