2 Situare - A location system for Facebook
3 Copyright (C) 2010 Ixonos Plc. Authors:
5 Jussi Laitinen - jussi.laitinen@ixonos.com
7 Situare is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 version 2 as published by the Free Software Foundation.
11 Situare is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Situare; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include "friendlistitemdelegate.h"
26 #include "../common.h"
27 #include "listcommon.h"
29 FriendListItemDelegate::FriendListItemDelegate(QWidget *parent)
30 : ExtendedListItemDelegate(parent)
32 qDebug() << __PRETTY_FUNCTION__;
35 void FriendListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
36 const QModelIndex &index) const
38 qDebug() << __PRETTY_FUNCTION__;
40 ExtendedListItemDelegate::paint(painter, option, index);
42 painter->setPen(COLOR_GRAY);
43 painter->setFont(NOKIA_FONT_SMALL);
45 QString distance = index.data(DISTANCE_TEXT_DISPLAY_INDEX).toString();
46 QPixmap distanceIcon = QPixmap(qvariant_cast<QPixmap>(index.data(DISTANCE_IMAGE_INDEX)));
48 QRect itemRect = option.rect;
50 QPoint distanceIconPoint = QPoint(ITEM_WIDTH - ICON_WIDTH - 3 * MARGIN,
51 itemRect.top() + MARGIN);
53 QRect distanceRect = index.data(DISTANCE_SIZE_HINT_INDEX).toRect();
54 distanceRect.translate(ITEM_WIDTH - distanceRect.width() - 2 * MARGIN,
55 itemRect.top() + ICON_HEIGHT + 3 * MARGIN);
57 painter->drawPixmap(distanceIconPoint, distanceIcon);
58 painter->drawText(distanceRect, Qt::TextSingleLine, distance);