Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8767225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:45:22+00:00 2026-06-13T16:45:22+00:00

My application has a dialog that asks the user via a QMessageBox whether he

  • 0

My application has a dialog that asks the user via a QMessageBox whether he wants to discard all changes he made or wants to keep editing. I want this dialog to be modal to the whole application.

I read somewhere that this is the standard behavior for a QMessageBox, so I dont have to set it explicitly with something like:

mbox.setWindowModality(Qt::ApplicationModal);

I wonder why it behaves differently from other modal dialogs in the OS (Windows 7 in my case). On the one hand it functions like it should, i.e. all other input methods in the application are blocked until the user answeres the dialog. However, it doesn’t ‘blink’* if the user clicks any other window of the application. Is there any way to get Qt to behave like a native Windows dialog?

Thanks in advance!


*If you don’t know what I mean with this ‘blinking’: Just open notepad on a Windows OS, type some text and try to close it. A dialog pops up that asks to save, discard or keep editing. Now click somewhere on the editor window -> the border and titlebar of the dialog flashes/blinks a few times.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:45:23+00:00Added an answer on June 13, 2026 at 4:45 pm

    The problem arises when the message box has no parent. This works fine for me:

    QMessageBox box(this);
    box.setStandardButtons(QMessageBox::Close);
    box.exec();
    

    But this does not:

    QMessageBox box;
    box.setStandardButtons(QMessageBox::Close);
    box.exec();
    

    This makes sense… the message box can’t blink unless it knows that its parent was clicked on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My web application has a login page that submits authentication credentials via an AJAX
I have created a User Control in my application that has a textbox and
I'm working on a Windows Mobile 6.5 application that has a dialog box that
I was given a task. First dialog based application has 4 buttons (up, down,
In my application I want to create a dialog which has a button to
My application has two layouts A and B. In A a user chooses some
Our application has many controls that are created dynamically. For example, a navigation pane
I have a web application that has been running just fine in Internet Explorer
My application has a restricted access. I have a user/password box in a small
My application has modal dialogs in it, and also a feedback widget that sticks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.