From f72d91b444aa082f506431c17b8f71043577403e Mon Sep 17 00:00:00 2001 From: Ali Mashatan Date: Sat, 28 Mar 2015 00:21:24 +0430 Subject: [PATCH] Adding "play" button Changes in the appearance and behavior of StatesComboBox --- mix/qml/StatesComboBox.qml | 55 +++++++++++++++++++++++---------- mix/qml/TransactionLog.qml | 41 +++++++++++++++--------- mix/qml/img/pause_button.png | Bin 0 -> 200 bytes mix/qml/img/pause_button2x.png | Bin 0 -> 414 bytes mix/qml/img/play_button.png | Bin 0 -> 531 bytes mix/qml/img/play_button2x.png | Bin 0 -> 904 bytes mix/res.qrc | 6 +++- 7 files changed, 70 insertions(+), 32 deletions(-) create mode 100755 mix/qml/img/pause_button.png create mode 100755 mix/qml/img/pause_button2x.png create mode 100755 mix/qml/img/play_button.png create mode 100755 mix/qml/img/play_button2x.png diff --git a/mix/qml/StatesComboBox.qml b/mix/qml/StatesComboBox.qml index ada5e00d5..2c61863ec 100644 --- a/mix/qml/StatesComboBox.qml +++ b/mix/qml/StatesComboBox.qml @@ -23,6 +23,7 @@ import QtQuick 2.0 import QtQuick.Controls 1.0 import QtQuick.Layouts 1.1 +import QtGraphicalEffects 1.0 Rectangle { id:statesComboBox @@ -40,7 +41,13 @@ Rectangle { break; } var coordinates = dropDownList.mapToItem(top, 0, 0) + //the order is important + dropDownShowdowList.parent = top; dropDownList.parent = top; + + dropDownShowdowList.x = coordinates.x + dropDownShowdowList.y = coordinates.y + dropDownList.x = coordinates.x dropDownList.y = coordinates.y } @@ -48,7 +55,7 @@ Rectangle { signal selectItem(real item); signal editItem(real item); signal selectCreate(); - + property variant rowHeight:25; property variant items; readonly property alias selectedItem: chosenItemText.text; 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 { id:dropDownList width:statesComboBox.width; height:0; clip:true; radius:4; - anchors.top: chosenItem.bottom; + anchors.top: chosenItem.top; anchors.margins: 2; color: statesComboBox.color + + ColumnLayout{ spacing: 2 TableView { @@ -118,10 +139,13 @@ Rectangle { width: statesComboBox.width; delegate: mainItemDelegate } - + rowDelegate: Rectangle { + width:statesComboBox.width; + height: statesComboBox.rowHeight; + } Component { id: mainItemDelegate - Item{ + Rectangle { id: itemDelegate width:statesComboBox.width; height: statesComboBox.height; @@ -134,22 +158,16 @@ Rectangle { 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 { id: imageItemid height:20 width:20; + anchors.right:parent.right + anchors.top: parent.top; + anchors.margins: 5; visible: false; fillMode: Image.PreserveAspectFit source: "img/edit_combox.png" - anchors.top: spaceItemid.top; - anchors.left: spaceItemid.right; } MouseArea { @@ -180,6 +198,7 @@ Rectangle { }//Item }//Component }//Table View + RowLayout{ Rectangle{ width: 1 @@ -188,7 +207,7 @@ Rectangle { id:createStateText width:statesComboBox.width; height: statesComboBox.height; - font.pointSize: 10 + font.bold: true text:"Create State ..." MouseArea { @@ -208,12 +227,14 @@ Rectangle { } } } + } } states: State { name: "dropDown"; - PropertyChanges { target: dropDownList; height:(20*(statesComboBox.items.count+1)) } - PropertyChanges { target:listView; height:20; implicitHeight: (20*(statesComboBox.items.count)) } + PropertyChanges { target: dropDownList; height:(statesComboBox.rowHeight*(statesComboBox.items.count+1)) } + 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)) } } } diff --git a/mix/qml/TransactionLog.qml b/mix/qml/TransactionLog.qml index e0aec1a32..48b166eca 100644 --- a/mix/qml/TransactionLog.qml +++ b/mix/qml/TransactionLog.qml @@ -6,7 +6,6 @@ import QtQuick.Layouts 1.1 import org.ethereum.qml.RecordLogEntry 1.0 Item { - property ListModel fullModel: ListModel{} property ListModel transactionModel: ListModel{} property ListModel callModel: ListModel{} @@ -25,11 +24,29 @@ Item { enabled: codeModel.hasContract && !clientModel.running && statesCombo.selectedIndex >= 0 && projectModel.stateListModel.count > 0; 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 { anchors.fill: parent RowLayout { - + anchors.right: parent.right + anchors.left: parent.left Connections { 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 { anchors.rightMargin: 9 @@ -116,6 +121,14 @@ Item { logTable.model = itemFilter.getCurrentModel(); } } + Button + { + id: playPauseBtn + anchors.right: parent.right + anchors.rightMargin: 1 + anchors.verticalCenter: parent.verticalCenter + action: playAndPauseAction + } } TableView { id: logTable diff --git a/mix/qml/img/pause_button.png b/mix/qml/img/pause_button.png new file mode 100755 index 0000000000000000000000000000000000000000..e87889551dc9239887d84bd1511f2ce0f57904e1 GIT binary patch literal 200 zcmeAS@N?(olHy`uVBq!ia0vp^=0L2+!3HFIm>NZa6k~CayA#8@b22Z1oF-2f$B+!x zx0f8b8WcoW0$xv%yBIB|$9ypJd+YTex4-*Vn#waWv2X||I5aRYGDSCL&;B9#Vz2#b z-Q=G0v6*?LVY|wf9~3T@D^JQUPCJ{qZb8HSO$nM8J!W;!;A%4o-!LUZ<*cg@tMe@F o2rrXK&y>^@5vH+lOcAbNY*gb=vpC{%3FsOIPgg&ebxsLQ0RFK*6951J literal 0 HcmV?d00001 diff --git a/mix/qml/img/pause_button2x.png b/mix/qml/img/pause_button2x.png new file mode 100755 index 0000000000000000000000000000000000000000..6f45b3236ab4e8debdc79082f4fa04df0f852786 GIT binary patch literal 414 zcmeAS@N?(olHy`uVBq!ia0vp^c|aV)!3HGzUpB-7DaPU;cPEB*=VV?2*%6*Djv*C{ zZ!aF?ZFUe~aeSkp@3Lu&v4d0A+0}oJZ4Ri7tz+R3P;h8qU}Pea5y4$^js5;T>*s&& z{dvCc{qg)&-|y{-{`qFR%;v4a0(t3k^6K@cI~C=!=Q6_XB1e!{xYdR^Ld`nj=7~(o;#)#o2%V9XSG))=G0DU lVOkp}rA&&~Vc}%LRIk&@;p1(W6b}q=22WQ%mvv4FO#n*Mm`DHs literal 0 HcmV?d00001 diff --git a/mix/qml/img/play_button.png b/mix/qml/img/play_button.png new file mode 100755 index 0000000000000000000000000000000000000000..01a5c85cb2123f6b78e4a7914e18aab8b60f8fea GIT binary patch literal 531 zcmV+u0_^>XP)Px$%}GQ-RA>e5mc38HKp4j9M@$G4j;zkIx#&)qSQ=;-abVD06Wv_Ze?a^XEQF;C zq@#&0Ov22{%0!xwe)yF177}7>@2;4cR;I{g( zir3X@^}EyQT<{W{C67?JSO@@5R8{=|;1jm$Q5JD|V}-*d0>P)=W2;UL!>H#Ko%VZK za7<5K*YzoS@c|RUYb&fOuhFusC{3;?ioOunwQYNmCjKum!rj{^3cYxaH$H4`_Qm9# zFAOdbUO_LuVztMuR;!j5X7~G|;h3Igxm=#37cDlyV>}eNEep13s(wuiuBQzY95?Yi zuje?#n6z zCB;O+EwKfA!{KmJ1Qe^uz2~r6Ho#7c24jFUk^|%bIY17O1LOcXKn{=t{z>Ug}i6zkYRuPT8rapDbDIzSXX+Tz9^@P_t*Zzz@++eXqX$@|)LCV>?}> zP`Yly_cdXw|K@DJ-Cx5x>-sL2PVWT{_x1*@{KEU`p5phrC%LEOKNnQjW92Acdi_ML z`q{MN`{pYu*SN2;IGnaWXyqJ*?|Tn2zPz5aPBS?AjL9o|zE@?tU+XN7Uw_@+;GIF& zqHdkXOZx*qYr4Lx?np0s{3&MF6rI=M%6fZm$UfQE-*L%v@x>dbnH*k8+Oy!o>KDIz1}lQ$v^jqR`nuuAq^Y_Gm+I?1+F-g$BXZ}7P0u@o*fX=d!nUzY-zQS| z$}3E7(;Lfs&n;YLo&qXutQAsVqzFxLe4xMh>o;G?TQN_7S&PBb)z4*}Q$iB}AKit7 literal 0 HcmV?d00001 diff --git a/mix/res.qrc b/mix/res.qrc index 51f2b49c6..6397555db 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -12,7 +12,7 @@ qml/StatesComboBox.qml qml/StateListModel.qml qml/img/dappProjectIcon.png - qml/img/edit_combox.png + qml/img/edit_combox.png qml/img/jumpintoback.png qml/img/jumpintoforward.png qml/img/jumpoutback.png @@ -115,5 +115,9 @@ qml/StructView.qml qml/img/console.png qml/VariablesView.qml + qml/img/play_button2x.png + qml/img/play_button.png + qml/img/pause_button2x.png + qml/img/pause_button.png