Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:28:11+00:00 2026-06-18T06:28:11+00:00

I working on one application and I have problem with tab name. When I

  • 0

I working on one application and I have problem with tab name.
When I click on push button (NEW) I want to dynamically create new tab.

With this function i create new file:

bool MainWindow::toolbarNewFile()
{

    QWidget *page = new QWidget;

    QTextEdit *codeEditor = new QTextEdit;

    QGridLayout *layout = new QGridLayout;

    layout->addWidget(codeEditor);

    page->setLayout(layout);

    tab_widget->addTab(page,"File");

    return true;
}

But all tabs have name “FILE”

How to set in tab name number. When i make new tab auto set number of the tab like this.

File-1, File-2, File-3

I try to set counter i=0; and in addTab(page,"File-"+ i++); Doesn’t work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:28:12+00:00Added an answer on June 18, 2026 at 6:28 am

    You need to covert integer to the QString to be able to concat it to the QString. Even better, you can use QString::arg function and get readable and potentially faster code very easily:

    tab_widget->addTab(page, QString("File-%1").arg(i++));
    

    Where i is field in your class initialized to 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this problem, I've got a navigation-based application, and on the one of
I have created one native application in android that is working fine. This application
I have one web application which I have been working for some time.I am
hello i have created one windows application in c# .net and its working fine
I have web application Project having RPC call. one RPC async is working fine.
In one of the iPad Application, I am working I have added custom views
I have an ASP.NET application I am working on. One of the requirements of
I am working with an ASP.NET MVC application. I have one master page having
I'm working on an iPhone application. I'm using Storyboard. I wanted to have one
I am having a very confusing problem with an application I have been working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.