Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to identify / select cascaded QTab(s) ?
Qt 6.11 is out! See what's new in the release blog

How to identify / select cascaded QTab(s) ?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 348 Views 2 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

    Using QDesigner I have build "cascaded" QTabs - I have main / parent QTab and some of them contain another / child QTab(s) .

    My task is to switch from main QTab page to selected child QTab page.

    Main QTab contains other widgets, not just child QTab.
    Iterating thru the main QTab is trivial, however, I am stumped on how to actually identify the widgets in child QTabs.

    In pseudocode

    iterate all widgets in current page
    does the widget == QTabWidget ?
    yes - read the widget ( index, name etc.)

    See attached

        // interate main tab 
        for (int index = 0; index < ui->tabWidget->count();  index++)
        {
        // "parent " QTab    
        ui->tabWidget->setCurrentIndex(index);
        ui->tabWidget->currentWidget();
       //  find child QTab in parent QTab page 
        // iterate  "child  " QTabs 
        for (int index = 0; index < widget ????->count();  index++)
        {
        .... is widget == QTabWidget ??
    
    M 1 Reply Last reply
    0
    • A Anonymous_Banned275

      Using QDesigner I have build "cascaded" QTabs - I have main / parent QTab and some of them contain another / child QTab(s) .

      My task is to switch from main QTab page to selected child QTab page.

      Main QTab contains other widgets, not just child QTab.
      Iterating thru the main QTab is trivial, however, I am stumped on how to actually identify the widgets in child QTabs.

      In pseudocode

      iterate all widgets in current page
      does the widget == QTabWidget ?
      yes - read the widget ( index, name etc.)

      See attached

          // interate main tab 
          for (int index = 0; index < ui->tabWidget->count();  index++)
          {
          // "parent " QTab    
          ui->tabWidget->setCurrentIndex(index);
          ui->tabWidget->currentWidget();
         //  find child QTab in parent QTab page 
          // iterate  "child  " QTabs 
          for (int index = 0; index < widget ????->count();  index++)
          {
          .... is widget == QTabWidget ??
      
      M Offline
      M Offline
      mpergand
      wrote on last edited by mpergand
      #2

      @AnneRanch said in How to identify / select cascaded QTab(s) ?:

      ui->tabWidget->setCurrentIndex(index);
      ui->tabWidget->currentWidget();

      Can be replaced by:
      QWidget* widget=ui->tabWidget->widget(index);

      To find child tab you can use:
      QTabWidget* child= widget->findChild<QTabWidget *>();

      A 1 Reply Last reply
      0
      • M mpergand

        @AnneRanch said in How to identify / select cascaded QTab(s) ?:

        ui->tabWidget->setCurrentIndex(index);
        ui->tabWidget->currentWidget();

        Can be replaced by:
        QWidget* widget=ui->tabWidget->widget(index);

        To find child tab you can use:
        QTabWidget* child= widget->findChild<QTabWidget *>();

        A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        @mpergand Thanks for reply. I got it all figured out.
        SOLVED

        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 Extensions
        • Unsolved