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 void LocationListItem::bounds(GeoCoordinate &swBound, GeoCoordinate &neBound)
19 qDebug() << __PRETTY_FUNCTION__;
21 m_location.viewport(swBound, neBound);
24 GeoCoordinate LocationListItem::coordinates() const
26 qDebug() << __PRETTY_FUNCTION__;
28 return m_location.coordinates();
31 void LocationListItem::setLocationData(const Location &location)
33 qDebug() << __PRETTY_FUNCTION__;
35 m_location = location;
37 QStringList addressComponents = m_location.addressComponents();
39 if (addressComponents.isEmpty())
42 setTitle(shortenText(addressComponents.at(0), ITEM_WIDTH - 3 * MARGIN,
43 ListItem::TEXT_SIZE_NORMAL));
45 addressComponents.removeFirst();
47 if (!addressComponents.isEmpty()) {
49 addSubItem(addressComponents.join(", "), QPixmap(":/res/images/compass.png"));
54 LocationListItem::~LocationListItem()
56 qDebug() << __PRETTY_FUNCTION__;