Results 1 to 8 of 8

Thread: MDI Application

  1. #1
    Join Date
    May 2009
    Posts
    14
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default MDI Application

    Hi,



    please help me, I am begginer using Qt, and i have to do a MDI Application, my application will have a main interface, and several subwindows, and i am using mdiArea. At the beggining the application shows one subwindow but the other should be hidden, and i don´t know how to do this. After pressing some buttons the rest of the subwindows will appear. I have design the subwindows with Qt Designer, adding to the main interface a mdiArea and then subwindows. Please help me, because a i have try a lot of things, and i haven´t got what i want.

    Sorry for my english.

    Thanks.

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

    Default Re: MDI Application

    Did you try QWidget::hide()?
    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.


  3. #3
    Join Date
    May 2009
    Posts
    14
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MDI Application

    The problem is, at the beggining of the aplication, one subwindow is showed, this subwindow can be opened with a button in the menu bar, but the problem is that if i close that subwindow, and i click on the button of the menu bar, nothing happens. My code is this:

    Qt Code:
    1. void Interfaz::crearInicio(){
    2.  
    3. Inicio *sub_inicio = new Inicio;
    4. mdiArea->addSubWindow(sub_inicio);
    5. sub_inicio->setAttribute(Qt::WA_DeleteOnClose);
    6. mdiArea->setActiveSubWindow(qobject_cast<QMdiSubWindow *>(sub_inicio));
    7. sub_inicio->showMaximized();
    8. }
    9.  
    10. void Interfaz::crearAcciones(){
    11.  
    12. connect (ui.inicioAct, SIGNAL(triggered()), this, SLOT (crearInicio()));
    13.  
    14. }
    To copy to clipboard, switch view to plain text mode 

    ui.inicio is the button in the menu bar.
    Last edited by wysota; 8th May 2009 at 12:24. Reason: reformatted to look better

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

    Default Re: MDI Application

    Please provide a minimal compilable example reproducing the problem.
    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.


  5. #5
    Join Date
    May 2009
    Posts
    14
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MDI Application

    I have solved the problem, thank you very much.
    Last edited by martisho; 8th May 2009 at 13:04.

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

    Default Re: MDI Application

    Please use the [code] tags and not [qtclass] tags.

    Please craft an example code consisting of the main() function and the minimum functionality from your application that reproduces the problem. Make it that calling qmake and make results in a valid executable application.
    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.


  7. #7
    Join Date
    May 2009
    Posts
    14
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MDI Application

    Hi again,

    i have 5 kinds of subwindows in my application, what i want to do is to check that the application doesn´t open a subwindows if there is a subwindows open of the same kind.

    Please help me.

    Thank you.

    Could you put some general code please?

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

    Default Re: MDI Application

    Quote Originally Posted by martisho View Post
    Could you put some general code please?
    No, this task is so easy you will surely manage to do it yourself. Just store a pointer to the subwindow you create and when you are to open the window again, see if the pointer is valid or not. If so, it means the window is there (although it may be hidden so you might want to show() and raise() it).
    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. Qt Application + Web Integration -- Help needed
    By swamyonline in forum Qt Programming
    Replies: 0
    Last Post: 17th February 2009, 11:59
  2. Tool for web application?
    By cool_qt in forum General Programming
    Replies: 3
    Last Post: 9th December 2008, 09:21
  3. Loading library from application
    By mourad in forum Installation and Deployment
    Replies: 0
    Last Post: 2nd April 2008, 15:10
  4. dll + application
    By fpujol in forum Qt Programming
    Replies: 11
    Last Post: 15th April 2007, 18:37

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.