QT: load .ui at run time

Dynamic dialogs are dialogs that are created from Qt Designer .ui files at run-time. Instead of converting
the .ui file to C++ code using uic, we can load the file at run-time using the QUiLoader class:

 

QUiLoader uiLoader;
QFile file("sortdialog.ui");
QWidget *sortDialog = uiLoader.load(&file);
if (sortDialog) {
...
}

 

We can access the form's child widgets using QObject::findChild<T>():
QComboBox *primaryColumnCombo =
sortDialog->findChild<QComboBox *>("primaryColumnCombo");
if (primaryColumnCombo) {
...
}

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/drbinzhao/article/details/6132310
文章标签: qt file access class c
个人分类: QT
想对作者说点什么? 我来说一句

qt_ebook_ui_GetIntansce

2011年08月09日 3MB 下载

没有更多推荐了,返回首页

不良信息举报

QT: load .ui at run time

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭