Focus inside QComboBox
Unsolved
General and Desktop
-
Hello!
I have an application that is handled with a joystick.
I have a list of parameters and one of this parameters is a QComboBox. I am simulating the joystick positions with the letters 'a' (left movement), 'd' (right movement), 'w' (up movement), 's' (down movement) and 'f' (enter).
There is an eventFilter in which I do all but, when I enter in the QComboBox, I can't navigate between its options. How can I give the focus to the QComboBox entries?
Thank you very much!
-
If your questions is how to get certain things inside a QcomboBox for you to select as a dropdown - this should work:
QComboBox combo; QObject::connect(&combo, &QComboBox::currentTextChanged, [&]{ std::cout << combo.currentText().toStdString() << std::endl; }); for (auto const & info : [whatever the variable is you want to parse goes here]) ui->comboBox->addItem([the variables you parsed get added here], 0);
For example I used this to get all the cameras that are plugged in to my PC:
QComboBox combo; QObject::connect(&combo, &QComboBox::currentTextChanged, [&]{ std::cout << combo.currentText().toStdString() << std::endl; }); for (auto const & info : QCameraInfo::availableCameras()) ui->comboBox->addItem(info.description(), 0);
-