#ifndef MAPLAYERWIDGET_H
#define MAPLAYERWIDGET_H

#include <QWidget>

class QVBoxLayout;
class QHBoxLayout;
class QGroupBox;
class QTreeView;
class QListWidget;
class QPushButton;
class QSplitter;
class QToolButton;

class TreeModel;
class TreeItem;

/**
* @brief 地图图层
**/
class MapLayerWidget : public QWidget
{
    Q_OBJECT
public:
    MapLayerWidget(QWidget* parent = nullptr);


    void setRootItem(TreeItem* item);

signals:
    void mapLayerVisible(const QString& layerName, bool state);


private:
    void initUI();
    void connects();

private slots:
    void onTreeDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);

private:
    QHBoxLayout* mMainHLayout;
    QSplitter* mVSplitter;

    QWidget* mMapLayerWidget;
    QVBoxLayout* mMapLayerVLayout;

    QTreeView* mMapLayerTreeView;
    TreeModel* mMapLayerTreeModel;

    QHBoxLayout* mLayerSelectHLayout;
    QPushButton* mSelectAllButton;
    QPushButton* mSelectNoAllButton;
};

#endif // MAPLAYERWIDGET_H
