views:

49

answers:

0

qt - This code very slow

QWidget *MainWindow::loadUi(QString uiPath)
{
    QWidget *newui;
    QUiLoader loader;
    QFile uiFile(uiPath);
    if(uiFile.open(QIODevice::ReadOnly))
    {
        newui = loader.load(&uiFile);
        newui->show();
        uiFile.close();
    }
    else
    {
        QMessageBox::warning(this, "error", "open ui file : " + uiPath);
    }
    return newui;
}