Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How to access "textEdit" using "topLevelWidget()"?
Qt 6.12 LTS is out! See what's new in the release blog

How to access "textEdit" using "topLevelWidget()"?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
2 Posts 2 Posters 712 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    This is a repost, and I am hoping it will lead to
    t he solution.

    Here is QDesigner view of the object GUI layout. My objective is to gain access to the first "tab" member "textEdit" using the object " top LevelWidget" member.

    In pseudo code :
    while top LevelWidget != QTextEdit
    if found QTextEdit
    append "TEST TEXT"

    My object is defined:

    MainWindow_C_CODE_FORM *MWCCF = new MainWindow_C_CODE_FORM();

    8a6b9869-5529-4138-a4eb-af4a41c55721-image.png

    JonBJ 1 Reply Last reply
    0
    • A Anonymous_Banned275

      This is a repost, and I am hoping it will lead to
      t he solution.

      Here is QDesigner view of the object GUI layout. My objective is to gain access to the first "tab" member "textEdit" using the object " top LevelWidget" member.

      In pseudo code :
      while top LevelWidget != QTextEdit
      if found QTextEdit
      append "TEST TEXT"

      My object is defined:

      MainWindow_C_CODE_FORM *MWCCF = new MainWindow_C_CODE_FORM();

      8a6b9869-5529-4138-a4eb-af4a41c55721-image.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @AnneRanch

      QTextEdit *textEdit = mainWindow->centralWidget()->findChild<QTextEdit *>();
      if (textEdit)
          textEdt->append("TEST TEXT");
      else
          qDebug() << "Did not find any QTextEdit";
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved