Results 1 to 3 of 3

Thread: Cloning widgets for reuse

  1. #1
    Join Date
    Mar 2010
    Posts
    55
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Cloning widgets for reuse

    I have a GUI app that constantly changes its look based on user interaction. In particular, I have two areas, each of which will be replaced by a particular widget (actually a groupbox containing multiple fields) depending on the user's selection. Each of these areas *might* potentially contain the same widget, although different instances, so their members can be accessed separately.

    Is it possible to create a "widget template" from which I can create multiple instantiations, and use them wherever I wish? The alternative would be to create two of every possible groupbox + fields, which I'm not too thrilled about doing, since I could potentially have a lot of them.

    Thoughts?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Cloning widgets for reuse

    Create your custom widgets, example:
    A QWidget containing a groupbox, checkboxes, layouts, ...

    Then use a stacked widget to show all your custom widgets.

  3. #3
    Join Date
    Mar 2010
    Posts
    55
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cloning widgets for reuse

    Using a stacked widget doesn't solve my problem of having to reuse the widgets on one page in another page of the other stacked widget.

Similar Threads

  1. reuse QtDesigner?
    By nicolas1 in forum Qt Programming
    Replies: 5
    Last Post: 22nd March 2009, 14:00
  2. Cloning a QAction object
    By brazso in forum Qt Programming
    Replies: 3
    Last Post: 5th January 2009, 20:28
  3. QPainter reuse within a paintEvent
    By Micawber in forum Qt Programming
    Replies: 2
    Last Post: 2nd May 2008, 16:51
  4. Reuse a Qwidget with a QStackWidget
    By ucomesdag in forum Qt Programming
    Replies: 4
    Last Post: 25th April 2007, 02:47
  5. Reuse QT code in QTEmbedded
    By the_bis in forum Newbie
    Replies: 3
    Last Post: 8th September 2006, 18:03

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.