Skip to content

Commit

Permalink
Fix remember features with autogenerated forms
Browse files Browse the repository at this point in the history
Fix #72
  • Loading branch information
m-kuhn committed Sep 14, 2016
1 parent 05fc8a4 commit ae75740
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/qml/FeatureForm.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Rectangle {
property AttributeFormModel model
property alias toolbarVisible: toolbar.visible

property var __currentTab

id: form

states: [
Expand Down Expand Up @@ -60,6 +58,8 @@ Rectangle {
Rectangle {
id: tabBar

property var __currentTab

anchors { left: parent.left; right:parent.right; top: parent.top }
height: model.hasTabs ? childrenRect.height : 0
clip: true
Expand Down Expand Up @@ -110,7 +110,7 @@ Rectangle {
}

Rectangle {
color: __currentTab === parent ? "orange" : "gray"
color: tabBar.__currentTab === parent ? "orange" : "gray"

height: 2 * dp
anchors.right: parent.right
Expand Down Expand Up @@ -153,11 +153,11 @@ Rectangle {

Connections {
target: form.model
onFeatureChanged: container.activate( __currentTab )
onFeatureChanged: container.activate( tabBar.__currentTab )
}

/**
* The tab bar
* The main form content area
*/
Flickable {
anchors { top: tabBar.bottom; bottom: parent.bottom; left: parent.left; right: parent.right }
Expand Down Expand Up @@ -187,16 +187,22 @@ Rectangle {
}

function activate( tab ) {
if ( !form.model.hasTabs )
return;
__currentTab = tab

if ( !container.visible )
content.sourceComponent = undefined

content.pRootIndex = rootElement.modelIndex(tab.idx)
content.pType = 'tab'
content.pName = ''
if ( !form.model.hasTabs )
{
tabBar.__currentTab = undefined
content.pRootIndex = undefined
}
else
{
tabBar.__currentTab = tab

content.pRootIndex = rootElement.modelIndex(tab.idx)
content.pType = 'tab'
content.pName = ''
}
}

function checkTabs()
Expand Down

0 comments on commit ae75740

Please sign in to comment.