本文整理汇总了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)
//.........这里部分代码省略.........
示例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();
}
//.........这里部分代码省略.........
示例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
//.........这里部分代码省略.........
示例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
//.........这里部分代码省略.........