Quote Originally Posted by nish View Post
no. focus methods are only for widgets which are currently visible. You are doing it in the right way.
Thanks Nish, but what about this 2 methods:

Qt Code:
  1. previousInFocusChain (), nextInFocusChain ()
To copy to clipboard, switch view to plain text mode 

This 2 methods return Widget*. When I use them like this:
Qt Code:
  1. ui->stackedWidget->setCurrentWidget(ui->stackedWidget->previousInFocusChain());
To copy to clipboard, switch view to plain text mode 

But I get the following Application Output:
QStackedWidget::setCurrentWidget: widget 0x3eb2d8 not contained in stack


My main purpose is that I need a more general way of achieving this type of operations, instead of hard-coating the WidgetNames. Please help.