Results 1 to 2 of 2

Thread: QWidget->close() doesn't actually close the QWidget

  1. #1

    Default QWidget->close() doesn't actually close the QWidget

    I have an application with many windows (QWidgets).

    Particularly, each of these windows is called here SubWindow. Every SubWindow class contains a layout with a MultiEditor *sEditors, which has a menu with an action that closes the current window. Every SubWindow is created within the MainWindow.

    In the SubWindow constructor I have:

    Qt Code:
    1. connect(sEditors, SIGNAL(closeWindow()), this, SLOT(close()));
    2. connect(this, SIGNAL(destroyed()), mainWindow, SLOT(closeWindow()));
    To copy to clipboard, switch view to plain text mode 

    The code actually works, as the slot closeWindow() is triggered. But the SubWindow doesn't disappear and remains visible.

    Has anybody something to suggest me? I don't understand what actually the problem is (neither hide() seems to work).

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,419
    Thanks
    37
    Thanked 1,546 Times in 1,496 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QWidget->close() doesn't actually close the QWidget

    This is strange.

    Are you triggering the closeWindow() slot elsewhere?

    Because destroyed() is a signal of QObject so the widget destructor has already finished by then.
    There should be no visual resource left at this point.

    Cheers,
    _

Similar Threads

  1. Who call the QWidget.close() when i click the X button
    By luna0304 in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2013, 10:08
  2. Close Event in for a qwidget
    By ehnuh in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2012, 06:31
  3. Replies: 18
    Last Post: 19th April 2012, 10:12
  4. Can't close a QWidget from itself
    By tonnot in forum Newbie
    Replies: 3
    Last Post: 25th August 2011, 11:19
  5. QWidget (Qt::Popup), Signal when close or lost focus
    By Tondog in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2010, 09:17

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.