Results 1 to 6 of 6

Thread: How to add a a Button to a QMessageBox?

  1. #1
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink How to add a a Button to a QMessageBox?

    I am making a program.. And i had add an about button which shows a QMessageBox..

    Qt Code:
    1. void MainWindow::on_aboutButton_clicked()
    2. {
    3. QMessageBox msgBox;
    4. msgBox.setText("<b><big>Putsa pali! </big><b>");
    5. msgBox.setInformativeText("By <b>putsos</b> and <b>muni</b>. If you like it, visit our <a href=http://www.qjdfkjfbhjebfebfiofu.com>webpage</a>!");
    6. msgBox.setWindowTitle("Putsa pali | About");
    7. msgBox.setIconPixmap(QIcon(":/icons/putsa.png").pixmap(QSize(64,64)));
    8. msgBox.setWindowIcon(QIcon(":/icons/putsa.png"));
    9. msgBox.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

    So how can i add a Button ( i want to add a Button "How it was Developed") left to the ok button which will close the about QMessageBox and show the How it was developed QMessageBox... ?
    Attached Images Attached Images

  2. #2
    Join Date
    Aug 2010
    Posts
    24
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to add a a Button to a QMessageBox?

    Maybe you should try to derive a new class from QMessageBox.

  3. #3
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add a a Button to a QMessageBox?

    Ok and how to do that?

  4. #4
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

  5. #5
    Join Date
    Aug 2010
    Posts
    24
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Wink Re: How to add a a Button to a QMessageBox?

    Quote Originally Posted by Bong.Da.City View Post
    Ok and how to do that?
    I haven't actually done that,I suggest you checking the document of qt,check for the class structure of QMessageBox,and find out by which function it adds buttons,and you may overload the function.

    But I recommend you to derive a class from QWidget,I think qt don't recommend using QMessageBox as a base class.

    cheer up and try that

  6. #6
    Join Date
    Aug 2010
    Posts
    107
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to add a a Button to a QMessageBox?

    Never mind.. I will just create some QDialogs ...

Similar Threads

  1. Button icons in QMessageBox?
    By holst in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2010, 16:27
  2. QFileDialog/ QMessageBox's Button Translation problem
    By santosh.kumar in forum Qt Programming
    Replies: 6
    Last Post: 10th August 2009, 07:07
  3. Some errors if I don't click on QMessageBox button
    By jiveaxe in forum Qt Programming
    Replies: 7
    Last Post: 23rd January 2008, 15:20
  4. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16
  5. get button on QMessageBox
    By manhds in forum Qt Programming
    Replies: 3
    Last Post: 27th June 2006, 04:38

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.