Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Frozen Column example error when adding new column
Forum Updated to NodeBB v4.3 + New Features

Qt Frozen Column example error when adding new column

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    amban
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved