#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
+#include <QQuickWindow>
#include <QScreen>
#ifdef USE_FDO_NOTIFICATIONS
/* Helper functions for cross-platform tray icon position and taskbar orientation detection */
/********************************************************************************************/
+void Systray::positionWindow(QQuickWindow *window) const
+{
+ window->setScreen(currentScreen());
+
+ const auto position = computeWindowPosition(window->width(), window->height());
+ window->setPosition(position);
+}
+
QScreen *Systray::currentScreen() const
{
const auto screens = QGuiApplication::screens();
return nullptr;
}
-int Systray::currentScreenIndex() const
-{
- const auto screens = QGuiApplication::screens();
- const auto screenIndex = screens.indexOf(currentScreen());
- return screenIndex > 0 ? screenIndex : 0;
-}
-
Systray::TaskBarPosition Systray::taskbarOrientation() const
{
// macOS: Always on top
class QScreen;
class QQmlApplicationEngine;
+class QQuickWindow;
namespace OCC {
Q_INVOKABLE bool syncIsPaused();
Q_INVOKABLE void setOpened();
Q_INVOKABLE void setClosed();
- Q_INVOKABLE int currentScreenIndex() const;
+ Q_INVOKABLE void positionWindow(QQuickWindow *window) const;
Q_INVOKABLE QPoint calcTrayIconCenter() const;
Q_INVOKABLE TaskBarPosition taskbarOrientation() const;
Q_INVOKABLE QRect taskbarGeometry() const;
accountMenu.close();\r
appsMenu.close();\r
\r
- trayWindow.screen = Qt.application.screens[Systray.currentScreenIndex()];\r
-\r
- var position = Systray.computeWindowPosition(trayWindow.width, trayWindow.height)\r
- trayWindow.x = position.x\r
- trayWindow.y = position.y\r
+ Systray.positionWindow(trayWindow);\r
\r
trayWindow.show();\r
trayWindow.raise();\r