SetFocus on tabwidget item
I have a main window with a QListWidget as menu and a QTabWidget as my main area.
When I click on a menu item on the listwidget I create my form and add it to the tabwidget.
This is the code used:
Code:
void MainWindow::openFormCateries()
{
if(m_formCategories == 0)
{
m_formCategories = new FormCategories(this);
ui->tabWidget->addTab(m_formCategories, tr("Categories"));
}
ui->tabWidget->setCurrentWidget (m_formCategories);
}
My problem is that I don’t know how to set the focus on the first editable item from the new created form added to the tab.
I have for example a QLineEdit in m_formCategories and want to set it as the active control.
I have tried set the focus on the constructor from m_formCategories whith ui->lineedit1->setfocus() but it dosen’t work.
Thanks,
Alex B.
Re: SetFocus on tabwidget item
Hi Alex,
I've the same problem with only with editing the values that are on that tab.
A lot of searching didn't brought me any solution.
So far is I know there is no solution for this problem.
I've made a different dialog for editing the values.
Please let me know if you find a solution for it.
Fabian
Re: SetFocus on tabwidget item
Hi Alex,
I suppose that you create the tab dynamically?
If so this thread will may help you.
http://www.qtcentre.org/threads/4536...ed-dynamically
Fabian