Results 1 to 2 of 2

Thread: closing a widget

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default closing a widget

    Hi,

    I have the following code to close my widget and remove from the workspace :

    Qt Code:
    1. m_pMessageTree->close();
    2. m_pworkspace->removeSubWindow( m_pMessageTree );
    3. delete m_pMessageTree;
    To copy to clipboard, switch view to plain text mode 

    Problem is, the widget/window doesn't close?

    Am I doing something obviously wrong?

    Thanks,
    Steve

  2. #2
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: closing a widget

    Just thought I'd post to say I've fixed this, problem was, I was currently using Qt4.2.3 and using QWorkspace, I am now using Qt4.3 which now I changed to QMdiArea and now changed how I create my windows by now using QMdiSubWindow and setting my widget 'into' this, snippet shown below:

    Qt Code:
    1. m_pCanTree = new CanTree( this );
    2.  
    3. m_pCanTreeWindow = new QMdiSubWindow;
    4. m_pCanTreeWindow->setWidget( m_pCanTree );
    5. m_pCanTreeWindow->setAttribute( Qt::WA_DeleteOnClose );
    To copy to clipboard, switch view to plain text mode 

    and now my close function is just simply :

    Qt Code:
    1. m_pworkspace->removeSubWindow( m_pCanTreeWindow );
    To copy to clipboard, switch view to plain text mode 

    Regards,
    Steve

Similar Threads

  1. transparent background of the main widget
    By nagpalma in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2007, 17:52
  2. Controlling which widget on top layer?
    By JonathanForQT4 in forum Qt Programming
    Replies: 6
    Last Post: 22nd March 2007, 14:27
  3. Replies: 4
    Last Post: 10th March 2007, 18:01
  4. closing dialog in hidden main Widget
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 6th December 2006, 10:35
  5. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16

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.