Results 1 to 9 of 9

Thread: What do you prefer: dynamically or statically create objects?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: What do you prefer: dynamically or statically create objects?

    Quote Originally Posted by IrYoKu View Post
    AFAIK, you can add wigets without parent into QLayout objects, and they convert from top level windows into normal widgets.
    ...by reparenting the widget (see the attached example).

    Edit: And another example:

    Qt Code:
    1. #include <QApplication>
    2. #include <QWidget>
    3.  
    4. int main(int argc, char **argv){
    5. QApplication app(argc, argv);
    6. // QWidget c1;
    7. QWidget top;
    8. QWidget c1;
    9. c1.setParent(&top);
    10. return 0;
    11. }
    To copy to clipboard, switch view to plain text mode 
    Try running this app and then run it again after uncommenting 6th and commenting the 8th line of this snippet. Compare results.
    Attached Files Attached Files
    Last edited by wysota; 20th April 2007 at 00:44.

Similar Threads

  1. dynamically create folders with QT
    By eleanor in forum Newbie
    Replies: 3
    Last Post: 13th March 2007, 11:40

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.