#include "cctrlparamcombobox.h"

CCtrlParamCombobox::CCtrlParamCombobox(QWidget *parent)
    : CCtrlParamBase(parent)
{
    comboparam=new QComboBox(this);
    comboparam->setSizePolicy(m_hor,m_ver);
    layout->addWidget(comboparam);
    layout->addWidget(staticuint);
    setLayout(layout);

}

void CCtrlParamCombobox::MParamInit(Variant *pParam)
{
    CCtrlParamBase::MParamInit(pParam);
    comboparam->addItems(pParam->m_slRange);
}


void CCtrlParamCombobox::MTimeFresh()
{
}

void CCtrlParamCombobox::MFresh()
{
    if(!m_pParam||m_pParam->m_vVar.type()!=QVariant::UInt) return;

    comboparam->setCurrentIndex(m_pParam->m_vVar.toUInt());
}

void CCtrlParamCombobox::MApply()
{
    if(!m_pParam||m_pParam->m_vVar.type()!=QVariant::UInt) return;
        m_pParam->m_vVar=uint(comboparam->currentIndex());
}

