Qt5 bug Listview or QAbstractModel??



  • 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.
    !http://imageshack.us/a/img703/9260/3qqq.png!

    but this is when I use Qt5.
    !http://imageshack.us/a/img41/5472/tpov.png!
    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.
    !http://imageshack.us/a/img12/9269/vjk1.png!

    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.
    In Qt4:

    • I use import QtQuick 1.1 for all qml files
    • I use pagestack component.

    In Qt5:

    • 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.
    [CODE]QmlApplicationViewer viewer;

    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.
    [CODE]QtQuick2ApplicationViewer viewer;

    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.

    thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.