diff --git a/LenaPi/Navigation.qml b/LenaPi/Navigation.qml index 651fd3b..122348d 100644 --- a/LenaPi/Navigation.qml +++ b/LenaPi/Navigation.qml @@ -37,12 +37,14 @@ Item { model: navigationList.pModelItems spacing: 20 orientation: ListView.Horizontal - delegate: - NavigationListDelegate{ + delegate: NavigationListDelegate{ id: delegate + property var delegateModel: navigationList.pModelItems[index] height: parent.height width: height - model: navigationList.pModelItems[index] + isCircleDelegate: delegateModel.pIsCircleDelegate + imageSource: delegateModel.pImageSource + onClicked: delegateModel.onClicked(); } // NavigationListDelegate } // ListView } // Rectangle: List background diff --git a/LenaPi/NavigationListDelegate.qml b/LenaPi/NavigationListDelegate.qml index f7b8937..94b8919 100644 --- a/LenaPi/NavigationListDelegate.qml +++ b/LenaPi/NavigationListDelegate.qml @@ -2,27 +2,29 @@ import QtQuick 2.11 import QtQuick.Controls 2.4 import QtGraphicalEffects 1.0 +/** + * @brief Delegate of navigation list. + * + * The delegate is either a circle or a rectangle containing an image. + */ ItemDelegate{ id: container - property var model + property bool isCircleDelegate: true property alias imageSource: contentImage.source padding: 5 - onClicked:{ - model.onClicked(); - } background: Rectangle{ id: background implicitWidth: 150 implicitHeight: implicitWidth - radius: model.pIsCircleDelegate ? height/2 : 0 + radius: container.isCircleDelegate ? height/2 : 0 color: "blue" Image{ id: contentImage - source: model ? model.pImageSource : "qrc:/default_image" + source: "qrc:/default_image" anchors.fill: parent anchors.margins: 5 diff --git a/LenaPi/models/NavigationListModel.cpp b/LenaPi/models/NavigationListModel.cpp index 906f610..e14ac07 100644 --- a/LenaPi/models/NavigationListModel.cpp +++ b/LenaPi/models/NavigationListModel.cpp @@ -4,7 +4,7 @@ NavigationListModel::NavigationListModel(QObject* parent) : QObject(parent) { - + /*nothing*/ } QList NavigationListModel::getModelItems()