请问QT中CPP文件里怎么引用UI文件里创建的东西啊?
我在UI文件里创建了一个按钮。比如类名叫 OKButton
然后在CPP文件里用 OKButton 说在此区域没有定义。
请问怎么解决啊?
[解决办法]
QUiLoader loader;
QFile file(":/forms/myform.ui");
file.open(QFile::ReadOnly);
QWidget *myWidget = loader.load(&file, this);
file.close();
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(myWidget);
setLayout(layout);
this is QT ASsistant,input "QUILoader"