I use physical Knob for control menu than included QCombobox. When press knob then call click function of ComboBoxObject. When knob rotate then rotate function call with value {-1,1}. I need change highlighted item when QComboBox is popup in rotate function.
void ComboBoxObject::click(){
showPopup();
}
void ComboBoxObject::rotate(direct int) // Left=-1, Right=1
{
up/down
}
When focus on Combobox setCurrenIndex(index)
work correct but if pupop list then it doesn't work. I use highlighted(index)
but not work.
I try simulate key_up
and key_dow
for change highlighted item. highlighted item doesn't change.
void ComboBoxObject::rotate(direct int) // Left=-1, Right=1
{
QKeyEvent *event;
if(direct == 1){
event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up,Qt::NoModifier);
}
else{
event = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down,Qt::NoModifier);
}
bool result = QApplication::sendEvent(this,event);
}