Reputation: 197
I have a Main window with push buttons to open other windows, as shown below:
Here both in Program window and Logs window , I have a back to main button which can take to the Main window.
In the Logs window at present I'm having a real-time display of sensor.
Everything seems fine if I start Logs from Main in the first time
But, if I goto Programs -> back to Main -> Logs the Logs window is getting too much delayed.
This is how I go back to Main from Program
void stageProgram::on_pushButton_shoulderControl_clicked()
{
this-> close();
StageOneMain *newPatient = new StageOneMain(pLabel);
newPatient-> show();
}
Logs from Main
void StageOneMain::on_pushButton_logs_clicked()
{
this->close();
window = new ShoulderControl(pLabel);
window -> show();
}
Anybody see some issue here?
Upvotes: 0
Views: 67
Reputation: 162
I would suggest that you use QStackedWidget. It is good for navigating through different "pages". You can add 5 pages to the stacked widget. when you click on a button and need to change to the respective page you do
stackedWidget->setCurrentIndex(indexOfThePage);
for example, the function to go back to main menu can look like
stackedWidget->setCurrentIndex(0);
for further reference you can see this page of the official Qt documentation.
Upvotes: 1