Hello everyone,

In the constructor for my Mainwindow I set some parameters for a QTableWidget I placed with the design editor. After that I am calling a memberfunction (testTable) that should fill two rows of the table. Here is the code of the constructor:

Qt Code:
  1. MainWindow::MainWindow(QWidget *parent) :
  2. QMainWindow(parent),
  3. ui(new Ui::MainWindow)
  4. {
  5. ui->setupUi(this);
  6. ui->trackList->setRowCount(0);
  7. ui->trackList->setColumnWidth(0, 260);
  8. ui->trackList->setColumnWidth(1, 260);
  9. ui->trackList->setColumnWidth(2, 68);
  10. rowCount = 0;
  11.  
  12. playButtonPixmap = new QPixmap(":/images/play_button.png");
  13. playButtonIcon = new QIcon(*playButtonPixmap);
  14. ui->addButton->setIcon(*playButtonIcon);
  15. ui->addButton->setIconSize(QSize(20,20));
  16.  
  17. QPixmap mainwindowIconPixmap(":/images/play_button.png");
  18. QIcon mainwindowIcon(mainwindowIconPixmap);
  19. setWindowIcon(mainwindowIcon);
  20. setWindowTitle("MK3 - Liveset player");
  21.  
  22. testTable(ui->trackList);
  23. }
To copy to clipboard, switch view to plain text mode 

And this is what the function looks like:
Qt Code:
  1. void MainWindow::testTable(QTableWidget *table)
  2. {
  3. table->setRowCount(2);
  4.  
  5. artist->setText("Akon");
  6.  
  7. title->setText("Yeah!");
  8.  
  9. time->setText("00:01:00");
  10.  
  11. table->setItem(0, 0, artist);
  12. table->setItem(0, 1, title);
  13. table->setItem(0, 2, time);
  14.  
  15. artist->setText("Justin Bieber");
  16.  
  17. title->setText("Sorry");
  18.  
  19. time->setText("00:03:00");
  20.  
  21. table->setItem(1, 0, artist2);
  22. table->setItem(1, 1, title2);
  23. table->setItem(1, 2, time2);
  24.  
  25. }
To copy to clipboard, switch view to plain text mode 

Now the problem is that whenever I run the application it only fills the top row of the table. It only shows Justin Bieber in the top row and Akon is nowhere to be found. But if I comment out the Justin Bieber part in my code, Akon is visible. What I recon is that it does not respond to the row I set in table->setItem.

Thanks in advance!
Martijn