Browse Source

Adding "create state"

minor correction
cl-refactor
Ali Mashatan 10 years ago
parent
commit
b9a7f0815f
  1. 45
      mix/qml/StatesComboBox.qml
  2. 7
      mix/qml/TransactionLog.qml

45
mix/qml/StatesComboBox.qml

@ -47,6 +47,7 @@ Rectangle {
signal selectItem(real item);
signal editItem(real item);
signal selectCreate();
property variant items;
readonly property alias selectedItem: chosenItemText.text;
@ -86,7 +87,7 @@ Rectangle {
}
}
}
//ToDo: We need scrollbar for items
Rectangle {
id:dropDownList
width:statesComboBox.width;
@ -96,12 +97,15 @@ Rectangle {
anchors.top: chosenItem.bottom;
anchors.margins: 2;
color: statesComboBox.color
ColumnLayout{
spacing: 2
TableView {
id:listView
height:500;
height:20;
implicitHeight: 0
width:statesComboBox.width;
model: statesComboBox.items
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff;
currentRow: -1
headerVisible: false;
backgroundVisible: false
@ -113,7 +117,6 @@ Rectangle {
title: ""
width: statesComboBox.width;
delegate: mainItemDelegate
//elideMode: Text.ElideNone
}
Component {
@ -169,8 +172,6 @@ Rectangle {
statesComboBox.state = ""
var prevSelection = chosenItemText.text
chosenItemText.text = styleData.value
if(chosenItemText.text != prevSelection)
statesComboBox.comboClicked();
listView.currentRow = styleData.row;
statesComboBox.selectItem(styleData.row);
}
@ -178,11 +179,41 @@ Rectangle {
}
}//Item
}//Component
}//Table View
RowLayout{
Rectangle{
width: 1
}
Text{
id:createStateText
width:statesComboBox.width;
height: statesComboBox.height;
font.pointSize: 10
text:"Create State ..."
MouseArea
{
anchors.fill: parent;
hoverEnabled : true
onEntered: {
createStateText.color = statesComboBox.colorSelect;
}
onExited: {
createStateText.color = statesComboBox.colorItem;
}
onClicked: {
statesComboBox.state = ""
statesComboBox.selectCreate();
}
}
}
}
}
}
states: State {
name: "dropDown";
PropertyChanges { target: dropDownList; height:20*statesComboBox.items.count }
PropertyChanges { target: dropDownList; height:(20*(statesComboBox.items.count+1)) }
PropertyChanges { target:listView; height:20; implicitHeight: (20*(statesComboBox.items.count)) }
}
}

7
mix/qml/TransactionLog.qml

@ -64,7 +64,8 @@ Item {
{
id: statesCombo
items:projectModel.stateListModel
onSelectItem: console.log("Combobox Select Item: " + item )
//onSelectItem: console.log("Combobox Select Item: " + item )
onSelectCreate: projectModel.stateListModel.addState();
onEditItem: projectModel.stateListModel.editState(item)
colorItem: "black"
colorSelect: "blue"
@ -77,7 +78,7 @@ Item {
}
}
}
Button
/*Button
{
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
@ -88,7 +89,7 @@ Item {
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
action: addStateAction
}
}*/
Button
{
anchors.rightMargin: 9

Loading…
Cancel
Save