EGLFS QML Screen not rotated

938 Views Asked by At

I have Debian Bullseye, Intel Celeron J1800 with integrated graphics. Qt from Debian version 5.12.5

Trying to rotate screen to portrait mode.

QT_QPA_EGLFS_ROTATION=90 /opt/app/bin/app

But window just resized, scaled up about 120%.

My code

#include <QGuiApplication>
#include <QQmlApplicationEngine>

int main(int argc, char *argv[])
{
    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    engine.addImportPath("qrc:/");
    const QUrl url(QStringLiteral("qrc:/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);
    engine.load(url);
    return app.exec();
}

And QML

ApplicationWindow {
    id: window
    visible: true
    flags: Qt.FramelessWindowHint
    StackView { ... }
}

QWebEngineView and widgets works well

1

There are 1 best solutions below

0
On

Seems works

#include <QApplication>
#include <QQmlApplicationEngine>
#include <QMainWindow>
#include <QVBoxLayout>
#include <QQuickWidget>

int main(int argc, char *argv[])
{
    qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
    QApplication app(argc, argv);
    const QUrl url(QStringLiteral("qrc:/main.qml"));
    QQuickWidget *w = new QQuickWidget;
    w->resize(400,300);
    w->setResizeMode(QQuickWidget::SizeRootObjectToView );
    w->engine()->addImportPath("qrc:/");
    w->setSource(url);

    w->showFullScreen();

    return app.exec();
}

and qml

Rectangle {
    id: window
    visible: true
    StackView { ... }
}