请问QT中CPP文件里怎么引用UI文件里创建的东西啊?

mixbar 2008-12-16 03:38:43
我在UI文件里创建了一个按钮。比如类名叫 OKButton
然后在CPP文件里用 OKButton 说在此区域没有定义。
请问怎么解决啊?
...全文
817 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
dykxjh 2012-06-17
  • 打赏
  • 举报
回复
同样的问题,不知道楼主解决了没有?
sqlvv 2008-12-25
  • 打赏
  • 举报
回复
$ uic –o helloworld.h helloworld.ui
$ uic –o helloworld.cpp –impl helloworld.h helloworld.ui
lzp765 2008-12-20
  • 打赏
  • 举报
回复
生成cpp有个工具,gg下,OK
捕鲸叉 2008-12-20
  • 打赏
  • 举报
回复
你要转换一下吧,好象叫uic的工具
noky 2008-12-18
  • 打赏
  • 举报
回复

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"
annaqsy 2008-12-18
  • 打赏
  • 举报
回复
uic xxxx.ui -o xxxx.h
生成这个头文件再include
ysuliu 2008-12-16
  • 打赏
  • 举报
回复
还真是不会,我一般都不用designer
你还是自己写一个吧,很简单的。
mixbar 2008-12-16
  • 打赏
  • 举报
回复
只能不停的UP啦?
mixbar 2008-12-16
  • 打赏
  • 举报
回复
UP。
mixbar 2008-12-16
  • 打赏
  • 举报
回复
已经include了 UI文件了。也是不行。
qap22 2008-12-16
  • 打赏
  • 举报
回复
up
SearchLife 2008-12-16
  • 打赏
  • 举报
回复
需要引用类的声明啊

65,211

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧