Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How do adjust the position of MenuItem when Menu creates MenuItems using Instantiator?



  • Menu {
        id: recentFilesMenu
    
        Instantiator {
            model: recentFilesModel
            MenuItem {
                text: model.fileName
            }
            onObjectAdded: recentFilesMenu.insertItem(index, object)
            onObjectRemoved: recentFilesMenu.removeItem(object)
        }
    
        MenuSeparator {
            visible: recentFilesModel.count > 0
        }
    
        MenuItem {
            text: "Clear menu"
            enabled: recentFilesModel.count > 0
            onTriggered: recentFilesModel.clear()
        }
    }
    

Log in to reply