Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Programming Keyboard Focus!



  • I have a tabbed interface and I can move between the tabs by using two push buttons named next and back. I want to control the keyboard focus to be on different buttons on different tabs.

    How do I do this?



  • I don't know if this is what you want, but I have a tabbed interface and an add button in my pages, I can press "Ctrl" + "+" and only the active tab respond

    @add=new QAction(this);
    connect(add, SIGNAL(triggered()), this, SLOT(slotAdd()));
    add->setShortcut(QKeySequence(tr("Ctrl++")));
    this->addAction(add);@

    Edit: I'm so sorry I misunderstand the question, you can set focus with
    @setFocus()@
    and a QTabWidget has a signal called @currentChanged@

    so you just have to acess a child of your new Widget and set the focus to it..


Log in to reply