stbb24
7th June 2012, 14:42
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 = new QWidget();
ui->newWindow->show();
ui->newWindow->setFixedSize(350, 200);
ui->newWindow->setWindowTitle("Help Menu");
QTextEdit *textEdit = new QTextEdit;
textEdit->setText("sample");
textEdit->show();
}
Unfortunately my code is showing me this. 4 windows, 2 for the help menu and 2 for the textEdit.
7813
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()
{
QTextEdit *textEdit = new QTextEdit;
textEdit->setFixedSize(350, 200);
textEdit->setWindowTitle("Help Menu");
textEdit->setReadOnly(TRUE);
textEdit->setText("sample");
textEdit->show();
}
But for some reason how come when i click the help option it's showing me two instances of textEdit?
7814
I have this code so far for the help action.
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();
}
Unfortunately my code is showing me this. 4 windows, 2 for the help menu and 2 for the textEdit.
7813
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()
{
QTextEdit *textEdit = new QTextEdit;
textEdit->setFixedSize(350, 200);
textEdit->setWindowTitle("Help Menu");
textEdit->setReadOnly(TRUE);
textEdit->setText("sample");
textEdit->show();
}
But for some reason how come when i click the help option it's showing me two instances of textEdit?
7814