Support item tabs based on item group string
This commit is contained in:
parent
0e09b6f46c
commit
a17cd23a4e
29 changed files with 527 additions and 181 deletions
|
|
@ -4,9 +4,9 @@
|
|||
#include <QWidget>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <QScroller>
|
||||
#include <QScrollArea>
|
||||
#include <QSpacerItem>
|
||||
#include "itemwidget.h"
|
||||
#include "../items/relay.h"
|
||||
#include "../items/item.h"
|
||||
#include "../items/itemstore.h"
|
||||
|
||||
|
|
@ -20,7 +20,16 @@ class ItemScrollBox : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
std::vector< ItemWidget* > widgets_;
|
||||
struct Tab
|
||||
{
|
||||
QScrollArea* scroller;
|
||||
QWidget* content;
|
||||
QSpacerItem* spacer;
|
||||
};
|
||||
|
||||
QMap<QString, Tab> tabs_;
|
||||
QMap<QString, std::vector<ItemWidget*>> widgets_;
|
||||
Ui::RelayScrollBox *ui;
|
||||
|
||||
signals:
|
||||
void deleteRequest(const ItemData& item);
|
||||
|
|
@ -36,9 +45,15 @@ public slots:
|
|||
|
||||
void addItem(std::weak_ptr<Item> item);
|
||||
void removeItem(const ItemData& item);
|
||||
void onItemUpdate(const ItemUpdateRequest& update);
|
||||
|
||||
private:
|
||||
Ui::RelayScrollBox *ui;
|
||||
void ensureTabExists(const QString& groupName);
|
||||
void cleanupEmptyTabs();
|
||||
|
||||
private:
|
||||
void addItemToTabs(std::weak_ptr<Item> item);
|
||||
void removeItemFromTabs(const ItemData& item);
|
||||
};
|
||||
|
||||
#endif // RELAYSCROLLBOX_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue