Component::createKeyboardFocusTraverser() return type

I’m trying to update an older piece of code where I’ve derived my own class from KeyboardFocusTraverser and used:

KeyboardFocusTraverser* SearchDlgWorkArea::createFocusTraverser()
{
    return new CustomKeyboardFocusTraverser (this);
}

Shouldn’t

virtual std::unique_ptr<ComponentTraverser> createKeyboardFocusTraverser();

be

virtual std::unique_ptr<KeyboardFocusTraverser> createKeyboardFocusTraverser();

?

Thanks,

Rail

KeyboardFocusTraverser inherits from ComponentTraverser, so you should still be able to make your CustomKeyboardFocusTraverser type work. Does something like this work for you?

std::unique_ptr<ComponentTraverser> SearchDlgWorkArea::createFocusTraverser()
{
    return std::make_unique<CustomKeyboardFocusTraverser> (this);
}
1 Like

Yes it does - thanks… I’d got my syntax wrong when trying that.

Rail