Results 1 to 6 of 6

Thread: typecast of QWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    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: typecast of QWidget

    try this
    Qt Code:
    1. ...
    2. QList<QWidget *> wlist = widget->findChildren<QWidget *>();
    3. QLabel *label = qobject_cast<QLabel *>(wlist.at(0));
    4. if (!label)
    5. return;
    6. label->setText("some text");
    7. ...
    To copy to clipboard, switch view to plain text mode 
    Last edited by spirit; 11th August 2009 at 12:13.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  2. The following user says thank you to spirit for this useful post:

    wagmare (11th August 2009)

Similar Threads

  1. Promoting the parent QWidget of a QWidget form
    By extrakun in forum Qt Tools
    Replies: 6
    Last Post: 16th April 2010, 14:19
  2. Replies: 0
    Last Post: 11th November 2008, 15:36
  3. Dynamic updates of a QWidget in a QScrollArea
    By plamkata in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2008, 23:45
  4. Error in put one QWidget in another QWidget
    By xjtu in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2008, 16:05
  5. Replies: 3
    Last Post: 8th March 2007, 14:54

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
  •  
Qt is a trademark of The Qt Company.