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

  • SEARCH
  • Home
  • 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 7016101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:44:25+00:00 2026-05-27T22:44:25+00:00

I have a QTabWidget , where each tab has a QPlainTextEdit as its widget.

  • 0

I have a QTabWidget, where each tab has a QPlainTextEdit as its widget. So, how do I access each tab widget? How do I edit that widget?

  • 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-05-27T22:44:26+00:00Added an answer on May 27, 2026 at 10:44 pm

    You can use the widget function of QTabWidget in order to get the widget at the specified tab index.

    If the QPlainTextEdit is the only widget of every tab page then the returned widget will be that. Otherwise you need to get the children of the widget and find the QPlainTextEdit in them.

    QPlainTextEdit* pTextEdit = NULL;
    QWidget* pWidget= ui->tabWidget->widget(1); // for the second tab
    // You can use metaobject to get widget type or qobject_cast
    if (pWidget->metaObject()->className() == "QPlainTextEdit")
        pTextEdit = (QPlainTextEdit*)pWidget;
    else
    {
        QList<QPlainTextEdit *> allTextEdits = pWidget->findChildren<QPlainTextEdit *>();
        if (allTextEdits.count() != 1)
        { 
            qError() << "Error";
            return;
        }  
        pTextEdit = allTextEdits[0];
    }
    
    // Do whatever you want with it...
    ptextEdit->setPlainText("Updated Plain Text Edit);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application with various tabs (on a tabhost). Each tab is an
so I know that the TabWidget does not create new activities on each tab
I have created a tab host. Now when I set the background of each
I have a QTableWidget that has a combination of QLineEdit and normal table cell
I have a tab widget created with 3 tabs in it. I need to
I have a tab widget where every tab is a QTableView. I would like
I have Tab Layout that contains a TextView. I'd like to assign some text
I have noticed in my main.xml layout, I'm creating a Tab Layout, that the
I have a layout that is three linear layouts. The top has some icons
I have QTabWidget on my form and two tabs on it. These tabs have

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.