Force dialogs to float; like QInputDialog
-
Pretext: I use a tiling window manager that has the ability to make certain windows float (in my case, sway).
Whenever I use Qt's built-in dialogs like QInputDialog, the dialogs float as such (using
QInputDialog::getText
):However, I am looking to getting
QDialog
s I subclass to also show like this, but all of them get tiled along with the rest of my windows.I looked at the source code for the
getText
method:QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label, QLineEdit::EchoMode mode, const QString &text, bool *ok, Qt::WindowFlags flags, Qt::InputMethodHints inputMethodHints) { QAutoPointer<QInputDialog> dialog(new QInputDialog(parent, flags)); dialog->setWindowTitle(title); dialog->setLabelText(label); dialog->setTextValue(text); dialog->setTextEchoMode(mode); dialog->setInputMethodHints(inputMethodHints); const int ret = dialog->exec(); // ... }
This looks suspiciously like it does absolutely nothing to make it appear as a popup like that, except maybe for the use of
exec
. I tried usingexec
as well (which I wouldn't have wanted either way due to its blocking nature), but this did NOT work.I also tried various window flags;
Qt::WindowStaysOnTopHint
,Qt::Popup
,Qt::Tool
, none achieved anything. TriedsetModal(true)
, didn't work.What does the
QInputDialog
do to achieve this that I don't understand? Or is this some weird quirk of i3/sway? -