PDA

View Full Version : how to set WDestructiveClose Flag



amitkhanna
16th June 2007, 20:51
hello everyone,
i'm new to qt and also to this forum. can anyone tell me how to set the WDestructiveClose flag for a MainWindow using QtDesigner3. I know how to do it by coding.. but not able to find how to do usind QtDesigner.. I'm using Linux OS but i think that doesn't makes any difference in the answer.
thanks :)

marcel
16th June 2007, 21:42
Well, you can't do that from Designer.
What's wrong from doing it in the implementation? Because you can't build your app with Designer alone anyway.

Regards

amitkhanna
17th June 2007, 06:16
thanks for the reply.. the problem in doing it in the implementation is that i saw a warning in the source file generated by the QtDesigner(.ui.h file) which is:

/************************************************** **************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
************************************************** ***************************/
this means that we can not write constructor in that file..

and what i've read is that WDestructiveClose flag can be set only in the constructor..

so how to do it?????

wysota
17th June 2007, 07:36
Subclass the class and reimplement the constructor. ui.h is a hack that allows you to add some code to a Designer generated class without subclassing. If you subclass, you can move all your code from ui.h to the subclass to have a cleaner design.

jacek
17th June 2007, 16:20
Read Subclassing and Dynamic Dialogs (http://doc.trolltech.com/3.3/designer-manual-6.html).