Resizing QML QuickWindow black sides?!
-
So,
im originally coming from QT Widgets, but for my new desktop applications i wanted easier possibilitys to customize look and feel. Therefore im trying to start with qml. Im on windows 10 and have a plain qml out of the box window but when i resize it the sides turn black shortly. How to prevent this miss rendering? Haven't found a single answered question for that. And if its not possible, can i atleast somehow intregate a qt widgets mainwindow with the rest of qml graphics?
Best regards, thanks for the help. <3
-
Hi,
You should add which version of Qt you are using.
From time to time, it can also come from the graphics driver. What kind of hardware do you have ? -
Qt is at 6.7 can you try this one ?
-
@SGaist I am now on 6.7 but the issue still persits.
I tried both now commented out methods, none did really fix it.
Have a nice weekend.
#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QSurfaceFormat> #include <QQuickWindow> int main(int argc, char *argv[]) { //Both do nothing for me oc i removed the comments when testing :) //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); //QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); //This makes it better, but still not gone //qputenv("QSG_INFO", "1" ); //qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/QMLCourseLesson1/Main.qml")); QObject::connect( &engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
-
Where's you QML file coming from ?
-
@SGaist The qml file is the standard one created when opening a new project out of the box. I also opened a view qml examples all have the same issue.
import QtQuick import QtQuick.Window Window { width: 640 height: 480 visible: true title: qsTr("Hello World") color: "white" id: root Image { id: myImage source: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRILAm29uLbvMPEEGffMvYiAdZvPFkYa-49nA&s" anchors.centerIn: parent width: 150 height: 100 Rectangle{ color: "red" width: parent.width height: parent.height opacity: 0.5 } } }
-
@SGaist Even downloaded the new qt 6.8beta to test, the issue still persists.
As a debug i get:
qt.scenegraph.general: threaded render loop qt.scenegraph.general: Using sg animation driver qt.scenegraph.general: Animation Driver: using vsync: 16.67 ms qt.scenegraph.general: Using sg animation driver qt.scenegraph.general: Animation Driver: using vsync: 16.67 ms qt.scenegraph.general: Creating QRhi with backend OpenGL for window 0x19899a060e0 (wflags 0x1) Graphics API debug/validation layers: 0 Debug markers: 0 Timestamps: 0 Prefer software device: 0 Shader/pipeline cache collection: 1 qt.rhi.general: Created OpenGL context QSurfaceFormat(version 4.6, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QColorSpace(QColorSpace::SRgb, QColorSpace::Primaries::SRgb, QColorSpace::TransferFunction::SRgb, gamma=2.31), profile QSurfaceFormat::CompatibilityProfile) qt.rhi.general: OpenGL VENDOR: NVIDIA Corporation RENDERER: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2 VERSION: 4.6.0 NVIDIA 536.23 qt.scenegraph.general: Created QRhi 0x198a23f4420 for window 0x19899a060e0 qt.scenegraph.general: Attempting to seed pipeline cache for QRhi 0x198a23f4420 from 'C:/Users/Musik/AppData/Local/appQMLCourseLesson1/cache/qtpipelinecache-x86_64-little_endian-llp64/qqpc_opengl' qt.rhi.general: Seeded pipeline cache with 2 program binaries qt.scenegraph.general: MSAA sample count for the swapchain is 1. Alpha channel requested = no. qt.scenegraph.general: rhi texture atlas dimensions: 1024x512 qt.scenegraph.general: Total time spent on pipeline creation during the lifetime of the QRhi 0x198a23f4420 was 5 ms qt.scenegraph.general: Writing pipeline cache contents (18022 bytes) for QRhi 0x198a23f4420 to 'C:/Users/Musik/AppData/Local/appQMLCourseLesson1/cache/qtpipelinecache-x86_64-little_endian-llp64/qqpc_opengl'
This is my main code:
#include <QGuiApplication> #include <QQmlApplicationEngine> #include <QSurfaceFormat> #include <QQuickWindow> int main(int argc, char *argv[]) { //QCoreApplication::setAttribute(Qt::AA_UseOpenGLES); //QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL); qputenv("QSG_INFO", "2" ); qputenv("QSG_RHI_BACKEND", "opengl"); QGuiApplication app(argc, argv); // Set the surface format with desired attributes QSurfaceFormat format; format.setDepthBufferSize(24); format.setStencilBufferSize(8); format.setVersion(4, 6); format.setProfile(QSurfaceFormat::CompatibilityProfile); QSurfaceFormat::setDefaultFormat(format); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/QMLCourseLesson1/Main.qml")); QObject::connect( &engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url); return app.exec(); }
-
bumping this up
-
Have you checked, if the GUI is updated at all, with a button or timer that changes some colours?
I have the case, default apps don't update on dvi connected displays until I do some specific loops. It's supposed to be a grafiks driver issue of my adapter/docking station
-
@J-Hilk Yep checked it, it's updated but the resizing issue does still occure. It also only occures with various apps made with qml. Programms coded with qt or any other framework do work just fine... thats really a pitty.
How do you exactly fix this problem?
-
Would i be viable to use qt widgets and just use qtquick for all the other widgets embedded into the qt widgets mainwindow or is this a bad idea?