Results 1 to 10 of 10

Thread: Issues updating to QMdiArea

  1. #1
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Issues updating to QMdiArea

    Hey everyone. I just updated one of my programs from using QWorkspace to QMdiArea, and I am having a couple of issues. When I call a form inside the MDIArea, the window comes up, but it is just small bit of the title bar, with the Min/Max/Close buttons. I can then resize the window to what it should be, but that is a pain. I tried doing setFixedSize, but that did not work, it is still just the small title bar.

    Here is how I am calling the form:
    Qt Code:
    1. void nnDBSMainWindow::formView()
    2. {
    3. nnDBSPieceViewForm *pieceViewForm = new nnDBSPieceViewForm;
    4. MDIArea->addSubWindow(pieceViewForm);
    5. pieceViewForm->setAttribute(Qt::WA_DeleteOnClose);
    6. pieceViewForm->show();
    7. }
    To copy to clipboard, switch view to plain text mode 

    Also, now that I have changed it to QMdiArea, a Close button I created on the form just wipes the form away, and keeps the window open. I have to click the X close button in the upper right corner.

    Can anyone help me with this? I really don't want to go back to QWorkspace, since it is obsolete, and will be deprecated in the next version of Qt, according to the docs.

    Thanks in advance!
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  2. #2
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    Hi,

    Try use: pieceViewForm->showMaximized();

    []s

  3. #3
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    Hi (again..)

    I forgot. Don't use a pushButton to close a subwindow, use the 'X' button. This is the correct way.

  4. #4
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    Well, the showMaximized() worked just fine, but that removes the whole meaning of an MDI Area. Not having a close pushbutton, that is just crazy in my mind. If this is the truth about these issues, I will have to either go back to QWorkspace, or, bite my tongue, move over to GTK. I mean heck, I donate all the time to KDE.

    Please, I really love Qt, please help me if anyone can.

    Thanks in advance!
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    Not having a close pushbutton, that is just crazy in my mind.
    Why?
    Name one respectable MDI application that has close buttons in the inner forms.
    MSVC, KDevelop and many other, have just the 'X' button for the forms.
    'Close' buttons in a form is for dialogs.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  6. #6
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    Lotus Notes. I am trying to somewhat model the database application idea for my program. My program is to track music scores and compositions. It is supposed to allow you to enter a new score, view a table of the database, view the entry or other entries in a form format. That is why I would like a close pushbutton. Heck when I was designing database apps at IBM, we always used a close pushbutton. Like in Lotus Notes, I want to give the user 3 different ways to perform a function. CTRL+W, a close push button, or the X close button to close a window or form.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    a Close button I created on the form just wipes the form away,
    Can you show the slot your button is calling?

    Lotus Notes.
    Well, I don't know lotus notes so I looked it up, and from what I can see, it also doesn't have close button in the form it self.
    And even if it did, it is more the exception then the rule, so I wouldn't call the usual way of doing this "that is just crazy in my mind."

    That is why I would like a close pushbutton.
    I still don't see why is a "in form" close button needed for the case you described, meaning, it what way is it better then clicking the 'X' button as usual.
    Heck when I was designing database apps at IBM, we always used a close pushbutton.
    When was that, the 1870's?? (it's said with a wink!)

    But show the slot you are using, maybe its easy to solve.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #8
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    In first case also I think that the button close doesn't sense. But I note that the majority of the users use even the button X or an any shortcut defined.
    But I don't know. ..I think that a question of conception.

    To open you subwindow try use resize();

    pieceViewForm->resize(300,400);
    pieceViewForm->show();

    Maybe help you.

  9. #9
    Join Date
    Jul 2007
    Location
    California, USA
    Posts
    62
    Thanks
    17
    Thanked 7 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    I have found with my QMdiSubWindows that I need to do a setWidget(myWidget) in my subwindow class constructor. Also, within the myWidget that is in the subwindow class, I have overridden the minimumSizeHint() to return a value.

    As for the close, I have not implemented a close inside the subwindow but I think you should be able to do a signal/slot situation outside of the window (if you make the close button accessible) that can hide or delete the window if that is what you want. I do it with a button on the main window.

  10. The following user says thank you to ntp for this useful post:

    fnmblot (17th December 2007)

  11. #10
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Issues updating to QMdiArea

    This was how I had to do it, if anyone cares. Thanks ntp! I just decided to stop arguing about the close button, and use a Close Activate Window button on the MDI Toolbar area.

    Qt Code:
    1. void nnDBSMainWindow::formView()
    2. {
    3. nnDBSPieceViewForm *pieceViewForm = new nnDBSPieceViewForm;
    4. QMdiSubWindow *subWindow1 = new QMdiSubWindow;
    5. subWindow1->setWidget(pieceViewForm);
    6. MDIArea->addSubWindow(subWindow1);
    7. subWindow1->setAttribute(Qt::WA_DeleteOnClose);
    8. subWindow1->show();
    9. subWindow1->resize(650, 600);
    10. }
    To copy to clipboard, switch view to plain text mode 

    Thanks again to everyone! I don't know where I would be without this forum.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

Similar Threads

  1. QMdiArea unwanted actvation
    By fullmetalcoder in forum Qt Programming
    Replies: 7
    Last Post: 12th November 2007, 07:09

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.