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. Add widgets in distinct tabs
Forum Updated to NodeBB v4.3 + New Features

Add widgets in distinct tabs

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 1.4k 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
    mohamaddanesh44
    wrote on 29 Aug 2013, 14:24 last edited by
    #1

    i have some widgets and a QTabWidget with 3tabs.
    how can i add a specific widget to a specific tab (not all the tabs)?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 29 Aug 2013, 19:28 last edited by
      #2

      Hi,

      Do you mean add a new widget to the widget in a given tab ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mohamaddanesh44
        wrote on 31 Aug 2013, 05:27 last edited by
        #3

        no no, i already have some widgets ( e.g. widget1, widget2, widget3) and some tabs (e.g. tab1,tab2,tab3) .
        i want widget1 to add to tab1,
        widget2 to tab2,
        widget3 to tabs3.

        what i could did was add widget1 to tab1,tab2,tab3.

        how can i add widget1 to only tab1?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          angelicaP
          wrote on 5 Sept 2013, 16:20 last edited by
          #4

          if you post some code, maybe somebody will be able to look through and give you a hint.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Buckets
            wrote on 5 Sept 2013, 18:04 last edited by
            #5

            You can do it a couple of ways.
            If you have already created widgets that you want to display as a their own tab, then
            @
            QTabWidget *tab_widget;
            QWidget *tab_one;
            QWidget tab_two;
            tab_widget = new QTabWidget;
            tab_one = new QWidget();
            tab_two = new QWidget();
            /

            do stuff to tab_one and tab_two
            */
            tab_widget->addTab(tab_one,"One");
            tab_widget->addTab(tab_two,"Two");
            @
            If you already have tabs (tab1, tab2, ..., tabn) you can use those as parents for your widgets
            @
            QLabel hi_label("hi", tab1);
            @

            Hopefully this helps

            ba ba ba
            ba na na na

            1 Reply Last reply
            0

            1/5

            29 Aug 2013, 14:24

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved