Results 1 to 3 of 3

Thread: QMdiArea window needs two clicks to close

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2010
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QMdiArea window needs two clicks to close

    Hi group,
    I have been experimenting with the MDI example program. I wanted to change the child Mdi windows from the standard QTextedit to something else (an activeX control eventually...) but I am having some trouble with the basics. When I change the MdiChild object inheritance from QTextEdit to QMdiSubWindow,
    e.g.
    class MdiChild : public QMdiSubWindow //QTextEdit

    everything works fine until I close the app (via the topright mainwindow x icon). First click all the child windows disappear (tested with up to 3 visible) but the app does not close. Clicking again and the app exits normally.

    So I stripped out almost everything to make a very lightweight project but changing the above class declaration to QTextEdit (or QLabel) makes everything normally and flipping back to QMdiSubWindow causes the problem again.

    It turns out that in
    Qt Code:
    1. void MainWindow::closeEvent(QCloseEvent *event)
    2. {
    3. mdiArea->closeAllSubWindows();
    4. if (mdiArea->currentSubWindow()) {
    5. event->ignore();
    6. } else {
    7. event->accept();
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    currentSubWindow is returning True in one case but False (as it should) when the declaration is QTextEdit. Anybody know why?

    I have attached the stripped down project that reproduces the problem. Any help would be appreciated.

    Thanks,
    epsilon
    Attached Files Attached Files

Similar Threads

  1. close window signal
    By jano_alex_es in forum Newbie
    Replies: 5
    Last Post: 22nd May 2009, 10:10
  2. how to disable X button to close th window
    By raghvendramisra in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2009, 20:01
  3. How to close parent window from child window?
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2008, 11:40
  4. Weird behavior when readding a window to a QMdiArea
    By seand in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2008, 02:14
  5. close window when click on a label
    By sabeesh in forum Qt Programming
    Replies: 3
    Last Post: 29th October 2007, 07:35

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.