QML Click MouseArea should open widget

Hello,

I am experiencing an issue with my QML application. I have redesigned my gallery list in QML and want to open the corresponding gallery, such as “Image 1f” when clicking on an image labeled “Nail Design.” For other categories like “Foot Design,” I would like to display “Image 2f,” and so on.

How can I implement this functionality? I would appreciate a solution or an approach.

To better illustrate my request, I am attaching a project file to facilitate the implementation.

Thank you in advance!

Beauty & More support.flp (435.7 KB)

с начало получить имя изображения
from start get image name

Text {
                                    id: nameimage
                                    text: modelData.text
                                    width: parent.width
                                    font.pixelSize: 55 * magazine.pixelRatio
                                    font.bold: false
                                    wrapMode: Text.Wrap
                                    font.family: "Source Sans Pro"
                                    color: "white"
                                    horizontalAlignment: Text.AlignHCenter
                                }

                                Rectangle {
                                    width : parent.width
                                    height : width * 0.6

                                    Image {
                                        anchors.fill : parent
                                        source : modelData.url
                                        fillMode : Image.Fit
                                   }
                                
                                MouseArea {
                                    anchors.fill: parent
                                    onClicked: {
                                        // Получаем имя (текст) изображения
                                        var imageName = nameimage.text;
                                        console.log("Клик по изображению:", imageName); // Для отладки
                                    }
                                }

Эта часть кода не понятна
This part of the code is not clear

// Wechsel zur Gruppe "Gallery"
                                    var galleryGroup = app.groups.find(g => g.name === "Gallery");
                                    if (galleryGroup) {
                                    galleryGroup.setActive(true);
                                    }

                                    // Zeige das Widget "Bild 1f"
                                    var bild1fWidget = app.widgets.find(w => w.name === "Bild 1f");
                                    if (bild1fWidget) {
                                    bild1fWidget.visible = true;
                                    }
                                }

Back to Flipabit >
Copyright © 2018. Flipabit Team. All rights reserved.