#include "cmwemo.h"
#include <QPainter>
CMWEmo::CMWEmo(QWidget *parent) : CMWidget(parent)
{

}

void CMWEmo::paintEvent(QPaintEvent *)
{
    QRect rectFrame=rect();
    rectFrame.adjust(2,2,-2,-2);
    QPainter painter(this);
    painter.fillRect(rectFrame,Qt::red);

    painter.setPen(Qt::black);
    QFont font=painter.font();
    font.setPointSize(48);
    painter.setFont(font);
    painter.drawText(rectFrame,Qt::AlignCenter,QString("EMS"));
}

void CMWEmo::ShowDlg(bool bShow)
{
    if(bShow)
    {
        QWidget* pWidget=(QWidget*)parent();
        if(pWidget)
        {
            QRect rectParent=pWidget->rect();
            QRect rectFrame=rectParent;
            rectFrame.setHeight(100);
            rectFrame.moveCenter(rectParent.center());
            this-> setGeometry(rectFrame);
        }
        show();
    }
    else
    {
        hide();
    }
}

