summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-04-03 18:54:15 +0000
committerakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-04-03 18:54:15 +0000
commit73e45e8765daa03145300aa28eaa782bb98f5438 (patch)
tree3d77405700f737edf8b658d24cea31f6dee2c8c2
parent49ce5a805c89f1e5d00ac9b55128b67fbc1fd4bf (diff)
downloadnavit-73e45e8765daa03145300aa28eaa782bb98f5438.tar.gz
Fix:gui/qml:Added value passing throught NGQStandardItemModel
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@3122 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--navit/gui/qml/bookmarksProxy.h1
-rw-r--r--navit/gui/qml/navitProxy.h2
-rw-r--r--navit/gui/qml/ngqpoint.h6
-rw-r--r--navit/gui/qml/proxy.h3
-rw-r--r--navit/gui/qml/skins/navit/ListSelector.qml2
-rw-r--r--navit/gui/qml/skins/navit/ListSelectorXml.qml72
-rw-r--r--navit/gui/qml/skins/navit/Makefile.am2
-rw-r--r--navit/gui/qml/skins/navit/PagePoi.qml13
8 files changed, 16 insertions, 85 deletions
diff --git a/navit/gui/qml/bookmarksProxy.h b/navit/gui/qml/bookmarksProxy.h
index 3e09826d0..d938b6e31 100644
--- a/navit/gui/qml/bookmarksProxy.h
+++ b/navit/gui/qml/bookmarksProxy.h
@@ -62,6 +62,7 @@ public slots:
if (seenMap[labelList[0]]==labelList[0]) continue;
seenMap[labelList[0]]=labelList[0];
curItem->setData(labelList[0],NGQStandardItemModel::ItemName);
+ curItem->setData(labelList[0],NGQStandardItemModel::ItemValue);
curItem->setData(QString(this->current_path).append(labelList[0]).append("/"),NGQStandardItemModel::ItemPath);
if (labelList.size()>1) {
curItem->setData("yes",NGQStandardItemModel::ItemIcon);
diff --git a/navit/gui/qml/navitProxy.h b/navit/gui/qml/navitProxy.h
index 30f691e10..3d9597e5c 100644
--- a/navit/gui/qml/navitProxy.h
+++ b/navit/gui/qml/navitProxy.h
@@ -52,6 +52,7 @@ public slots:
if (attr.type==attr_layout) {
curItem->setData(QVariant(counter),NGQStandardItemModel::ItemId);
curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemName);
+ curItem->setData(QVariant(attr.u.layout->name),NGQStandardItemModel::ItemValue);
if (currentValue==attr.u.layout->name) {
retId.setNum(counter);
}
@@ -60,6 +61,7 @@ public slots:
this->object->currVehicle=attr.u.vehicle;
curItem->setData(QVariant(counter),NGQStandardItemModel::ItemId);
curItem->setData(QVariant(this->object->vehicleProxy->getAttr("name")),NGQStandardItemModel::ItemName);
+ curItem->setData(QVariant(this->object->vehicleProxy->getAttr("name")),NGQStandardItemModel::ItemValue);
retId.setNum(0);
}
counter++;
diff --git a/navit/gui/qml/ngqpoint.h b/navit/gui/qml/ngqpoint.h
index afeb2e274..ba03322dc 100644
--- a/navit/gui/qml/ngqpoint.h
+++ b/navit/gui/qml/ngqpoint.h
@@ -163,18 +163,22 @@ public slots:
QDomElement typeTag=retDoc.createElement("type");
QDomElement distTag=retDoc.createElement("distance");
QDomElement directTag=retDoc.createElement("direction");
+ QDomElement coordsTag=retDoc.createElement("coords");
QDomText nameT=retDoc.createTextNode(rs);
QDomText typeT=retDoc.createTextNode(QString(item_to_name(item->type)));
QDomText distT=retDoc.createTextNode(QString::number(idist/1000));
QDomText directT=retDoc.createTextNode(dirbuf);
+ QDomText coordsT=retDoc.createTextNode(QString("%1 %2").arg(c.x).arg(c.y));
nameTag.appendChild(nameT);
typeTag.appendChild(typeT);
distTag.appendChild(distT);
directTag.appendChild(directT);
+ coordsTag.appendChild(coordsT);
entry.appendChild(nameTag);
entry.appendChild(typeTag);
entry.appendChild(distTag);
entry.appendChild(directTag);
+ entry.appendChild(coordsTag);
entries.appendChild(entry);
}
}
@@ -184,7 +188,7 @@ public slots:
}
map_selection_destroy(sel);
mapset_close(h);
- dbg(2,"%s\n",retDoc.toString().toLocal8Bit().constData());
+ dbg(0,"%s\n",retDoc.toString().toLocal8Bit().constData());
return retDoc.toString();
}
protected:
diff --git a/navit/gui/qml/proxy.h b/navit/gui/qml/proxy.h
index 3ffa4c3ba..51e415da2 100644
--- a/navit/gui/qml/proxy.h
+++ b/navit/gui/qml/proxy.h
@@ -9,10 +9,11 @@ public:
roleNames.insert(NGQStandardItemModel::ItemName, "itemName");
roleNames.insert(NGQStandardItemModel::ItemIcon, "itemIcon");
roleNames.insert(NGQStandardItemModel::ItemPath, "itemPath");
+ roleNames.insert(NGQStandardItemModel::ItemValue, "itemValue");
this->setRoleNames(roleNames);
}
- enum listRoles {ItemId=Qt::UserRole+1,ItemName=Qt::UserRole+2,ItemIcon=Qt::UserRole+3,ItemPath=Qt::UserRole+4};
+ enum listRoles {ItemId=Qt::UserRole+1,ItemName=Qt::UserRole+2,ItemIcon=Qt::UserRole+3,ItemPath=Qt::UserRole+4,ItemValue=Qt::UserRole+5};
private:
QHash<int, QByteArray> roleNames;
};
diff --git a/navit/gui/qml/skins/navit/ListSelector.qml b/navit/gui/qml/skins/navit/ListSelector.qml
index f3cba971c..97462b472 100644
--- a/navit/gui/qml/skins/navit/ListSelector.qml
+++ b/navit/gui/qml/skins/navit/ListSelector.qml
@@ -31,7 +31,7 @@ Rectangle {
MouseRegion {
id:delegateMouse
anchors.fill: parent
- onClicked: { list.currentIndex=itemId; listselector.value=itemName; listselector.changed() }
+ onClicked: { list.currentIndex=itemId; listselector.value=itemValue; listselector.changed() }
}
}
}
diff --git a/navit/gui/qml/skins/navit/ListSelectorXml.qml b/navit/gui/qml/skins/navit/ListSelectorXml.qml
deleted file mode 100644
index bc354a9e8..000000000
--- a/navit/gui/qml/skins/navit/ListSelectorXml.qml
+++ /dev/null
@@ -1,72 +0,0 @@
-
-import Qt 4.6
-
-Rectangle {
- id: listselector
- width: parent.width; height: parent.height
- color: "Black"
-
-
- property string text: "ListSelector"
- property string value: ""
- property string itemId: "0"
- signal changed
-
- function startup() {
- console.log("model is: "+listModel);
- }
- Component.onCompleted: startup();
-
- Component {
- id: delegate
- Item {
- id: wrapper
- width: list.width; height: 20
- Column {
- x: 5; y: 5
- Text { text: itemName; color: "White" }
- }
- MouseRegion {
- id:delegateMouse
- anchors.fill: parent
- onClicked: { list.currentIndex=itemId; listselector.value=itemName; listselector.changed() }
- }
- }
- }
-
- Component {
- id: highlight
- Rectangle {
- color: "lightsteelblue"
- radius: 5
- }
- }
-
- Text {
- id: labelTxt; text: listselector.text; color: "White"; font.pointSize: 14;
- anchors.horizontalCenter: list.horizontalCenter
- anchors.verticalCenter: listselector.top
- }
-
- ListView {
- id: list;
- width: listselector.width*0.8; height: listselector.height
- anchors.top: labelTxt.bottom;
- anchors.left: listselector.left
- model: listModel
- delegate: delegate
- highlight: highlight
- focus: true
- clip: true
- highlightFollowsCurrentItem: true
- keyNavigationWraps: true
- overShoot: false
- currentIndex: listselector.itemId;
- }
- Rectangle {
- id: listScroller
- opacity: 0.5; anchors.left: list.right; anchors.leftMargin: 4; width: 6
- y: (list.visibleArea.yPosition * list.height)+(list.visibleArea.heightRatio * list.height/4)
- height: list.visibleArea.heightRatio * list.height
- }
-}
diff --git a/navit/gui/qml/skins/navit/Makefile.am b/navit/gui/qml/skins/navit/Makefile.am
index bae51e33e..110c4e99a 100644
--- a/navit/gui/qml/skins/navit/Makefile.am
+++ b/navit/gui/qml/skins/navit/Makefile.am
@@ -4,7 +4,7 @@ SKIN = navit
qmldir=$(skinsdir)/$(SKIN)
-qml_DATA = ButtonIcon.qml ToggleSwitch.qml ToggleButton.qml ListSelector.qml ListSelectorXml.qml Slider.qml Cellar.qml main.qml point.qml command.qml PageAbout.qml PageBookmarksAdd.qml PageBookmarks.qml PageNavigation.qml PageRoute.qml PageSearch.qml PageSearchSelector.qml PageSettingsDisplay.qml PageSettingsLocale.qml PageSettings.qml PageSettingsRules.qml PageSettingsTools.qml PageSettingsVehicle.qml PagePoi.qml
+qml_DATA = ButtonIcon.qml ToggleSwitch.qml ToggleButton.qml ListSelector.qml Slider.qml Cellar.qml main.qml point.qml command.qml PageAbout.qml PageBookmarksAdd.qml PageBookmarks.qml PageNavigation.qml PageRoute.qml PageSearch.qml PageSearchSelector.qml PageSettingsDisplay.qml PageSettingsLocale.qml PageSettings.qml PageSettingsRules.qml PageSettingsTools.qml PageSettingsVehicle.qml PagePoi.qml
qml_DATA += background.svg knob.svg
do_button_subst = sed -e 's,matchProperties,properties,g' \
diff --git a/navit/gui/qml/skins/navit/PagePoi.qml b/navit/gui/qml/skins/navit/PagePoi.qml
index f608e499b..e5b8c118b 100644
--- a/navit/gui/qml/skins/navit/PagePoi.qml
+++ b/navit/gui/qml/skins/navit/PagePoi.qml
@@ -9,14 +9,8 @@ Rectangle {
color: "Black"
opacity: 0
- function bookmarkClick(itemId,itemIcon,itemName,itemPath) {
- if ( itemIcon=="yes" ) {
- bookmarks.currentPath=itemPath;
- bookmarks.getAttrList("");
- } else {
- bookmarks.setPoint(itemId);
- gui.setPage("point.qml");
- }
+ function poiClick(item) {
+ console.log("itemName: "+item.itemName);
}
function calculateFilter() {
@@ -119,9 +113,10 @@ Rectangle {
XmlRole { name: "itemType"; query: "type/string()" }
XmlRole { name: "itemDistance"; query: "distance/string()" }
XmlRole { name: "itemDirection"; query: "direction/string()" }
+ XmlRole { name: "itemCoords"; query: "coords/string()" }
}
ListSelector {
- id:layoutList; text: ""; itemId: point.getAttrList("points"); onChanged: console.log("Poi clicked");
+ id:layoutList; text: ""; itemId: point.getAttrList("points"); onChanged: console.log("clicked"+wrapper);
anchors.top: distanceSlider.bottom;
anchors.left: parent.left; anchors.leftMargin: 3
anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32