PDA

View Full Version : Remove default buttons



Yayati.Ekbote
15th April 2010, 11:38
Hi guys,

I wanted to remove/disable the quit button which comes default with the form even if we do not draw them on the form. How to remove them? I want to add my own quit button and don't want the default one...Plz guide!!

wysota
15th April 2010, 11:46
What quit button? Please try to express yourself in a more verbose manner so that others don't have to guess what you are trying to ask about.

Yayati.Ekbote
15th April 2010, 11:51
The cross button at the right top of the application. I select a dialog or widget when selecting the type of application. And in the designer, there is no quit(cross) buton at the top right of the form ,like all windows have a maximize/minimize and quit button at the top right of the window....But when i run the application they are present as if they are default....

wysota
15th April 2010, 11:57
QWidget::windowFlags, Qt::CustomizeWindowHint, Qt::WindowCloseButtonHint and friends.

Yayati.Ekbote
15th April 2010, 12:17
Hi,
I am able to disable quit event. But the button still remains. I don't want the buttons to be there.!!

wysota
15th April 2010, 12:21
Did I tell you anything about any event? I told you where you can find information how to remove the close button.

zgulser
15th April 2010, 12:21
Then derive your widget from a QFrame or set your widget type as QDialog...

Yayati.Ekbote
15th April 2010, 12:47
Well, i m really sorry but i am unable to find it... may be because i m using older version of Qt. Qt2.3.2

wysota
15th April 2010, 13:15
2.3.2? Hmm... you should have said so in the beginning, how would we know this?

In the constructor of a widget you can pass a set of flags similar to the ones I have mentioned in my earlier post, only that the enum identifiers are different. I can't see anything about a close button there but my guess is that if you manually pass the flags for buttons you wish to be there, others won't be set so the close button should vanish.

Here is a link to the docs: http://doc.trolltech.com/2.3/qt.html#WidgetFlags


By the way, I suggest you switch to some newer Qt version. 2.3 is more than 10 years old.

Yayati.Ekbote
15th April 2010, 14:18
Well i have worked on Qt 4.6.1....but i had to switch to older version of Qt bcoz it comes with the embedded device for which i am working. Those old libraries are compatible and compiled and tested for that device. Newer version of Qt may not be compatible with device...
I too checked the Qt doc of 2.3. I didn't find any flag setting for window quit button. But i think i need to test all flags or i have to define my application as custom widget...

initially i defined like this...

myApp(QWidget *parent,const char *name, WFlags fl);

Instead i should do this....

myApp(QFrame *parent,const char *name,WFlags fl);

i haven't done it yet...but its just the idea...

Yayati.Ekbote
16th April 2010, 18:27
In the beginning, the designer has options to choos from, i.e. Dialog, Wizard, Widget... I was selecting Dialog previously. I checked with Widget, the default "OK" button doesn't come now.. But the close button at the top right still remains. I tried all the flags in Qt class. I tried to clear flags but the close button remains.
I am trying to make an application which doesn't have be closed. When the device starts, the application is invoked automatically and when device is turned off the application will be closed automatically. So i want to remove the default buttons. I am using Qt2.3.2 which comes with the device.. Plz guide...