Results 1 to 4 of 4

Thread: Four Buttons in QMessageBox::warning ?

  1. #1
    Join Date
    Mar 2006
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Smile Four Buttons in QMessageBox::warning ?

    Hi,

    I am using Qt 3.3.7.

    How to use four buttons in QMessageBox::warning ?

    In the document I came to know "The dialog may have up to three buttons".
    We cant use more than 3 buttons ? is there any way ?

    Thanks,
    npc

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Four Buttons in QMessageBox::warning ?

    yes, you can subclass.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Mar 2006
    Posts
    53
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Four Buttons in QMessageBox::warning ?

    Thanks,

    Could you explain me how to do that ?

    -npc-

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Four Buttons in QMessageBox::warning ?

    do what?
    Derive a class?
    Am... this is basic C++.
    Its not something some one can teach you on a forum thread...
    This book should be a good start.

    At any rate here is the answer to you question:
    Qt Code:
    1. class QMessageBoxEx : publick QMessageBox
    2. {
    3. //contructors, destructors
    4. static StandardButton /*or a new enum if you define one*/ warning ( QWidget * parent, const QString & title, const QString & text, StandardButtons buttons = Ok, StandardButton defaultButton = NoButton );
    5. }
    6.  
    7. StandardButton QMessageBoxEx::warning ( QWidget * parent, const QString & title, const QString & text, StandardButtons buttons, StandardButton defaultButton, StandardButton defaultButton )
    8. {
    9. //your implementation
    10. }
    To copy to clipboard, switch view to plain text mode 

    or something similar
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Bitmap buttons
    By BloodHo in forum Newbie
    Replies: 1
    Last Post: 4th November 2006, 15:17
  2. array of radio buttons
    By amulya in forum Qt Programming
    Replies: 4
    Last Post: 5th October 2006, 13:59
  3. widget for text AND buttons
    By nongentesimus in forum Newbie
    Replies: 2
    Last Post: 16th June 2006, 14:43
  4. How to get larger radio buttons on XP?
    By Ben.Hines in forum Qt Programming
    Replies: 9
    Last Post: 24th April 2006, 20:00
  5. Several buttons
    By Mariane in forum Newbie
    Replies: 4
    Last Post: 15th March 2006, 21:50

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.