Results 1 to 6 of 6

Thread: how to refer a dynamically added table widget inside a tab widget?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default how to refer a dynamically added table widget inside a tab widget?

    Hi,
    I created a tab widget using designer,
    Then added table widget inside the tab widget...(one table in every tab)
    Now i want to access the values of a particular table, for example that table headers....
    How can i get that????

    And if there is multiple tabs,i want headers of presently activated tabs, tables header...
    Please guide me....

  2. #2
    Join Date
    Oct 2011
    Posts
    160
    Thanks
    31
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how to refer a dynamically added table widget inside a tab widget?

    Please somebody look at this issue...!!

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: how to refer a dynamically added table widget inside a tab widget?

    Hi,

    You can use a QList of QTableWidget pointers. The index of the current Tab will point to the QTableWidget.
    In the constructor of your application you can fillup the QList.
    Òscar Llarch i Galán

  4. #4
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: how to refer a dynamically added table widget inside a tab widget?

    You should have pointer of you QTabWidget.
    Connect currentChanged( index ) signal from that widget to a slot that will do what you want when tab is changed.
    For example use QTabWidget::widget( index ) to get a current page widget and - if you don't have pointer to you table cached - iterate through its children looking for your table.

    Simpler may be to create a cache of table pointers indexed the same as pages they are on.

    Look at Qt Documentation for QTabWidget and all you need to know is there.

Similar Threads

  1. Qt Designer Size of table widget inside Tab Widget is not flexible.
    By akash in forum Qt Tools
    Replies: 2
    Last Post: 14th September 2011, 11:45
  2. Replies: 8
    Last Post: 28th June 2011, 14:57
  3. Replies: 0
    Last Post: 27th July 2010, 12:48
  4. Replies: 1
    Last Post: 14th November 2008, 02:59
  5. How to remove widget added in runtime?
    By jiveaxe in forum Qt Programming
    Replies: 7
    Last Post: 2nd November 2007, 10:13

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.