Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: How to stop multiple appearance of a widget

  1. #21
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to stop multiple appearance of a widget

    Quote Originally Posted by Sarma
    We are creating the instance of the findbox in the application even before clicking it. Now for any reason if we donot click the button , doesn't that cause memory wastage?
    Since you don't supply any parent for the widget, it doesn't get destroyed automatically. So you will have to delete it in the descructor.
    A widget without a parent is always an independent window.. But why don't you just use a modeless dialog? Then you could pass your window as a parent, the dialog would show up centered to your window, and it would get automatically deleted..

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

    Default Re: How to stop multiple appearance of a widget

    Quote Originally Posted by Sarma
    hello Sir,
    I have posted this thread long back but I couldnot get proper solution.

    In that FAQ, it was written that "Assuming you have two form classes: Form1 and Form2 and that Form1 has a pushbutton "button" child and Form2 is derived from QDialog" .

    But in my application, the find box which I want to show is not derived from QDialog. It is a widget to which many child widgets are added.
    It's all the same for QWidget, you just have to pass 0 as the parent (meaning you'll get a memory leak if you don't free that memory yourself later). Why don't you use a QDialog subclass anyway?

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  3. Display multiple Images in a widget
    By jeetu_happy in forum Qt Programming
    Replies: 2
    Last Post: 7th March 2007, 11:24

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.