#include "iconlayerwidget.h"
#include "clistwidget.h"

#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QListWidget>
#include <QListWidgetItem>
#include <QMouseEvent>
#include <QMimeData>
#include <QDrag>
#include <QPainter>
#include <QPushButton>
#include <QDebug>

IconLayerWidget::IconLayerWidget(QWidget *parent)
    : QWidget(parent)
{
    initUI();
    connects();
}

void IconLayerWidget::initUI()
{
    mMainVLayout = new QVBoxLayout;
    mTitleLabel = new QLabel("设置");
    mIconListWidget = new CListWidget;
//    mIconListWidget->setViewMode(QListView::IconMode);
//    mIconListWidget->setResizeMode(QListView::Adjust);
//    mIconListWidget->setFlow(QListView::LeftToRight);
    mIconListWidget->setDragEnabled(true);

    mButtonHLayout = new QHBoxLayout;
    mClearIconButton = new QPushButton("清除所有军标");
    mButtonHLayout->addWidget(mClearIconButton);

    mMainVLayout->addWidget(mTitleLabel);
    mMainVLayout->addWidget(mIconListWidget);
    mMainVLayout->addLayout(mButtonHLayout);
    this->setLayout(mMainVLayout);
}

void IconLayerWidget::connects()
{
    connect(mClearIconButton, &QPushButton::clicked, this, &IconLayerWidget::clearAllIcon);
}
