MCPcopy Create free account
hub / github.com/davy7125/polyphone / eventFilter

Method eventFilter

sources/editor/editor.cpp:713–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

711}
712
713bool Editor::eventFilter(QObject *obj, QEvent *event)
714{
715 if (obj == ui->editFilter && event->type() == QEvent::KeyPress)
716 {
717 QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
718 if (keyEvent->key() == Qt::Key_Up)
719 {
720 // Select the first element in the list (if any)
721 if (ui->treeView->model() && ui->treeView->model()->rowCount() >= 4)
722 {
723 QModelIndex indexRootPrst = ui->treeView->model()->index(3, 0);
724 if (ui->treeView->model()->rowCount(indexRootPrst) > 0)
725 {
726 ui->treeView->setFocus();
727 ui->treeView->setCurrentIndex(ui->treeView->model()->index(ui->treeView->model()->rowCount(indexRootPrst) - 1, 0, indexRootPrst));
728 }
729 }
730 return true;
731 }
732 }
733
734 return Tab::eventFilter(obj, event);
735}

Callers

nothing calls this directly

Calls 3

typeMethod · 0.80
rowCountMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected