Hi,
I am creating a Qt application on raspberry pi. I have a serise of checkboxes that if they are checked add their given number (1-25) to a QVector named Bank_1. I decided to display elements of the Vector in a text editor to make sure they are what I expected. They were not. When I display Bank_1[0] the result is anywhere from 24 to 495192 (or similar). Below is my code.

Qt Code:
  1. MainWindow::MainWindow(QWidget *parent) :
  2. QMainWindow(parent),
  3. ui(new Ui::MainWindow)
  4. {
  5. ui->setupUi(this);
  6.  
  7. QVector<int> Bank_1(QVector<int>(6));
  8. }
  9.  
  10.  
  11. void MainWindow::on_add_Relay_pushButton_clicked()
  12. {
  13.  
  14. if(ui->bank_Select_comboBox->currentText()=="Bank 1")
  15. {
  16.  
  17. Bank_1[0] = 1;
  18. }
  19. //right now I am trying to get the number to display but am still getting odd results
  20.  
  21. void MainWindow::displayVector(QVector<int> bank)
  22. {
  23. int i = bank[0];
  24.  
  25.  
  26. QString s = QString::number(i);
  27.  
  28. ui->relay_1_lineEdit->setText(s);
  29. }
To copy to clipboard, switch view to plain text mode 

If you need to see the .h file I can add it. Any help or explanation would be greatly appreciated.