MainMenu.qml Example File
places/items/MainMenu.qml
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtLocation 5.6
MenuBar {
property variant providerMenu: providerMenu
property variant settingsMenu: settingsMenu
signal selectProvider(string providerName)
signal selectSetting(string setting);
Menu {
id: providerMenu
title: qsTr("Provider")
function createMenu(plugins)
{
clear()
for (var i = 0; i < plugins.length; i++) {
createProviderMenuItem(plugins[i]);
}
}
function createProviderMenuItem(provider)
{
var item = addItem(provider);
item.checkable = true;
item.triggered.connect(function(){selectProvider(provider)})
}
}
Menu {
id: settingsMenu
title: qsTr("Settings")
function createMenu(map)
{
clear()
var item = addItem(qsTr("Search Center"));
item.triggered.connect(function(){selectSetting("searchCenter")})
item = addItem(qsTr("Search Bounding Box"));
item.triggered.connect(function(){selectSetting("searchBoundingBox")})
item = addItem(qsTr("Search Bounding Circle"));
item.triggered.connect(function(){selectSetting("searchBoundingCircle")})
item = addItem(qsTr("Search Options"));
item.triggered.connect(function(){selectSetting("SearchOptions")})
}
}
}