4 #include "listcommon.h"
6 #include "locationlistitem.h"
8 const int LOCATION_SUBITEM_TEXT_MAX_WIDTH = SUBITEM_TEXT_MAX_WIDTH + MARGIN + IMAGE_WIDTH;
10 LocationListItem::LocationListItem()
12 qDebug() << __PRETTY_FUNCTION__;
14 setSubitemTextWidth(LOCATION_SUBITEM_TEXT_MAX_WIDTH);
17 GeoCoordinate LocationListItem::coordinates()
19 qDebug() << __PRETTY_FUNCTION__;
21 return m_location.coordinates();
24 QString LocationListItem::id() const
26 qDebug() << __PRETTY_FUNCTION__;
31 void LocationListItem::setLocationData(const Location &location)
33 m_location = location;
35 QStringList addressComponents = m_location.addressComponents();
37 if (addressComponents.count() > 0)
38 setName(shortenText(addressComponents.at(0), ITEM_WIDTH - 3*MARGIN,
39 ListItem::TEXT_SIZE_NORMAL));
43 for (int i = 1; i < addressComponents.count(); ++i) {
44 addressTail.append(addressComponents.at(i));
46 if (i < (addressComponents.count() - 1))
47 addressTail.append(", ");
50 addSubItem(addressTail, QPixmap(":/res/images/compass.png"));
54 void LocationListItem::bounds(GeoCoordinate &swBound, GeoCoordinate &neBound)
56 m_location.bounds(swBound, neBound);