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. Newbie Qtabwidget Question
Forum Updated to NodeBB v4.3 + New Features

Newbie Qtabwidget Question

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 3.2k 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.
  • M Offline
    M Offline
    MFreeM
    wrote on last edited by
    #1

    Hi Guys,

    I'm a newb, and wondering how to deal with QtabWidget. I've got two seporate Qdialog subclasses which i'd like to try and add onto two different tabs. Both subclasses have been created using the designer.

    I'm a total loss as to how to do this or where to look for info about doing it.

    could anyone please advise or point me in the direction of a tutorial that does something similar.

    Thanks in advance.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ludde
      wrote on last edited by
      #2

      Normally, you would just create the tabwidget, create the widgets you want to put in it as tabs, and add them to the tabwidget using the addTab() function.

      But, you say you have two QDialog subclasses. Having QDialog subclasses in a tabwidget might be possible, but seems a bit strange to me. Why are they QDialog subclasses and mot just QWidget subclasses?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        A QDialog (and subclasses thereof) are meant as top level windows. That means that there is no (easy) way to add those to separate pages in a tab widget.

        You should have based the two contents pages off off QWidget, not QDialog, and use those instead. The QWidget based pages can then be added to the dialog using widget promotion. Alternatively, you can just copy/paste the contents of your separate dialogs to the contents of the QTabsWidget pages you want to context on. Don't forget to apply a layout on each page.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          ludde
          wrote on last edited by
          #4

          If you want to look at some code that uses QTabWidget, have a look at the "tabdialog":http://doc.qt.nokia.com/latest/dialogs-tabdialog.html example.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            MFreeM
            wrote on last edited by
            #5

            Thanks for this - I think i'll use QWidget instead of QDialog as a parent class. However, i have managed to get it working but the size is just a little weird. It cuts off 3 quarters of my dialog window so i have to manually resize this each time the app is run.

            I'm hoping that using QWidget instead of QDialog will sort this..

            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