Hi,
I have a Qt/QML application and I have a problem when setting the main window to Full Screen.
It goes Full Screen, but first it seems to be moved to the top-left corner of my screen. Then it changes to Full Screen, BUT this top-left window is there until I repaint my application. For instance, moving it to background and to foreground again.
I hope I am explaining properly...
In my code, I have a QWidget class where I create a QQmlApplicationEngine:
.h file:
QQmlApplicationEngine* m_pAppMainWindow;
QQuickWindow* m_pQuickWindow;
QQmlApplicationEngine* m_pAppMainWindow;
QQuickWindow* m_pQuickWindow;
To copy to clipboard, switch view to plain text mode
.cpp file:
m_pAppMainWindow = new QQmlApplicationEngine();
m_pAppMainWindow = new QQmlApplicationEngine();
To copy to clipboard, switch view to plain text mode
I use it to get app qml context
QQmlContext* pQmlContext = m_pAppMainWindow->rootContext();
QQmlContext* pQmlContext = m_pAppMainWindow->rootContext();
To copy to clipboard, switch view to plain text mode
to load the main QML file from resources:
m_pAppMainWindow
->load
(QUrl("qrc:/qml/ViewMain.qml"));
m_pAppMainWindow->load(QUrl("qrc:/qml/ViewMain.qml"));
To copy to clipboard, switch view to plain text mode
to set Image providers:
m_pAppMainWindow->addImageProvider(...);
m_pAppMainWindow->addImageProvider(...);
To copy to clipboard, switch view to plain text mode
and to get QQuickWindow object:
m_pQuickWindow = m_pQuickWindow = qobject_cast<QQuickWindow *>(m_pAppMainWindow->rootObjects()[0]);
m_pQuickWindow = m_pQuickWindow = qobject_cast<QQuickWindow *>(m_pAppMainWindow->rootObjects()[0]);
To copy to clipboard, switch view to plain text mode
I use the QQuickWindow object to set app window minimum size:
m_pQuickWindow->setMinimumWidth(...)
m_pQuickWindow->setMinimumWidth(...)
To copy to clipboard, switch view to plain text mode
to get the QML objects to work with:
QObject* pObjViewMain
= m_pQuickWindow
->findChild<QObject
*>
("viewMain");
QObject* pObjViewMain = m_pQuickWindow->findChild<QObject*>("viewMain");
To copy to clipboard, switch view to plain text mode
and to set app in full screen mode (on/off):
m_pQuickWindow->showFullScreen();
or
m_pQuickWindow->showNormal();
m_pQuickWindow->showFullScreen();
or
m_pQuickWindow->showNormal();
To copy to clipboard, switch view to plain text mode
My problem is with this last point, when I enter Full Screen...
Hope anyone can help me
Thanks
Bookmarks