mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-07 08:35:16 -04:00
added remove buttons for ongoing search entries
This commit is contained in:
parent
91fd38d46f
commit
c79ceba4ee
4 changed files with 83 additions and 3 deletions
|
@ -59,6 +59,8 @@
|
|||
#define ROLE_SUBSCRIBE_FLAGS Qt::UserRole + 8
|
||||
#define ROLE_COLOR Qt::UserRole + 9
|
||||
#define ROLE_SAVED_ICON Qt::UserRole + 10
|
||||
#define ROLE_SEARCH_STRING Qt::UserRole + 11
|
||||
#define ROLE_REQUEST_ID Qt::UserRole + 12
|
||||
|
||||
#define FILTER_NAME_INDEX 0
|
||||
#define FILTER_DESC_INDEX 1
|
||||
|
@ -397,6 +399,32 @@ QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIc
|
|||
return item;
|
||||
}
|
||||
|
||||
void GroupTreeWidget::removeSearchItem(QTreeWidgetItem *item)
|
||||
{
|
||||
ui->treeWidget->takeTopLevelItem(ui->treeWidget->indexOfTopLevelItem(item)) ;
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GroupTreeWidget::addSearchItem(const QString& search_string, uint32_t id, const QIcon& icon)
|
||||
{
|
||||
QTreeWidgetItem *item = addCategoryItem(search_string,icon,true);
|
||||
|
||||
item->setData(COLUMN_DATA,ROLE_SEARCH_STRING,search_string) ;
|
||||
item->setData(COLUMN_DATA,ROLE_REQUEST_ID ,id) ;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
bool GroupTreeWidget::isSearchRequestItem(QPoint &point,uint32_t& search_req_id)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
if (item == NULL)
|
||||
return false;
|
||||
|
||||
search_req_id = item->data(COLUMN_DATA, ROLE_REQUEST_ID).toUInt();
|
||||
|
||||
return search_req_id > 0;
|
||||
}
|
||||
|
||||
QString GroupTreeWidget::itemId(QTreeWidgetItem *item)
|
||||
{
|
||||
if (item == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue