#include "DataProcessWidget.h"
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include <QDebug>
DataProcessWidget::DataProcessWidget(QWidget * parent )
{
    init();
    initLay();
    initConnect();

}
DataProcessWidget::~DataProcessWidget()
{

}

void  DataProcessWidget::init()
{
      m_labDes.setStyleSheet("border-image:url(:/image/dataprocess.png);}");
      m_btnRet.setStyleSheet("border-image:url(:/image/icon_back_2.png);}");
      m_labDes.setMaximumSize(QSize(200,30));
      m_labDes.setMinimumSize(QSize(200,30));
      m_btnRet.setMaximumSize(QSize(100,30));
      m_btnRet.setMinimumSize(QSize(100,30));

      m_NavListWidget.setList(QStringList()<<"低频滤波"<<"高频滤波"<<"脑形地图"<<"功率谱图"<<"频段合成"<<"趋势分析"<<"打印报告",
                              QStringList()<<"ssss"<<"sss"<<"sk"<<"set"<<"info"<<"ss"<<"ss");

}
void  DataProcessWidget::initLay()
{
    QHBoxLayout * hlay   = new QHBoxLayout;
    hlay->addWidget(&m_btnRet,1,Qt::AlignLeft);
    hlay->addWidget(&m_labDes,9, Qt::AlignHCenter);
    QWidget * w1  = new QWidget;
    w1->setFixedHeight(60);
     w1->setStyleSheet("QWidget{background-color:#ffffff;}");
    w1->setLayout(hlay);
    QVBoxLayout * vlay  = new QVBoxLayout;
    vlay->addWidget(w1,1);
    QWidget * w  = new QWidget;
    w->setStyleSheet("QWidget{background: rgb(47, 61, 82);border:0px}");
    vlay->addWidget(w,9);
    vlay->setContentsMargins(0,0,0,0);
    vlay->setSpacing(10);
    setLayout(vlay);

    QHBoxLayout * hlayMain = new QHBoxLayout;

    w ->setLayout(hlayMain);
    hlayMain->addWidget(&m_NavListWidget,1);
    hlayMain->addWidget(&m_stackedWidget,9);
    hlayMain->setContentsMargins(0,0,0,0);

}
bool  DataProcessWidget::initConnect()
{
    bool bCon = true;
    bCon = connect(&m_btnRet,SIGNAL(clicked(bool)),this,SLOT(slotClickedChanged()));
    if(!bCon)
    {
        qDebug()<<"connect failed"<<endl;

    }
    return bCon;
}
void DataProcessWidget::slotClickedChanged()
{

    QObject * send = static_cast<QObject *>(sender());
    if(send == nullptr)
    {
        return;
    }
    emit SigClicked(send->objectName());

}
