Commit b8f1fd7a authored by Martin Klapetek's avatar Martin Klapetek

[pluginmanager] Set transientParent property on the UI plugins

This allows the plugins to set transient parent to their UIs which helps
with proper placement and window parenting
parent 91a98f53
......@@ -26,6 +26,8 @@
#include <QCoreApplication>
#include <QDir>
#include <QPluginLoader>
#include <QGuiApplication>
#include <QWindow>
using namespace KAccounts;
......@@ -88,6 +90,13 @@ void UiPluginsManagerPrivate::loadPlugins()
qDebug() << "Adding plugin" << ui << fileName;
const QWindowList topLevelWindows = QGuiApplication::topLevelWindows();
if (topLevelWindows.size() == 1) {
QWindow *topLevelWindow =;
obj->setProperty("transientParent", QVariant::fromValue(topLevelWindow));
} else {
qWarning() << "Unexpected topLevelWindows found:" << topLevelWindows.size() << "please report a bug";
// When the plugin has finished building the UI, show it right away
QObject::connect(ui, &KAccountsUiPlugin::uiReady, ui, &KAccountsUiPlugin::showNewAccountDialog, Qt::UniqueConnection);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment