Commit 20e65306 authored by Volker Krause's avatar Volker Krause
Browse files

Port away from QDesktopWidget

That's gone in Qt 6.
parent fe6ab870
Pipeline #261821 failed with stage
in 1 minute and 29 seconds
......@@ -11,8 +11,8 @@
#include <KConfigGroup>
#include <KSharedConfig>
#include <QDesktopWidget>
#include <QApplication>
#include <QScreen>
namespace Config
{
......@@ -26,14 +26,14 @@ namespace Config
bool readWindowSize(const char* window, QSize& result, int* splitterWidth)
{
KConfigGroup config(KSharedConfig::openConfig(), window);
const QWidget* desktop = QApplication::desktop();
const QSize s = QSize(config.readEntry(QStringLiteral("Width %1").arg(desktop->width()), (int)0),
config.readEntry(QStringLiteral("Height %1").arg(desktop->height()), (int)0));
const QSize desktopSize = QApplication::primaryScreen()->virtualSize();
const QSize s = QSize(config.readEntry(QStringLiteral("Width %1").arg(desktopSize.width()), (int)0),
config.readEntry(QStringLiteral("Height %1").arg(desktopSize.height()), (int)0));
if (s.isEmpty())
return false;
result = s;
if (splitterWidth)
*splitterWidth = config.readEntry(QStringLiteral("Splitter %1").arg(desktop->width()), -1);
*splitterWidth = config.readEntry(QStringLiteral("Splitter %1").arg(desktopSize.width()), -1);
return true;
}
......@@ -44,11 +44,11 @@ bool readWindowSize(const char* window, QSize& result, int* splitterWidth)
void writeWindowSize(const char* window, const QSize& size, int splitterWidth)
{
KConfigGroup config(KSharedConfig::openConfig(), window);
const QWidget* desktop = QApplication::desktop();
config.writeEntry(QStringLiteral("Width %1").arg(desktop->width()), size.width());
config.writeEntry(QStringLiteral("Height %1").arg(desktop->height()), size.height());
const QSize desktopSize = QApplication::primaryScreen()->virtualSize();
config.writeEntry(QStringLiteral("Width %1").arg(desktopSize.width()), size.width());
config.writeEntry(QStringLiteral("Height %1").arg(desktopSize.height()), size.height());
if (splitterWidth >= 0)
config.writeEntry(QStringLiteral("Splitter %1").arg(desktop->width()), splitterWidth);
config.writeEntry(QStringLiteral("Splitter %1").arg(desktopSize.width()), splitterWidth);
config.sync();
}
......
......@@ -54,7 +54,6 @@
#include <QHBoxLayout>
#include <QResizeEvent>
#include <QCloseEvent>
#include <QDesktopWidget>
#include <QScreen>
#include <QStyle>
......@@ -1251,7 +1250,7 @@ bool MessageWindow::getWorkAreaAndModal()
// There are multiple screens.
// Check for any full screen windows, even if they are not the active
// window, and try not to show the alarm message their screens.
mScreenNumber = QApplication::desktop()->screenNumber(MainWindow::mainMainWindow()); // default = KAlarm's screen
mScreenNumber = screens.indexOf(MainWindow::mainMainWindow()->screen()); // default = KAlarm's screen
if (QGuiApplication::primaryScreen()->virtualSiblings().size() > 1)
{
// The screens form a single virtual desktop.
......
Supports Markdown
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