mardi 21 avril 2015

Qt need help to disable scroll on combobox

Hello I need help to turn off scrool on combobox , I have written some code but I get error, can someone help me

list << ui->comboBox << ui->comboBox_2 << ui->comboBox_3;

for(i =0 ; i<list.count();i++)
{
    list[i]->installEventFilter(this);
    list[i]->setFocusPolicy(Qt::StrongFocus);



}

bool MainWindow::eventFilter(QObject * o,QEvent * e) {

if(e->type() == QEvent::Wheel && o == list.at(i) )
{
    return true;

}
return false;

} When i run program i get this Error ASSERT failure in QList::at: "index out of range"

Aucun commentaire:

Enregistrer un commentaire