Results 1 to 2 of 2

Thread: Inheriting Custom Decorated Dialog

  1. #1
    Join Date
    May 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Inheriting Custom Decorated Dialog

    Hi,

    I'm trying to create a custom dialog with a border width and color. This dialog I want it to be inherited by others, so other developers don't have to deal with the border or other decorations we would need down the road.

    My first approach is to create a MyDialog : public QDialog, private Ui::MyCustomDialog (multiple inheritance way), since I want to be able to add stuff to it. One thing I think it should have is a place where to stick child widgets into. For example, an empty layout, where I would set the child widget into, so it resizes properly. The problem is that I have no idea on how to make ANY child widget to be inserted into the layout automatically.

    Any ideas? Thanks.
    -Daniel

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Inheriting Custom Decorated Dialog

    It's easiest if you just give your class a "setWidget" method accepting a widget instance. Then people can call that method passing a complete widget with layouts and child widgets. And the method would just place the received instance in a layout of the dialog. Similar thing is done by QScrollArea.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Creating a Custom FileOpen Dialog
    By cpsmusic in forum Newbie
    Replies: 14
    Last Post: 31st March 2014, 16:34
  2. [QCombobox] Display decorated value
    By mentalmushroom in forum Qt Programming
    Replies: 2
    Last Post: 16th May 2012, 06:41
  3. Replies: 5
    Last Post: 13th May 2011, 00:43
  4. Custom dialog
    By simol in forum Qt Programming
    Replies: 10
    Last Post: 1st April 2009, 17:25
  5. QListWidget inheriting custom class
    By phannent in forum Qt Tools
    Replies: 1
    Last Post: 4th August 2008, 14:39

Tags for this Thread

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.