Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
SetFocus on widget in a new
abibiano last edited by
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:
if(m_formCategories == 0)
m_formCategories = new FormCategories(this);
} 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.
mohsen last edited by
@QWidget obj = (QWidget)m_formCategories->children().at(0);