PDA

View Full Version : Simple questions



assismvla
2nd May 2010, 00:59
I create a QDialog and insert a QPushButton, which when clicked calls a QMainWindows, but QMainWindows only flashes on the screen, and will not appear.

here is the simple code:


login.h
private slots:
void Pushbutton_ok_click();

login.cpp
connect(ui->pushButton_OK,SIGNAL(clicked()),this,SLOT(Pushbutt on_ok_click()));

void Login::Pushbutton_ok_click()
{
MainWindow W;
W.show();
}

norobro
2nd May 2010, 01:48
Simple question in return (and a big hint): what is the life of a widget created on the stack?

assismvla
2nd May 2010, 02:44
ok. Where a have to create it?

norobro
2nd May 2010, 02:57
Here (http://sector.ynet.sk/qt4-tutorial/how-to-read-qt-documentation-basic-concepts.html) at the bottom of the page is a Qt related explanation.