October 18, 2011

winspear winspear
Lab Rat
13 posts

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?

1 reply

October 19, 2011

Iktwo Iktwo
Lab Rat
67 posts

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

  1. add=new QAction(this);
  2.     connect(add, SIGNAL(triggered()), this, SLOT(slotAdd()));
  3.     add->setShortcut(QKeySequence(tr("Ctrl++")));
  4.     this->addAction(add);

Edit: I’m so sorry I misunderstand the question, you can set focus with

  1. setFocus()

and a QTabWidget has a signal called
  1. currentChanged

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

 Signature 

By El Iktwo

 
  ‹‹ QTSDK4.7.4 MingW errors      Looking for technical tutorials for beautiful artistic GUI designing ››

You must log in to post a reply. Not a member yet? Register here!