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. Problem in clearing the tab from tabwidget
QtWS25 Last Chance

Problem in clearing the tab from tabwidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.2k Views
  • 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.
  • I Offline
    I Offline
    Indrajeet
    wrote on last edited by
    #1

    Hi

    I have added a tab widget in my ui file.
    In one of the tab of this tab widget I am dynamically creating the another tabwidget.
    This creation of dynamic tabwidget I am doing on some button click SLOT.
    So I want to remove or clear the tab each time the button is clicked and then create the tabwidget inside tab dynamically.

    How to do this?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      b1gsnak3
      wrote on last edited by
      #2

      Do you mean you have double tab widgets (tab widget inside a tab of a tabwidget)? Or do you mean you are removing one tab from your tabwidget and adding another one?

      1 Reply Last reply
      0
      • JeroentjehomeJ Offline
        JeroentjehomeJ Offline
        Jeroentjehome
        wrote on last edited by
        #3

        Hmm, Maybe a strange way of doing things, but why a tab widget in a tab widget. Isn't it better to have a listwidget in the tab and add/remove items there, use the selected slots there to select the stackedwidget item to display next to it. That is probably much more common and user friendly. But to get to the question asked. the tabWidget is easily created with
        @QTabWidget dynTab = new QTabWidget(ui->tabWidget);@
        The dynamic tab needs to be hold by a layout or a frame to be added to the main tabwidget IYAM.
        The insert new tabs to it and all done. Remember that remove tab doesn't really remove the widget it holds!! You have to remove the allocated memory yourself (or wait for the program to be closed, it will be done then) or keep it in memory and add it again to the tabwidget if needed.
        (not tested this idea, but hopes this gives some help)
        Greetz

        Greetz, Jeroen

        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