2

So I am trying to set this window/ mainwindow / application in qt to always be on the bottom (like always bottom window) (so rainmeter somehow does this with their widgets), but I can't even get mac osx to do such things. I've tried the whole

this->setWindowFlags(Qt::WindowStaysOnBottomHint);

but without any luck. Any hints? Example code is amazing.

1 Answer 1

5

Got bad news and good news. The bad news is it's simply not implemented.

The good news is: as Qt is open source, you can crack it open and take a look to know that. And if there's a bug you can submit a fix. Here's the deal, in the generic code for QWidget::setWindowFlags in qwidget.cpp:9144 you have this:

void QWidget::setWindowFlags(Qt::WindowFlags flags) { if (data->window_flags == flags) return; Q_D(QWidget); if ((data->window_flags | flags) & Qt::Window) { // the old type was a window and/or the new type is a window QPoint oldPos = pos(); bool visible = isVisible(); setParent(parentWidget(), flags); // if both types are windows or neither of them are, we restore // the old position if (!((data->window_flags ^ flags) & Qt::Window) && (visible || testAttribute(Qt::WA_Moved))) { move(oldPos); } // for backward-compatibility we change Qt::WA_QuitOnClose attribute value only when the window was recreated. d->adjustQuitOnCloseAttribute(); } else { data->window_flags = flags; } } 

So essentially it just sets window_flags. The mac behavior of QWidget is in qwidget_mac.mm.

And you will find no reference to Qt::WindowStaysOnBottomHint in that file. (You'll find Qt::WindowStaysOnTopHint though...)

I'll stop at saying "not possible unless you either patch Qt, or otherwise go beneath Qt".

Patching qwidget_mac.mm is left as an exercise to the reader. :-)

Sign up to request clarification or add additional context in comments.

1 Comment

Sucky. But...in Qt's defense, though: I will point out that it does say "Hint". Which is a way of saying "I'd like this to be true if it could be"...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.