Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User elshorbagy76's Avatar
    Join Date
    Nov 2008
    Location
    Egypt
    Posts
    122
    I created a button to show a message box when user clicks on it:

    void MainWindow:n_pushButton_clicked()
    {
    int ret = QMessageBox::warning(this, "Exit?",
    "Exit the application?",
    QMessageBox::Yes | QMessageBox::No);

    if(ret==0)
    QApplication::exit(0);
    }

    The messagebox pops up but I cannot see the messagebox buttons (Yes or no) on the screen.

  2. #2
    Nokia Developer Champion somnathbanik's Avatar
    Join Date
    Dec 2008
    Posts
    2,275
    try this code
    Code:
     QMessageBox msgBox;
     msgBox.setText("The document has been modified.");
     msgBox.setInformativeText("Do you want to save your changes?");
     msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
     msgBox.setDefaultButton(QMessageBox::Save);
     int ret = msgBox.exec();
    For handling the button events deal in switch case
    Code:
     switch (ret) {
       case QMessageBox::Save:
           // Save was clicked
           break;
       case QMessageBox::Discard:
           // Don't Save was clicked
           break;
       case QMessageBox::Cancel:
           // Cancel was clicked
           break;
       default:
           // should never be reached
           break;
     }

  3. #3
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Is the problem that the buttons aren't there, or that they're off the screen?

    Note that by using "this" on the QMessageBox::warning factory method you "anchor" the box to the window rather than allowing it to float. This is apt to skew the location of the box.

  4. #4
    Nokia Developer Expert Fuzzbender's Avatar
    Join Date
    Feb 2008
    Posts
    183
    What Qt release you are using?
    Is the parent window for the dialog fullscreen?

    If your parent is fullscreen and this is happening in pre-Qt4.7.3, then it might be related to this one: http://bugreports.qt.nokia.com/browse/QTBUG-4953
    Good news is that it should be fixed in Qt4.7.3.

  5. #5
    Registered User elshorbagy76's Avatar
    Join Date
    Nov 2008
    Location
    Egypt
    Posts
    122
    Thank you, it works fine. I guess the problem was within my code .

Similar Threads

  1. Cannot Express Sign ,Cannot See Content IDs
    By lxwwd in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 1
    Last Post: 2011-02-21, 08:15
  2. Cannot Express Sign ,Cannot See Content IDs
    By gz208 in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 6
    Last Post: 2011-02-03, 18:05
  3. NMIT browser cannot see jpeg
    By jhayc in forum Mobile Web Site Development
    Replies: 2
    Last Post: 2006-02-23, 22:50
  4. Cannot see app on 6600
    By rgsv123 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2005-08-31, 09:29
  5. I cannot see the application
    By antogarforum in forum Symbian C++
    Replies: 2
    Last Post: 2004-12-09, 09:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved