diff --git a/CellFrameDashboardGUI/DapUiQmlWidgetStatusBar.qml b/CellFrameDashboardGUI/DapUiQmlWidgetStatusBar.qml index f5cdf2098bc0caffce0c8d9490d63c09411c2e9c..07448f9a15085d1969143a4e897b3712ccb99353 100644 --- a/CellFrameDashboardGUI/DapUiQmlWidgetStatusBar.qml +++ b/CellFrameDashboardGUI/DapUiQmlWidgetStatusBar.qml @@ -1,5 +1,6 @@ import QtQuick 2.0 -import QtQuick.Controls 2.12 +import QtQuick.Controls 2.5 +import QtQuick.Controls.Styles 1.4 Rectangle { @@ -8,7 +9,7 @@ Rectangle { anchors.bottomMargin: 1 color: "#F2F2F4" - ComboBox { + DapUiQmlWidgetStatusBarComboBox { id: comboboxWallet anchors.left: parent.left anchors.top: parent.top @@ -19,24 +20,57 @@ Rectangle { model: dapChainWalletsModel textRole: "name" - indicator: Image { - source: comboboxWallet.popup.visible ? "qrc:/Resources/Icons/ic_arrow_drop_up.png" : "qrc:/Resources/Icons/ic_arrow_drop_down.png" - width: 24 * pt - height: 24 * pt - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: 10 * pt + + delegate: ItemDelegate { + width: parent.width + contentItem: DapUiQmlWidgetStatusBarContentItem { + text: name + } + + highlighted: parent.highlightedIndex === index } onCurrentIndexChanged: { - fieldWalletBalance.text = dapChainWalletsModel.get(currentIndex).tokens[0]; + tokenList.clear(); + for(var i = 0; i < dapChainWalletsModel.get(currentIndex).count; i++) + tokenList.append({"tokenName": dapChainWalletsModel.get(currentIndex).tokens[++i]}); + if(tokenList.count) + comboboxToken.currentIndex = 0; + } + } + + DapUiQmlWidgetStatusBarComboBox { + id: comboboxToken + anchors.top: parent.top + anchors.left: comboboxWallet.right + anchors.bottom: parent.bottom + anchors.leftMargin: 30 * pt + anchors.topMargin: 10 * pt + anchors.bottomMargin: 10 * pt + model: ListModel {id: tokenList} + textRole: "tokenName" + + delegate: ItemDelegate { + width: parent.width + contentItem: DapUiQmlWidgetStatusBarContentItem { + text: tokenName + } + + highlighted: parent.highlightedIndex === index + } + + onCurrentIndexChanged: { + if(currentIndex === -1) + fieldWalletBalance.text = 0; + else + fieldWalletBalance.text = dapChainWalletsModel.get(comboboxWallet.currentIndex).tokens[currentIndex * 2]; } } Label { id: titleWalletBalance anchors.top: parent.top - anchors.left: comboboxWallet.right + anchors.left: comboboxToken.right anchors.bottom: parent.bottom anchors.leftMargin: 40 * pt anchors.topMargin: 10 * pt diff --git a/CellFrameDashboardGUI/DapUiQmlWidgetStatusBarComboBox.qml b/CellFrameDashboardGUI/DapUiQmlWidgetStatusBarComboBox.qml new file mode 100644 index 0000000000000000000000000000000000000000..a35556d7ddbcbf7fbdfdf6aa073f61299843b18f --- /dev/null +++ b/CellFrameDashboardGUI/DapUiQmlWidgetStatusBarComboBox.qml @@ -0,0 +1,47 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.5 +import QtQuick.Controls.Styles 1.4 + +ComboBox { + width: 100 * pt + +// id: comboboxWallet +// anchors.left: parent.left +// anchors.top: parent.top +// anchors.bottom: parent.bottom +// anchors.leftMargin: 30 * pt +// anchors.topMargin: 10 * pt +// anchors.bottomMargin: 10 * pt +// width: 100 * pt +// model: dapChainWalletsModel +// textRole: "name" + + +// delegate: ItemDelegate { +// width: parent.width +// highlighted: parent.highlightedIndex === index +// } + + indicator: Image { + source: parent.popup.visible ? "qrc:/Resources/Icons/ic_arrow_drop_up.png" : "qrc:/Resources/Icons/ic_arrow_drop_down.png" + width: 24 * pt + height: 24 * pt + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 10 * pt + } + + background: Rectangle { + anchors.fill: parent + color: parent.popup.visible ? "#FFFFFF" : "transparent" + } + + contentItem: Text { + text: parent.displayText + font.family: "Regular" + font.pixelSize: 14 * pt + color: "#A7A7A7" + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } +} diff --git a/CellFrameDashboardGUI/DapUiQmlWidgetStatusBarContentItem.qml b/CellFrameDashboardGUI/DapUiQmlWidgetStatusBarContentItem.qml new file mode 100644 index 0000000000000000000000000000000000000000..0babc0b174eba8c7a360c4e4f59ced1a0b02002f --- /dev/null +++ b/CellFrameDashboardGUI/DapUiQmlWidgetStatusBarContentItem.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 +import QtQuick.Controls 2.5 +import QtQuick.Controls.Styles 1.4 + +Text { + color: "#A7A7A7" + font.family: "Regular" + font.pixelSize: 14 * pt + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter +} diff --git a/CellFrameDashboardGUI/qml.qrc b/CellFrameDashboardGUI/qml.qrc index 5bb5d9f83af2b52967f235971fee2a73d86c585d..7b2d6ac75d90a05f95b988833f48e0f61b27fdc1 100755 --- a/CellFrameDashboardGUI/qml.qrc +++ b/CellFrameDashboardGUI/qml.qrc @@ -63,5 +63,7 @@ <file>Resources/Icons/ic_arrow_drop_down.png</file> <file>Resources/Icons/ic_arrow_drop_up.png</file> <file>DapUiQmlWidgetStatusBar.qml</file> + <file>DapUiQmlWidgetStatusBarComboBox.qml</file> + <file>DapUiQmlWidgetStatusBarContentItem.qml</file> </qresource> </RCC>