Results 1 to 2 of 2

Thread: Passing variable from tab to tab in QTabWidget

  1. #1
    Join Date
    Jul 2013
    Posts
    16
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Passing variable from tab to tab in QTabWidget

    I am newbie to QT and currently working on one QTabWidget which have two tabs means two widgets, as such

    Qt Code:
    1. tabWidget->addTab(new First_Widget(),tr("Home"));
    2. tabWidget->addTab(new Second_Widget(), tr("Download"));
    To copy to clipboard, switch view to plain text mode 

    First Widget have some integers and floats values which i want to use in the second widget. I can make a constructor of second widget like this

    Qt Code:
    1. tabWidget->addTab(new Second_Widget(argument1, argument2,argument3), tr("Download"));
    To copy to clipboard, switch view to plain text mode 

    and i think i can call second tab form the first widget but in that case the second tab will be hide until i don't click the respective button. Can anyone tell me how i can use first tab's values in the second.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Passing variable from tab to tab in QTabWidget

    Use signals and slots to synchronize widget values.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 6
    Last Post: 21st August 2013, 13:53
  2. connect() variable passing issue
    By hojoff79 in forum Newbie
    Replies: 6
    Last Post: 1st February 2011, 12:18
  3. Passing signals
    By gruszczy in forum Qt Programming
    Replies: 2
    Last Post: 16th July 2008, 15:19
  4. Replies: 3
    Last Post: 8th June 2007, 21:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.