Results 1 to 2 of 2

Thread: How To Access To Child's Of A Tab

  1. #1
    Join Date
    Nov 2008
    Posts
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How To Access To Child's Of A Tab

    Hi!
    How i can access to a child widget of a tab???
    for example
    I have 3 tab. in all tabs i have placed a Button named New
    i need to access to New Button from Code.
    i have tried this code but...!

    Qt Code:
    1. for(int i=0; i < this->tabwidget->count(); i++)
    2. {
    3. this->tabwidget->widget(i)->btnNew->setEnabled(false);
    4. }
    To copy to clipboard, switch view to plain text mode 

    Please Help Me!
    Thanx.
    Last edited by jpn; 14th December 2008 at 17:28. Reason: missing [code] tags

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How To Access To Child's Of A Tab

    you nee to cast QWdiget to your own widget and then you will get access to needed methods, i.e.
    Qt Code:
    1. ...
    2. for (int i = 0; i < tabwidget->count(); ++i) {
    3. MyWidget *mw = qobject_cast<MyWidget *>(tabwidget->widget(i));
    4. if (mw)
    5. mw->btnNew->setEnabled(false);
    6. }
    7. ...
    To copy to clipboard, switch view to plain text mode 
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Access an object stored in the list.
    By cbarmpar in forum General Programming
    Replies: 2
    Last Post: 21st September 2008, 20:19
  2. Error in connecting to MS ACCESS
    By cutie.monkey in forum Qt Programming
    Replies: 0
    Last Post: 9th September 2008, 02:10
  3. ODBC and MS Access
    By allensr in forum Qt Programming
    Replies: 2
    Last Post: 10th April 2007, 23:41
  4. Replies: 1
    Last Post: 4th October 2006, 16:05
  5. Replies: 5
    Last Post: 14th July 2006, 22:42

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.