I have a Help Menu and under the help menu i have help, and about. Now when the user clicks the help menu a new window should pop out containing all the help details of the program.
I have this code so far for the help action.
void MainWindow::on_action_Help_triggered()
{
ui->newWindow->show();
ui->newWindow->setFixedSize(350, 200);
ui->newWindow->setWindowTitle("Help Menu");
textEdit->setText("sample");
textEdit->show();
}
void MainWindow::on_action_Help_triggered()
{
ui->newWindow = new QWidget();
ui->newWindow->show();
ui->newWindow->setFixedSize(350, 200);
ui->newWindow->setWindowTitle("Help Menu");
QTextEdit *textEdit = new QTextEdit;
textEdit->setText("sample");
textEdit->show();
}
To copy to clipboard, switch view to plain text mode
Unfortunately my code is showing me this. 4 windows, 2 for the help menu and 2 for the textEdit.
Screenshot from 2012-06-07 21:19:29.png
How can I connect the textEdit to the widget so that it will only be in that widget and not as a separate window?And why is it showing two instances of the help menu and the textEdit when I don't even have a loop to show them twice?
Added after 6 minutes:
So to make my life a little bit easier i just decided to do this
void MainWindow::on_action_Help_triggered()
{
textEdit->setFixedSize(350, 200);
textEdit->setWindowTitle("Help Menu");
textEdit->setReadOnly(TRUE);
textEdit->setText("sample");
textEdit->show();
}
void MainWindow::on_action_Help_triggered()
{
QTextEdit *textEdit = new QTextEdit;
textEdit->setFixedSize(350, 200);
textEdit->setWindowTitle("Help Menu");
textEdit->setReadOnly(TRUE);
textEdit->setText("sample");
textEdit->show();
}
To copy to clipboard, switch view to plain text mode
But for some reason how come when i click the help option it's showing me two instances of textEdit?
Screenshot from 2012-06-07 21:19:29.png
Bookmarks