Results 1 to 13 of 13

Thread: Qdialog as a child widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Qdialog as a child widget

    Quote Originally Posted by wysota View Post
    it doesn't make much sense to do so.
    Are you sure?
    QDialog::QDialog ( QWidget * parent = 0, Qt::WindowFlags f = 0 )
    Constructs a dialog with parent parent.
    A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent. It will also share the parent's taskbar entry.
    The widget flags f are passed on to the QWidget constructor. If, for example, you don't want a What's This button in the title bar of the dialog, pass Qt::WindowTitleHint | Qt::WindowSystemMenuHint in f.
    See also QWidget::setWindowFlags().

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

    Default Re: Qdialog as a child widget

    Quote Originally Posted by jacek View Post
    Are you sure?

    QDialog::QDialog ( QWidget * parent = 0, Qt::WindowFlags f = 0 )
    Constructs a dialog with parent parent.
    A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent. It will also share the parent's taskbar entry.
    The widget flags f are passed on to the QWidget constructor. If, for example, you don't want a What's This button in the title bar of the dialog, pass Qt::WindowTitleHint | Qt::WindowSystemMenuHint in f.
    See also QWidget::setWindowFlags().
    The abstract you refer to (probably) means top-level widgets. I was referring to centering over child widgets of top-level widgets (for example centering over a dialogs button).

    The author of the thread wishes to centre over a widget which is a child of QWorkspace (hence it's not a top-level widget) which seems to confirm my assumptions.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Qdialog as a child widget

    Quote Originally Posted by wysota View Post
    The abstract you refer to (probably) means top-level widgets.
    It isn't an abstract, but a direct quote from documentation.

    Quote Originally Posted by wysota View Post
    I was referring to centering over child widgets of top-level widgets (for example centering over a dialogs button).
    Me too and it worked like this in previous versions. It appears that this behavior was changed and the docs are inconsistent:

    "Detailed Description" says:
    A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent's top-level widget (if it is not top-level itself).
    While QDialog constructor docs say:
    A dialog is always a top-level widget, but if it has a parent, its default location is centered on top of the parent.
    In other words: there's a bug in QDialog docs.

  4. #4
    Join Date
    Jan 2006
    Posts
    52
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12

    Default Re: Qdialog as a child widget

    So if this is the default behavior. is there any way for me to create a modal widget that will center on top of it's parent?
    Using regular widget is no good because I need the dialog to run till it will return from the widget like the exec() function does.

    Thanks

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Qdialog as a child widget

    Quote Originally Posted by dave View Post
    So if this is the default behavior. is there any way for me to create a modal widget that will center on top of it's parent?
    You will have to move it there, but after the dialog was shown.

  6. #6
    Join Date
    Jan 2006
    Posts
    52
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12

    Default Re: Qdialog as a child widget

    But what I'm looking for is a behavior like Qt::WindowModal.
    I want that only that parent widget which called the dialog will be blocked and all the other widgets will be free to move and pick and work with.

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

    Default Re: Qdialog as a child widget

    If you mean the children of QWorkspace then I doubt you can do this as these are not really windows, so they can't be blocked independently of each other - you'd have to block the whole window containing the workspace.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Qdialog as a child widget

    There was a similar issue with Qt3 and it was treated as a bug: http://www.trolltech.com/developer/t...entry&id=67471

    So maybe you should ask the Trolls, if it should behave like it behaves now?

  9. #9
    Join Date
    Jan 2006
    Posts
    52
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    12

    Default Re: Qdialog as a child widget

    wysota
    I've a small program which create an lsystem 2d curves based on a literal string. I can save this then as images and I get a dialog which ask me to choose image quality. I'd like that dialog to block only the widget to which it belongs and not all the other widgets in the program.

    jacek
    I've seen this in the docs, but it doesn't apear to work for me .

Similar Threads

  1. how to find a child widget?
    By TheRonin in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2006, 10:30
  2. Replies: 1
    Last Post: 28th July 2006, 14:10
  3. minimize child widget
    By sreedhar in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2006, 12:02
  4. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00
  5. Referencing Parent Widget from Child
    By taylor34 in forum Qt Programming
    Replies: 8
    Last Post: 11th April 2006, 15: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
  •  
Qt is a trademark of The Qt Company.