Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt5 bug Listview or QAbstractModel??
creation last edited by
Hi all, I'm currently create a multi platform application.
It was previously created with Qt4 and QtQuick and there is no problem at all.
The problems happen when I try to use Qt5.
I don't know how to explain this, but maybe these screenshots will help.
This is a screenshot when I use Qt4, everything is normal.
but this is when I use Qt5.
First row always blank for first time I open this page.
The text will appear after if I scroll down and then scroll up again, or after I resize the window.
There are not much differences between Qt4 version and Qt5 version.
I use same QAbstractListModel sub class, same database and also almost same qml and c++ files.
A little difference maybe in main.cpp, qml file import statement, and pagestack that I use.
- I use import QtQuick 1.1 for all qml files
- I use pagestack component.
- I use import QtQuick 2.0 for all qml files
- I use import QtQuickControl 1.0
- I use stackview
and for main.cpp
for Qt4 looks like this.
QObject::connect(&app, SIGNAL(aboutToQuit()), &settings, SLOT(saveSettings())); QDeclarativeContext *context = viewer.rootContext(); context->setContextProperty("Settings", &settings); viewer.addImportPath(QLatin1String("modules")); viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); viewer.setMainQmlFile(QLatin1String("qml/myapp/main.qml")); viewer.showExpanded(); return app.exec();;[/CODE]
but for Qt5 will be like this.
QQmlContext *context = viewer.rootContext(); context->setContextProperty("Settings", &settings); viewer.setMainQmlFile(QStringLiteral("qml/myapp/main.qml")); viewer.showExpanded(); return app.exec();[/CODE]
from what I read, QmlApplicationViewer in Qt4 was sub class of QDeclarativeView, but QtQuick2ApplicationViewer in Qt5 was subclass of QQuickView.
Is my problem related to this?
Is there anyone who has same problem?
The reason why I use Qt5 is because I want to create Android version and maybe also port it to another device, and I can't use Qt4 because of that.