开发者

How to check that Qwidget exist

Like in title how to check that child class from QWidget exist?

when i try something like that it break application end throw error

void MainWindow::slotAddLoginData() {
    if(!addLoginData) {
        addLoginData = new AddLoginData(this);
        connect(this, SIGNAL(setEnabledALDbtnOK(bool)),
        addLoginData, SLOT开发者_运维技巧(btnOkEnabled(bool)));

    }
    addLoginData->show();
    addLoginData->activateWindow();

}


It looks like addLoginData is not initialised


As others have said, addLoginData isn't initialized. You can't do this:

if(!addLoginData) { ... }

Unless you initialize addLoginData to 0. So, as Georg said, initialize it, except make that..

MainWindow::MainWindow() : addLoginData(0)

(note the "0")


One possibility would be that you have not initialized addLoginData. Use something like this in that case:

MainWindow::MainWindow()
  : addLoginData()
  // ...
{
    // ...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜