Commit c5dad0f6 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.StatesEditor: Adding context menu to collapse the view

Change-Id: I5c118281ec8b9b3ef059e668ed4f534b70f952e1
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 6d1ae0e2
......@@ -49,9 +49,28 @@ Rectangle {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
focus = true
root.currentStateInternalId = internalNodeId
if (mouse.button === Qt.LeftButton) {
focus = true
root.currentStateInternalId = internalNodeId
} else if (mouse.button === Qt.RightButton) {
contextMenu.popup()
}
}
Menu {
id: contextMenu
MenuItem {
text: root.expanded ? qsTr("Collapse") : qsTr("Expand")
onTriggered: {
root.expanded = ! root.expanded
}
}
}
}
......
......@@ -34,7 +34,7 @@ import QtQuick.Controls.Styles 1.1
FocusScope {
id: root
height: 132
height: expanded ? 132 : 32
signal createNewState
signal deleteState(int internalNodeId)
signal duplicateCurrentState
......@@ -46,6 +46,8 @@ FocusScope {
property int innerSpacing: 2
property int currentStateInternalId : 0
property bool expanded: true
Connections {
target: statesEditorModel
onChangedToState: root.currentStateInternalId = n
......
......@@ -135,6 +135,13 @@ void StatesEditorWidget::reloadQmlSource()
connect(m_quickView->rootObject(), SIGNAL(createNewState()), m_statesEditorView.data(), SLOT(createNewState()));
connect(m_quickView->rootObject(), SIGNAL(deleteState(int)), m_statesEditorView.data(), SLOT(removeState(int)));
m_statesEditorView.data()->synchonizeCurrentStateFromWidget();
setMaximumHeight(m_quickView->initialSize().height());
setFixedHeight(m_quickView->initialSize().height());
connect(m_quickView->rootObject(), SIGNAL(expandedChanged()), this, SLOT(changeHeight()));
}
void StatesEditorWidget::changeHeight()
{
setFixedHeight(m_quickView->rootObject()->height());
}
}
......@@ -66,6 +66,8 @@ public:
private slots:
void reloadQmlSource();
void changeHeight();
private:
QPointer<QQuickView> m_quickView;
QPointer<StatesEditorView> m_statesEditorView;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment