Results 1 to 11 of 11

Thread: Remove default buttons

  1. #1
    Join Date
    Jan 2010
    Posts
    37
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Remove default buttons

    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!!

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

    Default Re: Remove default buttons

    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.

  3. #3
    Join Date
    Jan 2010
    Posts
    37
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Remove default buttons

    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....

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

    Default Re: Remove default buttons

    QWidget::windowFlags, Qt::CustomizeWindowHint, Qt::WindowCloseButtonHint and friends.
    Last edited by wysota; 15th April 2010 at 12:22. Reason: Corrected the link

  5. #5
    Join Date
    Jan 2010
    Posts
    37
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Remove default buttons

    Hi,
    I am able to disable quit event. But the button still remains. I don't want the buttons to be there.!!

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

    Default Re: Remove default buttons

    Did I tell you anything about any event? I told you where you can find information how to remove the close button.

  7. #7
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Remove default buttons

    Then derive your widget from a QFrame or set your widget type as QDialog...

  8. #8
    Join Date
    Jan 2010
    Posts
    37
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Remove default buttons

    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

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

    Default Re: Remove default buttons

    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.

  10. #10
    Join Date
    Jan 2010
    Posts
    37
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Remove default buttons

    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...
    Last edited by Yayati.Ekbote; 15th April 2010 at 14:23.

  11. #11
    Join Date
    Jan 2010
    Posts
    37
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Remove default buttons

    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...

Similar Threads

  1. Customizing QWizard default buttons
    By srinirc in forum Newbie
    Replies: 3
    Last Post: 19th November 2009, 16:45
  2. QInputDialog default value
    By dbrmik in forum Qt Programming
    Replies: 2
    Last Post: 25th March 2009, 16:07
  3. Replies: 1
    Last Post: 21st February 2009, 14:59
  4. How to remove default 'ENTER' from QDialogButtonBox
    By janus in forum Qt Programming
    Replies: 6
    Last Post: 12th September 2008, 21:56
  5. [SOLVED] Remove the +/- buttons of a QDoubleSpinBox?
    By hickscorp in forum Qt Programming
    Replies: 2
    Last Post: 17th April 2007, 15:39

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
  •  
Qt is a trademark of The Qt Company.