Browse Source

Adding "play" button

Changes in the appearance and behavior of StatesComboBox
cl-refactor
Ali Mashatan 10 years ago
parent
commit
f72d91b444
  1. 55
      mix/qml/StatesComboBox.qml
  2. 41
      mix/qml/TransactionLog.qml
  3. BIN
      mix/qml/img/pause_button.png
  4. BIN
      mix/qml/img/pause_button2x.png
  5. BIN
      mix/qml/img/play_button.png
  6. BIN
      mix/qml/img/play_button2x.png
  7. 6
      mix/res.qrc

55
mix/qml/StatesComboBox.qml

@ -23,6 +23,7 @@
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtGraphicalEffects 1.0
Rectangle { Rectangle {
id:statesComboBox id:statesComboBox
@ -40,7 +41,13 @@ Rectangle {
break; break;
} }
var coordinates = dropDownList.mapToItem(top, 0, 0) var coordinates = dropDownList.mapToItem(top, 0, 0)
//the order is important
dropDownShowdowList.parent = top;
dropDownList.parent = top; dropDownList.parent = top;
dropDownShowdowList.x = coordinates.x
dropDownShowdowList.y = coordinates.y
dropDownList.x = coordinates.x dropDownList.x = coordinates.x
dropDownList.y = coordinates.y dropDownList.y = coordinates.y
} }
@ -48,7 +55,7 @@ Rectangle {
signal selectItem(real item); signal selectItem(real item);
signal editItem(real item); signal editItem(real item);
signal selectCreate(); signal selectCreate();
property variant rowHeight:25;
property variant items; property variant items;
readonly property alias selectedItem: chosenItemText.text; readonly property alias selectedItem: chosenItemText.text;
readonly property alias selectedIndex: listView.currentRow; readonly property alias selectedIndex: listView.currentRow;
@ -87,16 +94,30 @@ Rectangle {
} }
} }
} }
//ToDo: We need scrollbar for items
Rectangle {
id:dropDownShowdowList
width:statesComboBox.width;
opacity: 0.3
height:0;
clip:true;
radius:4;
anchors.top: chosenItem.top;
anchors.margins: 2;
color: "gray"
}
//ToDo: We need scrollbar for items
Rectangle { Rectangle {
id:dropDownList id:dropDownList
width:statesComboBox.width; width:statesComboBox.width;
height:0; height:0;
clip:true; clip:true;
radius:4; radius:4;
anchors.top: chosenItem.bottom; anchors.top: chosenItem.top;
anchors.margins: 2; anchors.margins: 2;
color: statesComboBox.color color: statesComboBox.color
ColumnLayout{ ColumnLayout{
spacing: 2 spacing: 2
TableView { TableView {
@ -118,10 +139,13 @@ Rectangle {
width: statesComboBox.width; width: statesComboBox.width;
delegate: mainItemDelegate delegate: mainItemDelegate
} }
rowDelegate: Rectangle {
width:statesComboBox.width;
height: statesComboBox.rowHeight;
}
Component { Component {
id: mainItemDelegate id: mainItemDelegate
Item{ Rectangle {
id: itemDelegate id: itemDelegate
width:statesComboBox.width; width:statesComboBox.width;
height: statesComboBox.height; height: statesComboBox.height;
@ -134,22 +158,16 @@ Rectangle {
anchors.margins: 5; anchors.margins: 5;
} }
Rectangle
{
id: spaceItemid
anchors.top: textItemid.top;
anchors.left: textItemid.right
width: parent.width - textItemid.width - imageItemid.width - textItemid.anchors.margins- textItemid.anchors.margins
}
Image { Image {
id: imageItemid id: imageItemid
height:20 height:20
width:20; width:20;
anchors.right:parent.right
anchors.top: parent.top;
anchors.margins: 5;
visible: false; visible: false;
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "img/edit_combox.png" source: "img/edit_combox.png"
anchors.top: spaceItemid.top;
anchors.left: spaceItemid.right;
} }
MouseArea { MouseArea {
@ -180,6 +198,7 @@ Rectangle {
}//Item }//Item
}//Component }//Component
}//Table View }//Table View
RowLayout{ RowLayout{
Rectangle{ Rectangle{
width: 1 width: 1
@ -188,7 +207,7 @@ Rectangle {
id:createStateText id:createStateText
width:statesComboBox.width; width:statesComboBox.width;
height: statesComboBox.height; height: statesComboBox.height;
font.pointSize: 10 font.bold: true
text:"Create State ..." text:"Create State ..."
MouseArea MouseArea
{ {
@ -208,12 +227,14 @@ Rectangle {
} }
} }
} }
} }
} }
states: State { states: State {
name: "dropDown"; name: "dropDown";
PropertyChanges { target: dropDownList; height:(20*(statesComboBox.items.count+1)) } PropertyChanges { target: dropDownList; height:(statesComboBox.rowHeight*(statesComboBox.items.count+1)) }
PropertyChanges { target:listView; height:20; implicitHeight: (20*(statesComboBox.items.count)) } PropertyChanges { target: dropDownShowdowList; width:statesComboBox.width+3; height:(statesComboBox.rowHeight*(statesComboBox.items.count+1))+3 }
PropertyChanges { target:listView; height:20; implicitHeight: (statesComboBox.rowHeight*(statesComboBox.items.count)) }
} }
} }

41
mix/qml/TransactionLog.qml

@ -6,7 +6,6 @@ import QtQuick.Layouts 1.1
import org.ethereum.qml.RecordLogEntry 1.0 import org.ethereum.qml.RecordLogEntry 1.0
Item { Item {
property ListModel fullModel: ListModel{} property ListModel fullModel: ListModel{}
property ListModel transactionModel: ListModel{} property ListModel transactionModel: ListModel{}
property ListModel callModel: ListModel{} property ListModel callModel: ListModel{}
@ -25,11 +24,29 @@ Item {
enabled: codeModel.hasContract && !clientModel.running && statesCombo.selectedIndex >= 0 && projectModel.stateListModel.count > 0; enabled: codeModel.hasContract && !clientModel.running && statesCombo.selectedIndex >= 0 && projectModel.stateListModel.count > 0;
onTriggered: projectModel.stateListModel.editState(statesCombo.selectedIndex); onTriggered: projectModel.stateListModel.editState(statesCombo.selectedIndex);
} }
Action {
id: playAndPauseAction
checkable: true;
checked: false;
iconSource: "qrc:/qml/img/play_button.png"
onToggled: {
if (checked)
{
this.iconSource = "qrc:/qml/img/pause_button2x.png"
console.log("play");
}else{
this.iconSource = "qrc:/qml/img/play_button2x.png"
console.log("pause");
}
}
enabled: true
}
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
RowLayout { RowLayout {
anchors.right: parent.right
anchors.left: parent.left
Connections Connections
{ {
id: compilationStatus id: compilationStatus
@ -78,18 +95,6 @@ Item {
} }
} }
} }
/*Button
{
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
action: editStateAction
}
Button
{
anchors.rightMargin: 9
anchors.verticalCenter: parent.verticalCenter
action: addStateAction
}*/
Button Button
{ {
anchors.rightMargin: 9 anchors.rightMargin: 9
@ -116,6 +121,14 @@ Item {
logTable.model = itemFilter.getCurrentModel(); logTable.model = itemFilter.getCurrentModel();
} }
} }
Button
{
id: playPauseBtn
anchors.right: parent.right
anchors.rightMargin: 1
anchors.verticalCenter: parent.verticalCenter
action: playAndPauseAction
}
} }
TableView { TableView {
id: logTable id: logTable

BIN
mix/qml/img/pause_button.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

BIN
mix/qml/img/pause_button2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

BIN
mix/qml/img/play_button.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

BIN
mix/qml/img/play_button2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

6
mix/res.qrc

@ -12,7 +12,7 @@
<file>qml/StatesComboBox.qml</file> <file>qml/StatesComboBox.qml</file>
<file>qml/StateListModel.qml</file> <file>qml/StateListModel.qml</file>
<file>qml/img/dappProjectIcon.png</file> <file>qml/img/dappProjectIcon.png</file>
<file>qml/img/edit_combox.png</file> <file>qml/img/edit_combox.png</file>
<file>qml/img/jumpintoback.png</file> <file>qml/img/jumpintoback.png</file>
<file>qml/img/jumpintoforward.png</file> <file>qml/img/jumpintoforward.png</file>
<file>qml/img/jumpoutback.png</file> <file>qml/img/jumpoutback.png</file>
@ -115,5 +115,9 @@
<file>qml/StructView.qml</file> <file>qml/StructView.qml</file>
<file>qml/img/console.png</file> <file>qml/img/console.png</file>
<file>qml/VariablesView.qml</file> <file>qml/VariablesView.qml</file>
<file>qml/img/play_button2x.png</file>
<file>qml/img/play_button.png</file>
<file>qml/img/pause_button2x.png</file>
<file>qml/img/pause_button.png</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save