I have an application with multiple toplevel windows besides the main window.
I have floating docks.
These docks disappear when I activate a secondary window. They are only shown when the main window has focus.
(How) can I change this behavior, keeping the docks visible whenever any application window has focus?
#include <QMainWindow>
#include <QDockWidget>
#include <QApplication>
int main(int argc, char ** argv )
{
mw->setWindowTitle("The main window");
dock->setFloating(true);
dock->setWindowTitle("The disappearing dock");
dock->show();
w->setWindowTitle("The second window");
w->setWindowFlags(Qt::Window);
w->setVisible(true);
mw->show();
return a.exec();
}
#include <QMainWindow>
#include <QDockWidget>
#include <QApplication>
int main(int argc, char ** argv )
{
QApplication a( argc, argv );
QMainWindow* mw = new QMainWindow();
mw->setWindowTitle("The main window");
QDockWidget* dock = new QDockWidget(mw);
dock->setFloating(true);
dock->setWindowTitle("The disappearing dock");
dock->show();
QWidget* w = new QWidget(mw);
w->setWindowTitle("The second window");
w->setWindowFlags(Qt::Window);
w->setVisible(true);
mw->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Reproduction:
- place the attached source file in a directory.
- execute qmake -project; qmake;make
- execute the application
- click on "The second window"
Now the dock has disappeared...
Bookmarks