Qt Frozen Column example error when adding new column



  • Hi,
    I am using the Qt Frozen Column implementation in my application. [Reference : http://doc.qt.nokia.com/4.7-snapshot/itemviews-frozencolumn.html]

    When I add the following function to my code :
    @
    dbTable = new FreezeTableWidget(mymodel);
    void Widget::addColumn()
    {
    QModelIndexList list = dbTable->selectionModel()->selectedIndexes();
    if (list.count() == 1)
    {
    QStandardItem *currentItem = mymodel->itemFromIndex(list[0]);

        colCount += 1 ;
        mymodel->insertColumn(currentItem->column()+1);
    
        for (int row = 0 ; row < rowCount ; ++row)
        {
            QStandardItem *item = new QStandardItem(QString("0"));
            mymodel->setItem(row, currentItem->column()+1, item);
        }
    }
    else
    {
        QMessageBox::warning(this, "Error", "Mulitple entries selected.");
    }
    

    }
    @

    I initialize the table with 3 rows and 3 columns. It works perfectly fine.
    But when i add this new column now and click on it....the frozen column displays values in the newly added column.
    Where am I going wrong ?

    Please advise.
    Thanks very much for you help.


Log in to reply
 

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