Results 1 to 8 of 8

Thread: Extending MessageBox

  1. #1
    Join Date
    Mar 2009
    Posts
    39
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Extending MessageBox

    I need to add some additional widgets to a standard messagebox, for example a warning that would have an additional checkbox "Don't show this message more" below the row of the standard pushbuttons.

    What would be the best strategy?, implementing a new window is relatively easy if you don't enter into the styles of each platform. Adding the widgets directly to a regular qmessagebox would require accessing the internal layout of the qmessagebox.... any suggestion to what approach take?

    Thanks!

  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: Extending MessageBox

    Why not just 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
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Extending MessageBox

    hi,
    as high_flyer said, subclass is the best way to go.
    Bala

  4. #4
    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: Extending MessageBox

    Quote Originally Posted by thru View Post
    I need to add some additional widgets to a standard messagebox, for example a warning that would have an additional checkbox "Don't show this message more" below the row of the standard pushbuttons.

    What would be the best strategy?
    The best strategy would be to use QErrorMessage.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    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: Extending MessageBox

    The best strategy would be to use QErrorMessage.
    Man... there are so many new specialized classes, it really is hard to keep up with the trolls...
    Since which version is this?
    ==========================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.

  6. #6
    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: Extending MessageBox

    Quote Originally Posted by high_flyer View Post
    Man... there are so many new specialized classes, it really is hard to keep up with the trolls...
    Since which version is this?
    Hmm.... since Qt 3.0

    http://doc.qt.nokia.com/3.0/qerrormessage.html
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    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: Extending MessageBox

    LOL.
    Well, till today I never used it...
    Learned something new today
    ==========================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.

  8. #8
    Join Date
    Mar 2009
    Posts
    39
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Extending MessageBox

    Well I learned two (at least) things, one that I could sublclass the QMessagebox (when I asked I was not aware that I could access its QLayout, but after some tests I think I got it) and second the QErrorMessage that probably I read about it but with so many classes and at an age one can not cope with all :-)

    Thank you!

Similar Threads

  1. MessageBox appearnig twice.
    By ronak.vashi in forum Newbie
    Replies: 7
    Last Post: 30th November 2010, 07:45
  2. show messagebox
    By chinmayapadhi in forum Qt Programming
    Replies: 1
    Last Post: 17th August 2010, 13:35
  3. set Bold to MessageBox particular Text
    By BalaQT in forum Qt Programming
    Replies: 2
    Last Post: 5th November 2009, 11:53
  4. MessageBox Validation
    By fortyhideout12 in forum Newbie
    Replies: 10
    Last Post: 2nd September 2009, 17:14
  5. QSA 1.2.1 && MessageBox
    By xk in forum Newbie
    Replies: 0
    Last Post: 20th April 2006, 17:30

Tags for this Thread

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.