Index: sources/gui/qml/components/HeaderBar.qml =================================================================== diff -u -ra2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf -r51c91d35b3d0d1acac4dfccf6057d3949f302448 --- sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision a2f4636c3ecf98ec1e38f812f4602e0d67d4b7bf) +++ sources/gui/qml/components/HeaderBar.qml (.../HeaderBar.qml) (revision 51c91d35b3d0d1acac4dfccf6057d3949f302448) @@ -1,7 +1,6 @@ import QtQuick 2.12 import "qrc:/components" -import "qrc:/dialogs/headerbar" import "qrc:/globals" Rectangle { id: _root @@ -18,8 +17,18 @@ GradientStop { position: 0.8; color: Qt.darker (Colors.backgroundMain, 1.2) } } - function positionDialog ( button, dialog ) { return button.mapToItem(null, button.width, 0).x - dialog.width } + ListModel { id: _buttonModel + ListElement { image : "qrc:/images/iPrescription"; func : function() { print("Prescription button pressed!")} } + ListElement { image : "qrc:/images/iWifi"; func : function() { _wifiDialog.open() } } + ListElement { image : "qrc:/images/iBluetooth"; func : function() { print("Bluetooth button pressed!")} } + ListElement { image : "qrc:/images/iCloudSync"; func : function() { print("CloudSync button pressed!")} } + ListElement { image : "qrc:/images/iStorage"; func : function() { print("Storage button pressed!")} } + ListElement { image : "qrc:/images/iSettings"; func : function() { print("Storage button Settings!")} } + ListElement { image : "qrc:/images/iInformation"; func : function() { print("Information button pressed!")} } + } + function setXPos ( button, dialog ) { dialog.x = button.mapToItem(null, button.width, 0).x - dialog.width } + Item { id: _dateTimeItem width : Variables.headerBarDateTimeWidth anchors { @@ -114,62 +123,20 @@ rightMargin : _headerButtonRow.spacing } - IconButton { id : _prescriptionButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iPrescription" - extraSpace : _headerButtonRow.spacing + Repeater { id: _repeater + model: _buttonModel - onPressed: print("Prescription button pressed!") - } + delegate: IconButton { id : _button + iconSize : Variables.headerIconDiameter + iconImageSource : image + extraSpace : _headerButtonRow.spacing - IconButton { id : _wifiButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iWifi" - extraSpace : _headerButtonRow.spacing - - onPressed : _wifiDialog.open() + onPressed : func() + } } - - IconButton { id : _bluetoothButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iBluetooth" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Bluetooth button pressed!") - } - - IconButton { id : _cloudSyncButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iCloudSync" - extraSpace : _headerButtonRow.spacing - - onPressed: print("CloudSync button pressed!") - } - - IconButton { id : _storageButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iStorage" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Storage button pressed!") - } - - IconButton { id : _settingsButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iSettings" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Settings button pressed!") - } - - IconButton { id : _informationButton - iconSize : Variables.headerIconDiameter - iconImageSource : "qrc:/images/iInformation" - extraSpace : _headerButtonRow.spacing - - onPressed: print("Information button pressed!") - } } - WiFiDialog { id: _wifiDialog; x: positionDialog(_wifiButton, _wifiDialog) } + Connections { target: _wifiDialog + function onAdjustPosition(type) { setXPos(_repeater.itemAt(type), _wifiDialog) } + } }