Important: Please read the Qt Code of Conduct -

Problem with QTableWidget

  • In an RVIZ plugin i use a QTableWidget to display a max of 100 waypoints. Everytime a waypoint is changed, added oder removed i trigger an updated function which fills the QTableWidget with the current waypoints. The problem which accours is that the QTableWidget is only repainted every second change.

    void WaypointPanel::updateTable() {
    //fill the table with the new content
    for(int i=0; i<WaypointList->rowCount();i++){
    //insert content into new row
    WaypointList->setItem(i,0,new QTableWidgetItem(tmpLocale->toString(waypointArray->getWaypoint(i).x ) ,0));
    WaypointList->setItem(i,1,new QTableWidgetItem(tmpLocale->toString(waypointArray->getWaypoint(i).y ) ,0));
    WaypointList->setItem(i,2,new QTableWidgetItem(tmpLocale->toString(waypointArray->getWaypoint(i).z ) ,0));
    WaypointList->setItem(i,3,new QTableWidgetItem(tmpLocale->toString(waypointArray->getWaypoint(i).radius ) , 0));


    If i add a loop which prints out the content of the QTableWidget i can see that the content is there but it isn't displayed.

Log in to reply