It's probably better to explicitly add your new widget to the scroll area:

Qt Code:
  1. b->resize(100,600);
  2. mainWindow->scrollArea->setWidget(b);
To copy to clipboard, switch view to plain text mode 

It is probably bad style (read about encapsulation) to have member variables publicly (or even protected) available. Also, please use code tags on the forum when posting code.