My codes was derived from Qt example "Terminal".

I added another class "trackingWidget", and it works very well as an independent widget from QMainWindow, where the console stays.

Now I am trying to put my "trackingWidget" on the right side of console, and keep both of them inside QMainWindow; however, my "trackingWidget" disappeared.
Here is my code:

Qt Code:
  1. console = new Console;
  2. console ->setEnabled(false);
  3.  
  4. QGridLayout *centralLayout = new QGridLayout;
  5. centralLayout->addWidget(console , 0,0,1,1);
  6. centralLayout->addWidget(trackingWidget, 0,1,1,1);
  7. trackingWidget->resize(512,512);
  8. console ->resize(325,512);
  9.  
  10. QWidget *myCentralWidget = new QWidget;
  11. myCentralWidget->setLayout(centralLayout);
  12. setCentralWidget(myCentralWidget);
To copy to clipboard, switch view to plain text mode 

It is ok if I just add trackingWidget; however, once I add console, the trackingWidget would be crushed to nowhere like it has never been added.

Is it possible to show multi-QWidgets with flexible sizes in one QWidget/QMainWindow?

Thanks!