QPalette labelPalette = m_friendListHeaderWidget->palette();
labelPalette.setColor(QPalette::Background, Qt::black);
m_friendListHeaderWidget->setPalette(labelPalette);
- m_friendListHeaderWidget->hide();
+ //m_friendListHeaderWidget->hide();
m_friendListLabel = new QLabel(this);
m_clearFilterButton = new QPushButton(tr("Show all"));
filterLayout->addWidget(m_friendListLabel);
m_locationListView = new LocationListView(this);
m_locationListView->setItemDelegate(new ExtendedListItemDelegate(this));
//REMOVE
- //m_locationListView->hide();
+ m_locationListView->hide();
friendListLayout->addWidget(m_friendListView);
- friendListLayout->addWidget(m_locationListView);
+ //friendListLayout->addWidget(m_locationListView);
m_panelVBox->addLayout(friendListLayout);
connect(m_friendListView, SIGNAL(friendItemClicked(GeoCoordinate)),
{
qDebug() << __PRETTY_FUNCTION__;
- m_friendListHeaderWidget->hide();
- m_friendListView->clearFilter();
+// m_friendListHeaderWidget->hide();
+// m_friendListView->clearFilter();
+
+ m_friendListView->filter("pek");
}
void FriendListPanel::locationDataReady(QList<Location> &result)
setSize(QSize(ITEM_WIDTH, ITEM_MIN_HEIGHT));
}
+QString ListItem::name() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return data(NAME_DISPLAY_INDEX).toString();
+}
+
void ListItem::setImage(const QPixmap &image)
{
qDebug() << __PRETTY_FUNCTION__;
virtual QString id() const = 0;
/**
+ * @brief Returns item's name.
+ *
+ * @return item's name
+ */
+ QString name() const;
+
+ /**
* @brief Sets item's image.
*
* @param image QPixmap
}
}
+void ListView::filter(const QString &pattern)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ foreach (ListItem *item, m_listItems) {
+ if (item->name().contains(pattern, Qt::CaseInsensitive))
+ setItemHidden(item, false);
+ else
+ setItemHidden(item, true);
+ }
+}
+
ListItem *ListView::takeListItemFromView(const QString &userID)
{
qDebug() << __PRETTY_FUNCTION__;
*/
void filter(const QList<QString> &userIDs);
+ void filter(const QString &pattern);
+
/**
* @brief Takes item from view.
*
*/
ListItem *listItem(const QString &userID);
+private:
+
protected slots:
/**
* @brief Slot for list item clicked.
* DATA MEMBERS
******************************************************************************/
private:
- ListItem *m_previousItem; ///< Previously selected item
QHash<QString, ListItem *> m_listItems; ///< List of items in this view. Key = user ID
+ ListItem *m_previousItem; ///< Previously selected item
+ QVector<int> m_filteredIndices;
+ QVector<int> m_shownIndices;
};
#endif // LISTVIEW_H