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

}
 void  LoginWidget::init()
 {
     //多通道无线脑电采集系统
     m_labDes.setText(tr("Multi-channel wireless EEG acquisition system"));
     //用户名
     m_labUser.setText(tr("user"));;
     //密码
     m_labpasswd.setText(tr("passwd"));;

      m_btnLogin.setText(tr("login"));;  ;
 }
 void  LoginWidget::initLay()
 {
#if 1
     QHBoxLayout * layhDes = new QHBoxLayout;
     QHBoxLayout * layhImage = new QHBoxLayout;
     QGridLayout * gridlay = new QGridLayout;
     QHBoxLayout * layhUserPasswd = new QHBoxLayout;
     QHBoxLayout * layhlogin = new QHBoxLayout;

     layhDes->addStretch();
     layhDes->addWidget(&m_labDes);
     layhDes->addStretch();

     layhImage->addStretch();
     layhImage->addWidget(&m_labImage);
     layhImage->addStretch();

     layhlogin->addStretch();
     layhlogin->addWidget(&m_btnLogin);
     layhlogin->addStretch();


     int col = 0;
     int row = 0;
     gridlay->addWidget(&m_labUser,row,col);
     gridlay->addWidget(&m_editUser,row,++col);
     row ++;
     col = 0;
     gridlay->addWidget(&m_labpasswd,row,col);
     gridlay->addWidget(&m_editpasswd,row,++col);

     layhUserPasswd->addStretch();
     layhUserPasswd->addLayout(gridlay);
     layhUserPasswd->addStretch();

     QVBoxLayout * layV = new QVBoxLayout;
     layV->addLayout(layhDes);
     layV->addLayout(layhImage);
     layV->addLayout(layhUserPasswd);
     layV->addLayout(layhlogin);

     setLayout(layV);
#else

#endif

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

     }
     return bCon;
 }
 void  LoginWidget::slotlogIn()
 {

 }
