Use true fullscreen mode, display just the background image on all but one screen
This commit is contained in:
parent
edc608e98a
commit
e05ca8280e
@ -27,6 +27,8 @@ set(PROJECT_SOURCES
|
|||||||
src/installerprompt.cpp
|
src/installerprompt.cpp
|
||||||
src/installerprompt.h
|
src/installerprompt.h
|
||||||
src/installerprompt.ui
|
src/installerprompt.ui
|
||||||
|
src/backgroundscreen.h
|
||||||
|
src/backgroundscreen.cpp
|
||||||
src/resource.qrc
|
src/resource.qrc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
27
src/backgroundscreen.cpp
Normal file
27
src/backgroundscreen.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#include "backgroundscreen.h"
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
|
BackgroundScreen::BackgroundScreen(QWidget *parent)
|
||||||
|
: QWidget(parent) {
|
||||||
|
// Set the background image and scale it
|
||||||
|
QPixmap bg(":/background");
|
||||||
|
if (bg.isNull()) {
|
||||||
|
// the user will see the warning message that the InstallerPrompt object pops up, no need to bombard them with one message per screen
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
|
QRect screenGeometry = screen->geometry();
|
||||||
|
bg = bg.scaled(screenGeometry.size(), Qt::IgnoreAspectRatio);
|
||||||
|
|
||||||
|
QPalette palette;
|
||||||
|
palette.setBrush(QPalette::Window, bg);
|
||||||
|
this->setPalette(palette);
|
||||||
|
}
|
||||||
|
|
||||||
|
BackgroundScreen::~BackgroundScreen()
|
||||||
|
{
|
||||||
|
}
|
14
src/backgroundscreen.h
Normal file
14
src/backgroundscreen.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef BACKGROUNDSCREEN_H
|
||||||
|
#define BACKGROUNDSCREEN_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class BackgroundScreen : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit BackgroundScreen(QWidget *parent = nullptr);
|
||||||
|
virtual ~BackgroundScreen();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BACKGROUNDSCREEN_H
|
24
src/main.cpp
24
src/main.cpp
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "installerprompt.h"
|
#include "installerprompt.h"
|
||||||
|
#include "backgroundscreen.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
@ -32,23 +33,20 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<InstallerPrompt*> ws;
|
InstallerPrompt* w;
|
||||||
|
QList<BackgroundScreen *> bss;
|
||||||
|
|
||||||
// Iterate through all available screens
|
// Iterate through all available screens
|
||||||
for (QScreen *screen : QApplication::screens()) {
|
for (QScreen *screen : QApplication::screens()) {
|
||||||
InstallerPrompt *w = new InstallerPrompt();
|
if (screen == QApplication::primaryScreen()) {
|
||||||
w->setGeometry(screen->geometry());
|
w = new InstallerPrompt();
|
||||||
w->show();
|
w->showFullScreen();
|
||||||
ws.append(w);
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
for (InstallerPrompt *w : ws) {
|
|
||||||
for (InstallerPrompt *otherWindow : ws) {
|
|
||||||
if (w != otherWindow) {
|
|
||||||
// Connect signals and slots for synchronization
|
|
||||||
// Example: connect(ws.last(), &InstallerPrompt::someSignal, otherWindow, &InstallerPrompt::someSlot);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
BackgroundScreen *backscreen = new BackgroundScreen();
|
||||||
|
backscreen->setGeometry(screen->geometry());
|
||||||
|
backscreen->showFullScreen();
|
||||||
|
bss.append(backscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user