From b8c01de80b234aa4ca0736d207bea251125748e4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 28 Jul 2015 16:54:14 +0200 Subject: [PATCH] autoselect transaction --- mix/qml/Block.qml | 28 +++++++++++++++++++++------- mix/qml/BlockChain.qml | 7 +++++++ mix/qml/ScenarioExecution.qml | 3 ++- mix/qml/StateList.qml | 4 ---- 4 files changed, 30 insertions(+), 12 deletions(-) diff --git a/mix/qml/Block.qml b/mix/qml/Block.qml index 532e348d7..de606a6c0 100644 --- a/mix/qml/Block.qml +++ b/mix/qml/Block.qml @@ -46,6 +46,11 @@ ColumnLayout transactionDialog.open(txIndex, blockIndex, transactions.get(txIndex)) } + function select(txIndex) + { + transactionRepeater.itemAt(txIndex).select() + } + onOpenedTrChanged: { Layout.preferredHeight = calculateHeight() @@ -129,6 +134,12 @@ ColumnLayout id: rowTransaction Layout.preferredHeight: trHeight spacing: 0 + + function select() + { + rowContentTr.select() + } + function displayContent() { logsText.text = "" @@ -222,6 +233,15 @@ ColumnLayout } } + function select() + { + rowContentTr.selected = true + rowContentTr.color = "#4F4F4F" + hash.color = "#EAB920" + func.color = "#EAB920" + txSelected(index) + } + function deselect() { rowContentTr.selected = false @@ -235,13 +255,7 @@ ColumnLayout anchors.fill: parent onClicked: { if (!rowContentTr.selected) - { - rowContentTr.selected = true - rowContentTr.color = "#4F4F4F" - hash.color = "#EAB920" - func.color = "#EAB920" - txSelected(index) - } + rowContentTr.select() else rowContentTr.deselect() diff --git a/mix/qml/BlockChain.qml b/mix/qml/BlockChain.qml index 25793a35f..2c247d282 100644 --- a/mix/qml/BlockChain.qml +++ b/mix/qml/BlockChain.qml @@ -184,6 +184,11 @@ ColumnLayout { itemAt(blockIndex).editTx(txIndex) } + function select(blockIndex, txIndex) + { + itemAt(blockIndex).select(txIndex) + } + Block { Connections @@ -569,6 +574,7 @@ ColumnLayout { trModel.sender = _r.sender trModel.returnParameters = _r.returnParameters blockModel.setTransaction(blockIndex, trIndex, trModel) + blockChainRepeater.select(blockIndex, trIndex) return; } } @@ -590,6 +596,7 @@ ColumnLayout { itemTr.returnParameters = _r.returnParameters model.blocks[model.blocks.length - 1].transactions.push(itemTr) blockModel.appendTransaction(itemTr) + blockChainRepeater.select(blockIndex, trIndex) } onNewState: { diff --git a/mix/qml/ScenarioExecution.qml b/mix/qml/ScenarioExecution.qml index 9b4bcd39f..dde32fa97 100644 --- a/mix/qml/ScenarioExecution.qml +++ b/mix/qml/ScenarioExecution.qml @@ -85,7 +85,8 @@ Rectangle { target: blockChain property var currentSelectedBlock property var currentSelectedTx - onTxSelected: { + onTxSelected: + { currentSelectedBlock = blockIndex currentSelectedTx = txIndex updateWatchers(blockIndex, txIndex) diff --git a/mix/qml/StateList.qml b/mix/qml/StateList.qml index 3558350b7..e081947e2 100644 --- a/mix/qml/StateList.qml +++ b/mix/qml/StateList.qml @@ -37,10 +37,6 @@ Dialog { anchors.bottom: parent.bottom anchors.right: parent.right anchors.rightMargin: 10 - Button { - action: addStateAction - } - Button { action: closeAction }