Setting the screen for the popup

Because we do not set a parent for popups, then the current screen is always taken as primary
This commit is contained in:
Eism 2021-12-24 14:17:21 +02:00
parent c7907ef3c5
commit f832707d42
6 changed files with 8 additions and 5 deletions

View file

@ -42,7 +42,7 @@ public:
virtual bool isFullScreen() const = 0;
virtual void toggleFullScreen() = 0;
virtual const QScreen* screen() const = 0;
virtual QScreen* screen() const = 0;
};
}

View file

@ -38,7 +38,7 @@ public:
MOCK_METHOD(bool, isFullScreen, (), (const, override));
MOCK_METHOD(void, toggleFullScreen, (), (override));
MOCK_METHOD(const QScreen*, screen, (), (const, override));
MOCK_METHOD(QScreen*, screen, (), (const, override));
};
}

View file

@ -130,7 +130,7 @@ void MainWindowProvider::toggleFullScreen()
}
}
const QScreen* MainWindowProvider::screen() const
QScreen* MainWindowProvider::screen() const
{
return m_window ? m_window->screen() : nullptr;
}

View file

@ -55,7 +55,7 @@ public:
bool isFullScreen() const override;
void toggleFullScreen() override;
const QScreen* screen() const override;
QScreen* screen() const override;
signals:
void windowChanged();

View file

@ -114,7 +114,8 @@ void PopupWindow_QQuickView::forceActiveFocus()
void PopupWindow_QQuickView::show(QPoint p)
{
m_view->setPosition(p);
m_view->setScreen(mainWindow()->screen());
QWindow* parent = m_parentWindow ? m_parentWindow : interactiveProvider()->topWindow();
m_view->setTransientParent(parent);

View file

@ -28,6 +28,7 @@
#include "modularity/ioc.h"
#include "ui/iinteractiveprovider.h"
#include "ui/imainwindow.h"
namespace mu::uicomponents {
class PopupWindow_QQuickView : public IPopupWindow
@ -35,6 +36,7 @@ class PopupWindow_QQuickView : public IPopupWindow
Q_OBJECT
INJECT(uicomponents, ui::IInteractiveProvider, interactiveProvider)
INJECT(uicomponents, ui::IMainWindow, mainWindow)
public:
explicit PopupWindow_QQuickView(QObject* parent = nullptr);