From 79c9b7acd089ae57f16e2e2bb6045e23b096f5f1 Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 10 Nov 2009 06:28:23 +0000 Subject: [PATCH] It's a correction to communicate with cells of a QtxTable object according to the it methods. --- src/TableViewer/TableViewer_ViewWindow.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/TableViewer/TableViewer_ViewWindow.cxx b/src/TableViewer/TableViewer_ViewWindow.cxx index eab4fcc8b..ba9fc478f 100755 --- a/src/TableViewer/TableViewer_ViewWindow.cxx +++ b/src/TableViewer/TableViewer_ViewWindow.cxx @@ -181,8 +181,7 @@ QString TableViewer_ViewWindow::text( const ContentType type, const int row, con aTxt = myTable->headerData( Qt::Horizontal, col ).toString(); break; case Cells: - if ( myTable->item( row, col ) ) - aTxt = myTable->item( row, col )->text(); + aTxt = myTable->cellData( row, col ).toString(); break; default: break; @@ -445,7 +444,6 @@ void TableViewer_ViewWindow::pasteData() return; int aLeftCol = myTable->columnCount(), aTopRow = myTable->rowCount(); QModelIndexList::const_iterator anIt = anItems.begin(), aLast = anItems.end(); - QTableWidgetItem* anItem; int aCol, aRow; for ( ; anIt != aLast; ++anIt ) { aRow = (*anIt).row(); @@ -467,13 +465,11 @@ void TableViewer_ViewWindow::pasteData() aRow = aCopyItem.myRow+aTopRow; if ( !canPaste( aRow, aCol, aCopyItem.myText ) ) continue; - anItem = myTable->getItem( aRow, aCol, true ); - anItem->setText( aCopyItem.myText ); - if ( aCopyItem.myBgCol.isValid() ) - anItem->setBackground( aCopyItem.myBgCol ); - if ( aCopyItem.myFgCol.isValid() ) - anItem->setForeground( aCopyItem.myFgCol ); - anItem->setFont( aCopyItem.myFont ); + + myTable->setCellData( aRow, aCol, aCopyItem.myText ); + myTable->setCellBackground( aRow, aCol, aCopyItem.myBgCol ); + myTable->setCellForeground( aRow, aCol, aCopyItem.myFgCol ); + myTable->setCellFont( aRow, aCol, aCopyItem.myFont ); } } -- 2.39.2