Results 1 to 8 of 8

Thread: How to "lock" a new qdialog in another qdialog

  1. #1
    Join Date
    Jul 2008
    Posts
    66
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default How to "lock" a new qdialog in another qdialog

    Hi,

    my main window (qdialog) has a tab-widget. Each Tab has its own dialog.

    Each dialog in my tab-widget represents an individual Object in nature.
    When the object in nature makes problems, my program gets this information and forwards this information to its dialog in the tab-widget.

    I want to be able to show a MessageBox or a Dialog in the "natural-objects dialog".
    When the user goes through the tabs he will see on TAB X that "natural object X" had a problem. But he should not see this information somewhere else...just in "TAB X".

    I tried it with QMessageBox but I failed..
    I made it non-modal but it was always outside the "tab-dialog". I want to lock it to that window, so the user can visit the other dialogs in the tab without beeing disturbed.


    What can I do?

  2. #2
    Join Date
    Jul 2008
    Posts
    66
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to "lock" a new qdialog in another qdialog

    any ideas? or sth not understandable?

  3. #3
    Join Date
    Jan 2006
    Posts
    132
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to "lock" a new qdialog in another qdialog

    How about adding for example a normaly empty QLabel (for example with red foreground color) at the top of bottom of each form, and in case of error write a message ito it?

    Another solution would be Dialogs for every tab which you hide/show when tabs change, for example using the signal QTabWidget::currentChanged(int)

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

    Default Re: How to "lock" a new qdialog in another qdialog

    By the term "dialog" do you mean a QDialog (top-level window, short-lived, possibly modal to its parent) or a "widget"? A screenshot might clear things out...

  5. #5
    Join Date
    Jul 2008
    Posts
    66
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to "lock" a new qdialog in another qdialog

    Hi,


    with dialog i really mean QDialog.

    The pages of my Tabs are self-made derived classes (of QDialog).

    And what I want to show is a QMessageBox or a QDialog.
    It doesnt matter....The main goal is that the user sees an alert in the middle of the screen of each QDialog(in the tab).




  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to "lock" a new qdialog in another qdialog

    You can emit a signal from one of your tab widget, and connect it to main window.
    Main Window can then display the error message .

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

    Default Re: How to "lock" a new qdialog in another qdialog

    Based on the screenshot I see you mean a widget after all The fact that you are using QDialog there only means you shouldn't be doing that. And I would advise against using QMessageBox or similar in the same fashion. Do it properly and create a plain QWidget (like QLabel or sth) just don't put it in the layout with other widgets of the tab. Instead use setGeometry to set its geometry to the centre of the tab's widget.

  8. The following user says thank you to wysota for this useful post:

    donglebob (4th February 2009)

  9. #8
    Join Date
    Jul 2008
    Posts
    66
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to "lock" a new qdialog in another qdialog

    Thanks for you hints..

    You mean I should create a QLabel for my error message (while runtime).
    Use the setgeometry of it to place it in the tab I want,..right?

    I will try this....thanks

Similar Threads

  1. Resizing a QDialog to the content size
    By Nyphel in forum Qt Programming
    Replies: 8
    Last Post: 15th March 2007, 08:16

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.