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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:40:16+00:00 2026-05-31T17:40:16+00:00

I have the following issue: I have a splash like window coming with my

  • 0

I have the following issue: I have a “splash” like window coming with my application and it has a few buttons on it for opening the last project, creating a new one, etc… On pressing, these buttons hide the window and do the stuff.

This window is created with the following code and flags:

void MainWindowButtonDialog::showMe()
{
    setModal(false);
    setWindowFlags(Qt::SplashScreen | Qt::CustomizeWindowHint |
                      Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
    show();
}

The window is called m_btnDlg.

Now, due to requests from the clients when the application loses focus I need to hide this window, and when the application gets focus I need to re-show it. This is done by the following code:

void MainWindow::changeEvent(QEvent *e)
{
    if( e->type() == QEvent::WindowStateChange )
    {
        if( isMinimized() )
        {
            if(m_btndlg && m_btndlg->isVisible())
            {
                m_btndlg->hide();
                m_splashWasVisible = true;
            }
        }
        else
        {
            if(m_splashWasVisible)
            {
                m_btndlg->show();
                m_splashWasVisible = false;
            }
        }
    }
    if(e->type() == QEvent::ActivationChange)
    {
        if(!isActiveWindow())
        {
            if(m_btndlg && m_btndlg->isVisible() && !m_btndlg->isActiveWindow())
            {
                m_btndlg->hide(); // *****
                m_splashWasVisible = true;
            }
        }
        else
        {
            if(m_splashWasVisible)
            {
                m_btndlg->show();
                m_splashWasVisible = false;
            }
        }
    }
    QMainWindow::changeEvent(e);
}

Now to the problem: the code above worked perfectly till now (both under Linux – Gnome 2.x on CentOS 5.x, and KDE 3.x and also Windows, all interesting versions). Recently the client has installed a few Fedora systems and Gnome 3, KDE 4, etc… suddenly the application behaves funnily. When I press the the button to create a new project it hides the splash window and nothing happens. The line marked with ** above is the one responsible. It seems that these new window managers send the activation events out of order.

Has anyone experience with this?

(More Code available on request). We use Qt 4.6.3
thanks.

  • 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-31T17:40:17+00:00Added an answer on May 31, 2026 at 5:40 pm

    You should try the application level events QEvent::ApplicationActivate and QEvent::ApplicationDeactivate with an event filter installed on qApp.

    These events are fired when the application focus changes or the application window is minimized.

    MainWindow::MainWindow() {
      qApp->installEventFilter(this);
    }
    
    bool MainWindow::eventFilter(QObject *obj, QEvent *evt)
    {
        if(obj==qApp && ( evt->type() == QEvent::ApplicationActivate
                          || evt->type() == QEvent::ApplicationDeactivate))
        {
            bool shouldHide = evt->type() == QEvent::ApplicationDeactivate;
            if (shouldHide) {
                m_splashWasVisible = m_btndlg && m_btndlg->isVisible();
                if(m_splashWasVisible) 
                    m_btndlg->hide();
            } else {
                if(m_splashWasVisible) 
                    m_btndlg->show();
            }    
        }
        return QMainWindow::eventFilter(obj, evt);
    }
    

    Alternatively, you could display the splash window as part of the main window on top of all other widgets by setting the main window as its parent, and using QWidget::raise().

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

Sidebar

Related Questions

I have the following issue and I would like to know what exactly happens.
I have the following issue: I have a MVC application, in some action of
I have the following issue. I have deployed a smart client application to several
I have the following issue: I'm trying to deploy my project on heroku but
I have the following issue, Im creating a windows 7 gadget, which uses Iframe
I have following issue: I'm introducing new feature into application (run as Windows Service)
I'm developing a windows forms application. And i have the following issue: in a
I have the following issue: when a stored proc is called from my application,
I have the following issue related to iterating over an associative array of strings
I have the following issue with a UTF8 files structured as following: FIELD1§FIELD2§FIELD3§FIELD4 Looking

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.