ListView is not getting updated properly.



  • I have one QML screen where I have ListView in it.
    I am updating this list view from the JavaScript code, I am updating image and text of Elements in the list view, But list view is not displaying the updated images and text in the ListView.

    Also there is problem with the screens that have multiple Rectangles in it,
    I am enabling/disabling Visibility of the Rectangle to display the desired set of widgets/components, But when i set the visibility true for the particulate the rectangle it displays background color of the parent rectangle, as it should display it's own background color.

    I think QT is not refreshing/redrawing the entire screen.
    I tried to resolve this issue using Z index and Opacity but no luck.
    Is there any function in QML to refresh/redraw the display, so that changes made to widgets will get displayed.

    Thanks.



  • Code, please.



  • @// main.cpp
    void main(int argc, char*[] argv)
    {
    QApplication::setGraphicsSystem("raster");
    QApplication app(argc, argv);

    QDeclarativeView view;
    view.setSource(QUrl::fromLocalFile("Test.qml"));
    
    view.setResizeMode(QDeclarativeView::SizeRootObjectToView);
    
    view.showFullScreen();
    app.exec();
    

    }

    //Test.qml
    Rectangle
    {
    id: mainRect
    width: 1000
    height: 700
    color: "#ffggff"
    z: 1000

    Rectangle
    {
        id: Rect1;
        width: 200;
        anchors.left: parent.left;
        anchors.top: parent.top;
        anchors.bottom: parent.bottom;
    
        color: "#ff00ff";
        z: 1100;
    
        ListModel
        {
            id: listModel;
            ....
        }
    
        ListView    
        {
            id: listView;
            ...
        }
    
        Text    
        {
            id: textView;
            text: "This Is Test"
            anchors.bottom: Rect1.bottom;
            ...
        }
    }
    

    }
    @

    this is the test code.

    Also for "Text" widget it displays the background color of the text as background color of it's parents->parent.
    If i hit Tab key on the keyboard then every thing gets to normal state. is it so that on Tab key QML is refreshing/redrawing the UI.


Log in to reply
 

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