qt最新版5.3.1中的头文件编程问题 20
代码如下:#include<QAction>#include<QMenuBar>#include<QMessageBox>#include<QStatusBar>#inc...
代码如下:
#include <QAction>#include <QMenuBar>#include <QMessageBox>#include <QStatusBar>#include <QToolBar>#include "mainwindow.h"MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ setWindowTitle(tr("Main Window")); openAction = new QAction(QIcon(":/images/doc-open"), tr("&Open..."), this); openAction->setShortcuts(QKeySequence::Open); openAction->setStatusTip(tr("Open an existing file")); connect(openAction, &QAction::triggered, this, &MainWindow::open); QMenu *file = menuBar()->addMenu(tr("&File")); file->addAction(openAction); QToolBar *toolBar = addToolBar(tr("&File")); toolBar->addAction(openAction); statusBar() ;}
运行总是提示如下:
menuBar和statusBar的已经在include包含了,为什么还是找不到呢? 展开
#include <QAction>#include <QMenuBar>#include <QMessageBox>#include <QStatusBar>#include <QToolBar>#include "mainwindow.h"MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ setWindowTitle(tr("Main Window")); openAction = new QAction(QIcon(":/images/doc-open"), tr("&Open..."), this); openAction->setShortcuts(QKeySequence::Open); openAction->setStatusTip(tr("Open an existing file")); connect(openAction, &QAction::triggered, this, &MainWindow::open); QMenu *file = menuBar()->addMenu(tr("&File")); file->addAction(openAction); QToolBar *toolBar = addToolBar(tr("&File")); toolBar->addAction(openAction); statusBar() ;}
运行总是提示如下:
menuBar和statusBar的已经在include包含了,为什么还是找不到呢? 展开
2014-08-11
展开全部
menuBar和statusBar是自己创建得菜单和状态栏对象,你都没有创建对象,怎么引用它
追问
谢谢,请问应该如何修改或者设置?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询