liziyuanhaha
25th August 2015, 19:20
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:
console = new Console;
console ->setEnabled(false);
QGridLayout *centralLayout = new QGridLayout;
centralLayout->addWidget(console , 0,0,1,1);
centralLayout->addWidget(trackingWidget, 0,1,1,1);
trackingWidget->resize(512,512);
console ->resize(325,512);
QWidget *myCentralWidget = new QWidget;
myCentralWidget->setLayout(centralLayout);
setCentralWidget(myCentralWidget);
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!
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:
console = new Console;
console ->setEnabled(false);
QGridLayout *centralLayout = new QGridLayout;
centralLayout->addWidget(console , 0,0,1,1);
centralLayout->addWidget(trackingWidget, 0,1,1,1);
trackingWidget->resize(512,512);
console ->resize(325,512);
QWidget *myCentralWidget = new QWidget;
myCentralWidget->setLayout(centralLayout);
setCentralWidget(myCentralWidget);
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!