This is my UI:

This is tab created programmatically:
ui->tabWidget->addTab(new QWidget(), "Tab 2");

I want the newly created tab to have the exact same layout as the “Chat room” tab has. Any advice on how to do this would be great.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The easiest way to do this (in Designer) is to create a new UI Form Class called something like
ChatTaband base it onQWidget.Move (i.e., cut and paste) your chat room widgets and layout from your MainWindow UI form to the ChatTab form, but leave the
QTabWidgetcontainer in your MainWindow form. If you want a chat room to be in your main window when it first opens, promote its firstQWidgetto aChatTabfrom inside Designer.Any additional tabs should be added programatically like so:
Add fancy stuff to the ChatTab constructor if you want to make your life easier.