//QUiLoader使用
//main.cpp
#include <QtGui/Qtgui>
#include <QtGui/QLabel>
#include <QtUiTools/QUiLoader>
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QUiLoader uiLoader;
QFile file("MyDialog.ui");
QWidget* pWidget = uiLoader.load(&file);
if (pWidget==NULL)
{
QMessageBox::warning(NULL,"error","load MyDialog.ui error",QMessageBox::Ok);
return 0;
}
//void QWidget::showNormal () [slot]
QPushButton* pBtnOk = pWidget->findChild<QPushButton*>("okButton");
if (pBtnOk!=NULL)
{
QMessageBox::information(NULL,"Hint","Find okButton Success",QMessageBox::Ok);
}
pWidget->showNormal();
//pWidget->show();
return a.exec();
}