当前位置: 首页>>代码示例>>C++>>正文


C++ QComboBox::setFocus方法代码示例

本文整理汇总了C++中QComboBox::setFocus方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setFocus方法的具体用法?C++ QComboBox::setFocus怎么用?C++ QComboBox::setFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QComboBox的用法示例。


在下文中一共展示了QComboBox::setFocus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: eventFilter

bool CDlgAlmECG::eventFilter(QObject *o,QEvent *e)
{
    QObject *obj[]={
         m_cmbb_xinlv
        ,m_spb_xinlv_high
        ,m_spb_xinlv_low
        ,m_cmbb_st
        ,m_spb_st_high
        ,m_spb_st_low

        ,m_btn_ok,
        m_btn_cancel
    };
    int iTotalObj =  8;//11
    int iOkPos = iTotalObj -2;
    int iCancelPos = iTotalObj -1;
    if(e->type() == QEvent::KeyPress)
    {

        QKeyEvent *event=(QKeyEvent *)e;
        switch (event->key()) {
        case Qt::Key_Up:
        case Qt::Key_Left:
            if(bCursorSta == false)
            {
                if(iCursor == 0)
                {
                    iCursor = iTotalObj-1;
                }
                else
                {
                    iCursor -=1;
                }
                if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }
                else
                {
                    QPushButton *p = (QPushButton *)obj[iCursor];
                    p->setFocus();
                }

            }
            else
            {

                if((iCursor == 1)||
                        (iCursor == 5)||
                        (iCursor == 2)||
                        (iCursor == 4)
                        )
                {
                    QSpinBox *p = (QSpinBox *)obj[iCursor];
                    if(p->value()!= p->minimum())
                    {
                        p->setValue(p->value()-1);
                    }
                    else
                    {
                        p->setValue(p->maximum());
                    }

                }
            }

            return true;
            break;
        case Qt::Key_Down:
        case Qt::Key_Right:
            if(bCursorSta == false)
            {
                if(iCursor == iTotalObj-1)
                {
                    iCursor = 0;
                }
                else
                {
                    iCursor +=1;
                }
                if((iCursor>=0) &&(iCursor<(iOkPos-1)))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }
                else
                {
                    QPushButton *p = (QPushButton *)obj[iCursor];
                    p->setFocus();
                }

            }
            else
            {

                if((iCursor == 1)||
                        (iCursor == 5)||
                        (iCursor == 2)||
                        (iCursor == 4)
//.........这里部分代码省略.........
开发者ID:zyzzyva8421,项目名称:monitor,代码行数:101,代码来源:dlg_alm_ecg.cpp

示例2: eventFilter

bool CDlgServManCfgPara::eventFilter(QObject *o,QEvent *e)
{
    QObject *obj[]={
         m_cmbb_xindian
        ,m_cmbb_xueyang
        ,m_cmbb_huxi
        ,m_cmbb_tiwen
        ,m_cmbb_nibp
        ,m_cmbb_mashen
        ,m_cmbb_ibp1
        ,m_cmbb_ibp2
        ,m_cmbb_co2
        ,m_cmbb_qushi
        ,m_cmbb_baojinghuigu
        ,m_cmbb_boxinghuigu
        ,m_cmbb_jiemian
        ,m_cmbb_yaowujisuan
        ,m_cmbb_daolianleixing
        ,m_btn_ok
        ,m_btn_cancel
    };
    int iTotalObj =  17;//11
    int iOkPos = iTotalObj -2;
    int iCancelPos = iTotalObj -1;
    if(e->type() == QEvent::KeyPress)
    {

        QKeyEvent *event=(QKeyEvent *)e;
        switch (event->key()) {
        case Qt::Key_Up:
        case Qt::Key_Left:
            if(bCursorSta == false)
            {
                if(iCursor == 0)
                {
                    iCursor = iTotalObj-1;
                }
                else
                {
                    iCursor -=1;
                }
                if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }
                else
                {
                    QPushButton *p = (QPushButton *)obj[iCursor];
                    p->setFocus();
                }

            }
            else
            {
            }

            return true;
            break;
        case Qt::Key_Down:
        case Qt::Key_Right:
            if(bCursorSta == false)
            {
                if(iCursor == iTotalObj-1)
                {
                    iCursor = 0;
                }
                else
                {
                    iCursor +=1;
                }
                if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }
                else
                {
                    QPushButton *p = (QPushButton *)obj[iCursor];
                    p->setFocus();
                }

            }
            else
            {

            }
            return true;
            break;
        case Qt::Key_Return:
            if(bCursorSta == false)
            {
                if(iCursor == iOkPos)
                {
                    do_ok_clicked();
                }
                else if(iCursor == iCancelPos)
                {
                    do_cancel_clicked();
                }
//.........这里部分代码省略.........
开发者ID:zyzzyva8421,项目名称:monitor,代码行数:101,代码来源:dlg_serv_man_para_config.cpp

示例3: eventFilter

bool CDlgSetMashen::eventFilter(QObject *o,QEvent *e)
{
    QObject *obj[]={
         m_cmbb_ap
        ,m_cmbb_speed
        ,m_btn_ok
        ,m_btn_cancel
    };
    int iTotalObj =  4;//11
    int iOkPos = iTotalObj -2;
    int iCancelPos = iTotalObj -1;
    if(e->type() == QEvent::KeyPress)
    {

        QKeyEvent *event=(QKeyEvent *)e;
        switch (event->key()) {
        case Qt::Key_Up:
        case Qt::Key_Left:
            if(bCursorSta == false)
            {
                if(iCursor == 0)
                {
                    iCursor = iTotalObj-1;
                }
                else
                {
                    iCursor -=1;
                }
                if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }
                else
                {
                    QPushButton *p = (QPushButton *)obj[iCursor];
                    p->setFocus();
                }

            }
            else
            {
            }

            return true;
            break;
        case Qt::Key_Down:
        case Qt::Key_Right:
            if(bCursorSta == false)
            {
                if(iCursor == iTotalObj-1)
                {
                    iCursor = 0;
                }
                else
                {
                    iCursor +=1;
                }
                if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }
                else
                {
                    QPushButton *p = (QPushButton *)obj[iCursor];
                    p->setFocus();
                }

            }
            else
            {

            }
            return true;
            break;
        case Qt::Key_Return:
            if(bCursorSta == false)
            {
                if(iCursor == iOkPos)
                {
                    do_ok_clicked();
                }
                else if(iCursor == iCancelPos)
                {
                    do_cancel_clicked();
                }
                else if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    //btn[iCursor]->showPopup();

                    bCursorSta = false;
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->showPopup();
                    //p->setStyleSheet("background-color: rgb(35, 53, 234,255);");
                }


            }
            else
//.........这里部分代码省略.........
开发者ID:zyzzyva8421,项目名称:monitor,代码行数:101,代码来源:dlg_set_mashen.cpp

示例4: eventFilter

bool CDlgSetColor::eventFilter(QObject *o,QEvent *e)
{
    QObject *obj[]={
        m_cmbb_beat_rate
        ,m_cmbb_spo2
        ,m_cmbb_spire_rate
        ,m_cmbb_temp
        ,m_cmbb_nibp
        ,m_cmbb_mashen
        ,m_cmbb_ibp1
        ,m_cmbb_ibp2
        ,m_cmbb_co2
        ,m_cmbb_wav_eeg
        ,m_cmbb_wav_ecg1
        ,m_cmbb_wav_ecg2
        ,m_cmbb_wav_ecg3
        ,m_cmbb_wav_ecg4
        ,m_cmbb_wav_ecg5
        ,m_cmbb_wav_ecg6
        ,m_cmbb_wav_ecg7
        ,m_cmbb_wav_pulse
        ,m_cmbb_wav_spr
        ,m_cmbb_wav_ibp1
        ,m_cmbb_wav_ibp2
        ,m_cmbb_wav_co2
        ,m_cmbb_wav_mashen
        ,m_btn_ok
        ,m_btn_cancel
    };
    int iTotalObj =  25;//
    int iOkPos = iTotalObj -2;
    int iCancelPos = iTotalObj -1;
    if(e->type() == QEvent::KeyPress)
    {

        QKeyEvent *event=(QKeyEvent *)e;
        switch (event->key()) {
        case Qt::Key_Up:
        case Qt::Key_Left:
            if(bCursorSta == false)
            {
                if(iCursor == 0)
                {
                    iCursor = iTotalObj-1;
                }
                else
                {
                    iCursor -=1;
                }
                if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }
                else
                {
                    QPushButton *p = (QPushButton *)obj[iCursor];
                    p->setFocus();
                }

            }
            else
            {/*

                if((iCursor >= 7)&&(iCursor <=10))
                {
                    QSpinBox *p = (QSpinBox *)obj[iCursor];
                    if(p->value()!= p->minimum())
                    {
                        p->setValue(p->value()-1);
                    }
                    else
                    {
                        p->setValue(p->maximum());
                    }

                }*/
            }

            return true;
            break;
        case Qt::Key_Down:
        case Qt::Key_Right:
            if(bCursorSta == false)
            {
                if(iCursor == iTotalObj-1)
                {
                    iCursor = 0;
                }
                else
                {
                    iCursor +=1;
                }
                if((iCursor>=0) &&(iCursor<iOkPos))
                {
                    QComboBox *p = (QComboBox *)obj[iCursor];
                    p->setFocus();
                }

                else
//.........这里部分代码省略.........
开发者ID:zyzzyva8421,项目名称:monitor,代码行数:101,代码来源:dlg_set_color.cpp


注:本文中的QComboBox::setFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。