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. When the main window remains at the top, the child Windows are occluded - MacOS
Forum Updated to NodeBB v4.3 + New Features

When the main window remains at the top, the child Windows are occluded - MacOS

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 955 Views 3 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.
  • myxingkongM Offline
    myxingkongM Offline
    myxingkong
    wrote on last edited by myxingkong
    #1

    Usually, the tools window is always at the top of the main window, even if it loses focus.However.

    On MacOS, when the main window sets the window flag |Qt::WindowStaysOnTopHint, the Tool window is below it.

    On a Windows system, the Tool window is at the top of the main window as expected.

    Is there a way to keep the main window at the top while the Tool window is above it?

    0_1548902965690_微信截图_20190131104854.png

    This is my test code

    #include <QtGui>
    #include <QtWidgets>
    
    int main(int argc, char * argv[])
    {
        QApplication app(argc, argv);
    
        QDialog* mw = new QDialog(0, Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
        mw->setWindowTitle(QLatin1String("Main"));
        mw->resize(400, 300);
        mw->move(100, 100);
    
        QWidget* d = new QWidget(mw, Qt::Tool);
        d->setWindowTitle(QLatin1String("Tool"));
        d->resize(200, 100);
        d->show();
        mw->exec();
        return app.exec();
    }
    
    #include <QtGui>
    #include <QtWidgets>
    
    int main(int argc, char * argv[])
    {
        QApplication app(argc, argv);
    
        QWidget* mw = new QWidget(0, Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
        mw->setWindowTitle(QLatin1String("Main"));
        mw->resize(400, 300);
        mw->move(100, 100);
        mw->show();
        QWidget* d = new QWidget(mw, Qt::Tool);
        d->setWindowTitle(QLatin1String("Tool"));
        d->resize(200, 100);
        d->show();
        return app.exec();
    }
    
    #include <QtGui>
    #include <QtWidgets>
    
    int main(int argc, char * argv[])
    {
        QApplication app(argc, argv);
    
        QWidget* mw = new QWidget(0, Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
        mw->setWindowTitle(QLatin1String("Main"));
        mw->resize(400, 300);
        mw->move(100, 100);
        mw->show();
        QWidget* d = new QWidget(mw, Qt::Tool, Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
        d->setWindowTitle(QLatin1String("Tool"));
        d->resize(200, 100);
        d->show();
        return app.exec();
    }
    

    Hello World!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Im not sure the Tool type will stay on top of Dialog with Qt::WindowStaysOnTopHint.
      Did you try to raise() it ?

      myxingkongM 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        Im not sure the Tool type will stay on top of Dialog with Qt::WindowStaysOnTopHint.
        Did you try to raise() it ?

        myxingkongM Offline
        myxingkongM Offline
        myxingkong
        wrote on last edited by
        #3

        @mrjj This doesn't seem to work. I tried setting Qt::WindowStaysOnTopHint flag on the Tool window, but it didn't help either.

        Hello World!

        mrjjM 1 Reply Last reply
        0
        • myxingkongM myxingkong

          @mrjj This doesn't seem to work. I tried setting Qt::WindowStaysOnTopHint flag on the Tool window, but it didn't help either.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @myxingkong
          Hmm, i dont have any macOS to test on.
          I suspect its due to QDialog as the mainwindow but im not 100% sure.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            HI,

            What version of Qt ?
            On what version of macOS ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            myxingkongM 1 Reply Last reply
            0
            • SGaistS SGaist

              HI,

              What version of Qt ?
              On what version of macOS ?

              myxingkongM Offline
              myxingkongM Offline
              myxingkong
              wrote on last edited by
              #6

              @SGaist Macos version 10.13.4,Qt5.9.6 and Qt5.12.1

              Hello World!

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                It's a bug in the Cocoa backend.

                You should take a look at the bug report system to see if there's anything related. If not, please consider opening a new report providing a complete buildable project reproducing the behaviour.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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