Advance KDE Plasma and Qt integration
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,11 +1,51 @@
|
||||
#include <QByteArray>
|
||||
#include <QCoreApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QWindow>
|
||||
#include <QBackingStore>
|
||||
#include <QPainter>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
class ColoredWindow : public QWindow {
|
||||
public:
|
||||
ColoredWindow() : QWindow(), m_backingStore(this) {
|
||||
resize(320, 240);
|
||||
}
|
||||
|
||||
void exposeEvent(QExposeEvent *) override {
|
||||
if (!isExposed())
|
||||
return;
|
||||
render();
|
||||
}
|
||||
|
||||
void resizeEvent(QResizeEvent *) override {
|
||||
m_backingStore.resize(size());
|
||||
if (isExposed())
|
||||
render();
|
||||
}
|
||||
|
||||
void render() {
|
||||
QRect rect(0, 0, width(), height());
|
||||
m_backingStore.beginPaint(rect);
|
||||
QPaintDevice *device = m_backingStore.paintDevice();
|
||||
if (device) {
|
||||
QPainter p(device);
|
||||
p.fillRect(rect, QColor(180, 30, 30));
|
||||
p.setPen(Qt::white);
|
||||
p.drawText(rect, Qt::AlignCenter,
|
||||
QStringLiteral("Red Bear OS\nQt6 Wayland Smoke Test"));
|
||||
}
|
||||
m_backingStore.endPaint();
|
||||
m_backingStore.flush(rect);
|
||||
}
|
||||
|
||||
private:
|
||||
QBackingStore m_backingStore;
|
||||
};
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const QByteArray platform = qEnvironmentVariableIsSet("QT_QPA_PLATFORM")
|
||||
? qgetenv("QT_QPA_PLATFORM")
|
||||
@@ -19,6 +59,12 @@ int main(int argc, char **argv) {
|
||||
|
||||
qInfo() << "qt6-wayland-smoke platform" << QGuiApplication::platformName();
|
||||
|
||||
QTimer::singleShot(1000, &app, &QCoreApplication::quit);
|
||||
ColoredWindow window;
|
||||
window.setTitle(QStringLiteral("Red Bear OS - Qt6 Wayland Smoke"));
|
||||
window.show();
|
||||
std::fprintf(stderr, "qt6-wayland-smoke window shown, %dx%d\n",
|
||||
window.width(), window.height());
|
||||
|
||||
QTimer::singleShot(3000, &app, &QCoreApplication::quit);
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user