Results 1 to 2 of 2

Thread: Is there a way to group many widgets into one object?

  1. #1

    Default Is there a way to group many widgets into one object?

    I want to group a bunch of widgets, text fields, buttons, labels, etc., into one type of object that can be created and destroyed dynamically while the application is running; is the possible? If so, any quick words on where to get started? Thanks.

  2. #2
    Join Date
    Oct 2009
    Posts
    483
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanked 97 Times in 94 Posts

    Default Re: Is there a way to group many widgets into one object?

    Sure, just define a new widget class (derived from QWidget) and, in its constructor, populate it with all those child widgets and a layout manager. Then you can create as many instances of this compound widget as you want.

    To get started, see, for instance, the Calculator example in Qt; it defines a Calculator widget with several children. Or you could just create your widget in Design mode in Qt Creator and have it generate all the boilerplate code.

Similar Threads

  1. TypeError: Object [object Object] has no method 'sendData'
    By TheIndependentAquarius in forum Qt Quick
    Replies: 2
    Last Post: 30th November 2013, 06:54
  2. Shared Object class between multiple Widgets
    By vladozar in forum Qt Programming
    Replies: 9
    Last Post: 6th March 2012, 11:30
  3. Replies: 1
    Last Post: 8th November 2011, 23:27
  4. Replies: 4
    Last Post: 15th July 2011, 19:31
  5. passing a QPainter object to widgets
    By vratojr in forum Qt Programming
    Replies: 9
    Last Post: 11th January 2006, 16:27

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.