• 11349阅读
  • 7回复

QT运行问题 [复制链接]

上一主题 下一主题
离线tanqianguo
 
只看楼主 正序阅读 楼主  发表于: 2009-06-09
运行问题
应用程序已经编译完成。QMainWindow
程序运行崩溃提示:
各位大哥帮个忙!
主要出错地方知道--就是不知道这为什么不行
fileMenu = menuBar()->addMenu(tr("&File"));
     fileMenu->addAction(newAct);
     fileMenu->addAction(openAct);
/usr/libexec/<unknown>: No such file or directory.

去掉 fileMenu->addAction(newAct);
     fileMenu->addAction(openAct);这两行,程序正常。
多了这两句程序运行就崩溃。
谢谢!!

对了是fedora 9 .
qt 4.5
[ 此帖被tanqianguo在2009-06-10 00:08重新编辑 ]
描述:编译完成
附件: example.tar.gz (327 K) 下载次数:14
离线彩阳

只看该作者 7楼 发表于: 2014-06-22
我一般都安装在~/Develop文件夹中。
上海Qt开发联盟,热忱地欢迎你的加入!
离线彩阳

只看该作者 6楼 发表于: 2014-06-22
你们的QtSDK都是安装在哪里啊。
上海Qt开发联盟,热忱地欢迎你的加入!
离线征途开始

只看该作者 5楼 发表于: 2014-06-22
/usr/libexec/<unknown>: No such file or directory.我也遇到这个问题
离线q1252433913
只看该作者 4楼 发表于: 2012-11-12
我也遇到了这个问题
离线tuxu1111
只看该作者 3楼 发表于: 2009-11-16
你的 createAction() 和 createMenu()位置写反了
createAction()应该先执行
离线tanqianguo
只看该作者 2楼 发表于: 2009-06-10
在  Menu下面添加动作也可以,前提是把所有代码写完。在QT文档里面也是这么写,
在MENU下面有个函数
void QMenu::addAction ( QAction * action )

This is an overloaded member function, provided for convenience.

Appends the action action to the menu's list of actions.
这就这个意思。
你说的这方法在QACTION 下面也找到了
Once a QAction has been created it should be added to the relevant menu and toolbar, then connected to the slot which will perform the action. For example:

     openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
     openAct->setShortcuts(QKeySequence::Open);
     openAct->setStatusTip(tr("Open an existing file"));
     connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

     fileMenu->addAction(openAct);
     fileToolBar->addAction(openAct);

We recommend that actions are created as children of the window they are used in. In most cases actions will be children of the application's main window.

不知道这怎么回事。
谢谢!
离线xunchen416
只看该作者 1楼 发表于: 2009-06-10
在加menu方法里不要添加action,在createAction中添加即OK
附件: example.rar (1443 K) 下载次数:7
快速回复
限100 字节
 
上一个 下一个