#include "../user/user.h"
const QString BACKGROUND_PATH = ":/res/images/list_item.png"; ///< Background image path
-const QString BACKGROUND_TOP_PATH = ":/res/images/list_item_top.png"; ///< Background image path
-const QString BACKGROUND_MIDDLE_PATH = ":/res/images/list_item_middle.png"; ///< Background image path
-const QString BACKGROUND_BOTTOM_PATH = ":/res/images/list_item_bottom.png"; ///< Background image path
+//const QString BACKGROUND_TOP_PATH = ":/res/images/list_item_top.png"; ///< Background image path
+//const QString BACKGROUND_MIDDLE_PATH = ":/res/images/list_item_middle.png"; ///< Background image path
+//const QString BACKGROUND_BOTTOM_PATH = ":/res/images/list_item_bottom.png"; ///< Background image path
const QString CLOCK_PATH = ":/res/images/clock.png"; ///< Clock image path
const QString COMPASS_PATH = ":/res/images/compass.png"; ///< Compass image path
const QString ENVELOPE_PATH = ":/res/images/envelope.png"; ///< Envelope image path
*/
const QString STYLESHEET = "QWidget#listItem { border-image: url(:/res/images/list_item.png) 20%; " \
"border-width: 20px 14px 16px 14px; } " \
- "QLabel { color: #989898; }" \
- "#nameLabel { color: #ffffff }";
+ "QLabel { font-size: 13pt; color: #989898; }" \
+ "#nameLabel { font-size: 18pt; color: #ffffff }";
FriendListItem::FriendListItem(QWidget *parent)
: QWidget(parent)
setFont(NOKIA_FONT_SMALL);
- setStyleSheet(STYLESHEET);
+// setStyleSheet(STYLESHEET);
setMinimumSize(ITEM_MIN_WIDTH, ITEM_MIN_HEIGHT);
setMaximumSize(ITEM_MIN_WIDTH, ITEM_MAX_HEIGHT);
+
+ BACKGROUND_TOP_PATH.load(":/res/images/list_item_top.png"); ///< Background image path
+ BACKGROUND_MIDDLE_PATH.load(":/res/images/list_item_middle.png"); ///< Background image path
+ BACKGROUND_BOTTOM_PATH.load(":/res/images/list_item_bottom.png"); ///< Background image path
}
void FriendListItem::setData(User *user)
void FriendListItem::paintEvent(QPaintEvent *event)
{
-// qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
- Q_UNUSED(event);
+ qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
+
+ QPainter painter(this);
+
+// QRect topRect = QRect(event->rect().left(), event->rect().y(), event->rect().width(), 20);
+// QRect middleRect = QRect(topRect.left(), topRect.bottom() + 1, event->rect().width(),
+// event->rect().height() - 20 - 15);
+// QRect bottomRect = QRect(topRect.left(), middleRect.bottom() + 1, event->rect().width(),
+// 15);
+
+ int height = event->rect().height();
+
+ if (event->rect().height() < 148)
+ height = 148;
- QStyleOption option;
- option.init(this);
+ QRect topRect = QRect(0, 0, event->rect().width(), 20);
+ QRect middleRect = QRect(0, topRect.bottom() + 1, event->rect().width(),
+ height - 20 - 15);
+ QRect bottomRect = QRect(topRect.left(), middleRect.bottom() + 1, event->rect().width(),
+ 15);
- QStylePainter painter(this);
- style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+ painter.drawPixmap(topRect, BACKGROUND_TOP_PATH);
+ painter.drawPixmap(middleRect, BACKGROUND_MIDDLE_PATH);
+ painter.drawPixmap(bottomRect, BACKGROUND_BOTTOM_PATH);
}