Results 1 to 2 of 2

Thread: Reuse parts of designer-based qdialog

  1. #1
    Join Date
    Apr 2016
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Reuse parts of designer-based qdialog

    Hi,

    I've a complex qdialog (DialogA) that was created in Qt Designer. I need to reuse the essential qwidget of it (Section) in another qdialog (DialogB), that was manually programmed without any wysiwyg. My current approach is to extract Section to a own widget in Qt Designer and use this QWidget in DialogA and DialogB. Reimplementing it manually would be quite a hassle. First, is there a better approach to modularize forms?
    Second, how do I include the new widget Section into the original DialogA? Is there any way to say "add the widget from this ui-file at that position"? All tutorials for custom widgets I've found so far include manually coded widgets, not ui-file-based widgets.

    Best regards,
    derda17

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Reuse parts of designer-based qdialog

    Extracting something that you need multiple times into its own form/class makes a lot of sense.

    You can either use a place holder in the containing dialog, e.g. an empty QWidget, and then add the shared component in code, or use the "promote widget" feature.

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    derda17 (20th August 2020)

Similar Threads

  1. Qt Designer and id based translation
    By Gery in forum Qt Programming
    Replies: 5
    Last Post: 23rd January 2015, 14:12
  2. Replies: 1
    Last Post: 5th July 2012, 14:51
  3. Replies: 0
    Last Post: 20th February 2012, 05:39
  4. Replies: 2
    Last Post: 27th June 2007, 10:23
  5. Replies: 1
    Last Post: 22nd January 2007, 12:13

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.