Results 1 to 2 of 2

Thread: how to interact with tabs in qt

  1. #1
    Join Date
    May 2011
    Posts
    21
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Symbian S60

    Default how to interact with tabs in qt

    Actually i have created three tabs in my app..now on selecting each tab i want to open a new form on that particular tab..the code i have written for creating tabs...

    Qt Code:
    1. tabWidget = new QTabWidget;
    2. QWidget* pCalender = new QWidget;
    3. QWidget* pHistory = new QWidget;
    4. QWidget* pStatistics= new QWidget;
    5. tabWidget->addTab(pCalender,tr("Calender"));
    6. tabWidget->addTab(pHistory,tr("History"));
    7. tabWidget->addTab(pStatistics,tr("Statistics"));
    To copy to clipboard, switch view to plain text mode 

    now i have three forms.

    1.calendar.cpp

    2.history.cpp

    3.statistic.cpp

    now what i want is onclick of each tab i want to open each of the form in particular tab...ie calendar form on tab1...history form on tab2 and statistic form on tab 3..so anyone please suggest me how that can be done...

    with regards
    Rahul

  2. #2
    Join Date
    Aug 2009
    Location
    Belgium
    Posts
    310
    Thanks
    10
    Thanked 31 Times in 25 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to interact with tabs in qt

    Hi,
    See this thread : QStackedWidget-and-QTabWidget-Structure-Advice.

    It does what you want I think : you have different forms created somehow, and you want each to show in a page of a tab sheet.

    Note that for simple tabs, you can just add all your widgets to the QTabWidget that is returned by addTab. Or just use Qt Designer, define some tab pages, and drag the widgets onto the tab pages.

    Best regards,
    Marc

Similar Threads

  1. Replies: 3
    Last Post: 20th November 2014, 07:10
  2. Using QtScript to interact with blocking modal dialogs
    By divad12 in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2011, 08:40
  3. QTabWidgetexpand tabs
    By alexandernst in forum Newbie
    Replies: 1
    Last Post: 17th May 2010, 16:36
  4. Color Tabs
    By FoleyX90 in forum Newbie
    Replies: 20
    Last Post: 1st May 2010, 00:28
  5. Replies: 1
    Last Post: 19th March 2010, 10:19

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.