I am probably overlooking something simple, but do not understand why this function runs without being called. At the end of the constructor I have:
Qt Code:
  1. AvailableDialog::AvailableDialog(BomTableModel *model, QWidget *parent) :
  2. QDialog(parent),
  3. ui(new Ui::AvailableDialog)
  4. {
  5. // ...
  6.  
  7. // for(int i = 1; i < maxProjects + 1; i++)
  8. // ui->quantityCombo->addItem(QString::number(i));
  9.  
  10. qDebug() << "fillTable being called";
  11. fillTable();
  12. qDebug() << "fillTable finished";
  13. }
To copy to clipboard, switch view to plain text mode 
With the loop commented out, it works as expected. The loop just fills a combo box with numbers (1 - 10). My debug output is:
fillTable being called
fillTable starting
0
1
2
3
4
5
6
7
8
fillTable ending
fillTable finished
The lines, other than the first and last are inside the function. If I uncomment the loop, the output is:
fillTable starting
0
...
8
fillTable ending
fillTable being called
fillTable starting
0
...
8
fillTable ending
fillTable finished
I originally had the loop after the function call, and noticed that it jumped right back to the function after completing the loop, when I was stepping through it. In that case the output was:
fillTable being called
fillTable starting
0
...
8
fillTable ending
fillTable finished
fillTable starting
0
...
8
fillTable ending
As you can see, for some reason, the code appears to jump inside the function, after the loop ends. I cannot think of any reason for this behavior.