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 7041125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:00:01+00:00 2026-05-28T02:00:01+00:00

I have two QDialogs stacked on top of each other, with some data is

  • 0

I have two QDialogs stacked on top of each other, with some data is shared between them shown in a QWidget in each dialog’s layout (a widget showing a count graphically).

In the QDialog currently shown, the user can change that data. This change gets propagated to both widgets, and the correct count is displayed in the current QDialog. However, when the user closes that QDialog, and the one underneath becomes visible, the QWidget showing the count shows the old value for a split second before it then updates to the correct value.

I know that the QWidget underneath has the correct value before the other QDialog is shown, but I can’t seem to get the Dialog to update before it’s visible. I tried this while it was still hidden:

hiddenDialog->layout()->activate()

hiddenDialog->layout()->update()

But it still fails to actually update until after dialog is shown. My problem seems sort-of related to Qt: How to force a hidden widget to calculate its layout?, except I want to then show the QDialog after setting Qt::WA_DontShowOnScreen on. After turning on Qt::WA_DontShowOnScreen and updating the dialog, I tried setting:

dialog->setAttribute(Qt::WA_DontShowOnScreen, false);

dialog->show()

But the Dialog remains not shown on screen. Is there any way to make it visible again? Or is there some way to have the dialog and widgets update when they are hidden by the other dialog?


Here’s some more details as requested:
There are two classes, Dialog1 and Dialog2, each extending the same base class, BaseDialog, which extends the QDialog class.

BaseDialog has a slot that gets called whenever the GlobalCount is changed. This slot updates a countWidget which draws a picture of the count.

void BaseDialog::updateCountWidget()
{
    _countWidget->updateCount(globalCount);
    _countWidget->update();
}

Dialog1 has a slot (connected from a QPushButton click()) that creates and shows a Dialog2:

void Dialog1::showDialog2()
{
    Dialog2* dialogTwo = new Dialog2();
    dialog2->show();
}    

Dialog2 has two slots (connected to QPushButton signals), one subtract from the global count, the other closes the dialog. When the global count is subtracted, it emits a signal connected to the updateCountWidget() slot of both the Dialog1 and Dialog2.

void Dialog2::subtractCount()
{
    GlobalCount.subtractOne();
}

void Dialog2::userClosed()
{
    accept();
}

When I click the subtract button, I can see the _countWidget of Dialog2 update correctly. However, when I close Dialog2, and can once again see Dialog1, the _countWidget of Dialog1 shows the original count value for a split-second, then updates to the new value.

My goal is to prevent this momentary update, as it looks really funky to the user. This has gotten obscenely long, but I appreciate any insights!

  • 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-05-28T02:00:01+00:00Added an answer on May 28, 2026 at 2:00 am

    call

    hide() 
    

    on widget when you do

    setAttribute(Qt::WA_DontShowOnScreen, true);
    

    After that

    setAttribute(Qt::WA_DontShowOnScreen, false);
    show()
    

    and it will work

    I use Qt embedded on Linux

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

Sidebar

Related Questions

I have two classic HTML pages (just HTML and CSS) and links between them.
Have two sets of data (two tables) for patient records, one 1999-2003, the other
I have two tables. One is Employee_Mstr and other is EmployeeLeaveRequest_mstr . My data:
I have two applications written in Java that communicate with each other using XML
Have two UIBarButtonItems want to make it as one UIBarButtonItem and toggle between them
Have two tables with a linking table between them. USERS +-------+---------+ | userID| Username|
Have two tables say ABC and XYZ and contain one column which data will
I have two appenders in my logging configuration. One of them sends E-Mail on
I have two tables. company_details and company_specials. Each company_details can have multiple specials. I
I have two Macs, and a shared folder on a third Windows computer. If

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.