Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Close QMessageBox which has WindowStaysOnTopHint flag set

Close QMessageBox which has WindowStaysOnTopHint flag set

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jastmc
    wrote on last edited by
    #1

    Hi,

    I am using a touchscreen on a Beaglebone and I find that I have to set the WindowStaysOnTopHint flag, otherwise push buttons on the screen seem to require two taps to activate them.

    So, I have a messagebox as shown below and the problem is that it doesn't close when the OK or Cancel buttons are pressed when the WindowStaysOnTopHint flag is set. I've tried close(), hide() and done() but they are not closing the messagebox for me.

    How do I get around this? Please point me to solutions.

    Regards,
    James

            QMessageBox msgBox(QMessageBox::Warning,
                               tr("My Application"),
                               tr("No Sync Detected!\n" "Proceed?"),
                               0, this,
                               Qt::FramelessWindowHint
                               );
    
            msgBox.setWindowFlags(Qt::WindowStaysOnTopHint);
            msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
            msgBox.setDefaultButton(QMessageBox::Ok);
            int ret = msgBox.exec();    
    
            msgBox.close();
            msgBox.hide();
            msgBox.done(0);
    
    
            switch (ret)
            {
                case QMessageBox::Ok:
                    qDebug() << "OK Pressed!";
                    StatusFlags.SYNC_OVERRIDE = 1;
                    ProceedToPulseScreen();
                    break;
                case QMessageBox::Cancel:
                default:
                    qDebug() << "Another Button Pressed!";
                    break;
            }
    
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I cannot reproduce this on either windows 10 or linux (mint)
      so maybe its related to the windows manager you are using ?

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved