56 lines
1.2 KiB
C++
Executable File
56 lines
1.2 KiB
C++
Executable File
#pragma once
|
|
|
|
#include <map>
|
|
#include <vector>
|
|
#include <string>
|
|
|
|
#include "viewwidget.h"
|
|
|
|
namespace VCtrl
|
|
{
|
|
class ViewWidgetContainer : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
|
|
void add(ViewWidget *pWidget);
|
|
void remove(const std::string &featureID);
|
|
|
|
void clear()
|
|
{
|
|
m_vecViewWidgets.clear();
|
|
m_mapFeatureID_To_ViewWidget.clear();
|
|
}
|
|
|
|
|
|
bool exist(const std::string &featureID) const
|
|
{
|
|
return (m_mapFeatureID_To_ViewWidget.find(featureID) != m_mapFeatureID_To_ViewWidget.end());
|
|
}
|
|
|
|
ViewWidget *getViewWidget(const std::string &featureID) const
|
|
{
|
|
return exist(featureID) ? m_mapFeatureID_To_ViewWidget.at(featureID) : nullptr;
|
|
}
|
|
|
|
ViewWidget *getViewWidget(unsigned int contextID) const;
|
|
|
|
const std::vector<ViewWidget*> &getViewWidgets() const
|
|
{
|
|
return m_vecViewWidgets;
|
|
}
|
|
|
|
std::size_t size() const
|
|
{
|
|
return m_vecViewWidgets.size();
|
|
}
|
|
|
|
private Q_SLOTS:
|
|
void onWidgetDestroyed(QObject *obj);
|
|
private:
|
|
// Both containers will always have same size
|
|
std::vector<ViewWidget *> m_vecViewWidgets; // Keeps track of the ViewWidget ordering (used for the gridlayout)
|
|
std::map<std::string, ViewWidget *> m_mapFeatureID_To_ViewWidget; // Keeps track about the currently used FeatureIDs (respectively opened ViewWidgets)
|
|
};
|
|
}
|