Qt的最近访问文件问题

a15630176380 a15630176380 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
void MainWindow::createActions()
{
newAction=new QAction(tr("&New"),this);//动作new有一个加速键NEW,和一个父窗体(主窗口)
// newAction->setIcon(QIcon);
newAction->setShortcut(QKeySequence::New);//快捷键枚举
newAction->setStatusTip(tr("Create a new spreadsheet file"));
connect(newAction,SIGNAL(triggered()),this,SLOT(newFile()));
for(int i=0;i<MaxRecentFiles;++i)这个数组里面放的是动作?不应该是最近显示的文件名吗?
{
recentFileActions[i]=new QAction(this);
recentFileActions[i]->setVisible(false);
connect(recentFileActions[i],SIGNAL(triggered()),this,SLOT(openRecentFile()));
}
closeAction=new QAction(tr("&Close"),this);
closeAction->setShortcut(QKeySequence::Close);
closeAction->setStatusTip(tr("Close this window"));
connect(closeAction,SIGNAL(triggered()),this,SLOT(close()));
exitAction=new QAction(tr("E&xit"),this);
exitAction->setShortcut(tr("Ctrl+Q"));//设置快捷键
exitAction->setStatusTip(tr("Exit the application"));//设置提示语
connect(exitAction,SIGNAL(triggered()),qApp,SLOT(closeAllWindows()));

selectAllAction=new QAction(tr("&All"),this);//表示选择全部快捷键为ctrl+A
selectAllAction->setShortcut(QKeySequence::SelectAll);//设置快捷键 QKeySequence:键序列
selectAllAction->setStatusTip(tr("Select all the cells in the"
"spreadsheet"));
connect(selectAllAction,SIGNAL(triggered()),spreadsheet,SLOT(selectAll()));

//Show Grid是一个复选(checkable动作)
showGridAction =new QAction(tr("&Show Grid"),this);
showGridAction->setCheckable(true);
showGridAction->setChecked(spreadsheet->showGrid());
showGridAction->setStatusTip(tr("show or hide the spreadsheet ' s grid"));
connect(showGridAction,SIGNAL(toggled(bool)),spreadsheet,SLOT(setShowGrid(bool)));

aboutQtAction=new QAction(tr("About &Qt"),this);
aboutQtAction->setStatusTip(tr("Show the Qt library's About box"));
connect(aboutQtAction,SIGNAL(triggered()),qApp,SLOT(aboutQt()));//通过访问qApp这个全局变量
//我们可以使用QApplication对象的aboutQt槽,目的是为了弹出一个对话框。
}

刚刚学Qt 按照书本上打的代码,我的理解应该是数组里面保存的是最近访问的文件名啊,为什么是保存Action?
...全文

相关推荐

qt-creator说明书.pdf

1. Introduction Qt Creator is a complete integrated development environment (IDE) for creating applications with the Qt application framework. Qt is designed for developing applications and user interfaces once and deploying them across several desktop and mobile operating systems. The main inspirations for Qt Creator have been the development needs of Qt developers, looking for simplicity, usability, productivity, extendibility and openness, while aiming to lower the barrier of entry for newcomers to Qt. The key features of Qt Creator aid the application developer in the following ways: • Quick and easy start of Qt application development with a project wizard, and quick access to recent projects and sessions.

无情更比有情苦

creator 与 qt 联调

creator 与 qt 联调

dapeng_fly110

骑士周游算法的QT演示版

骑士周游问题采用递归加回溯的方法来遍历整个棋盘,然后引入一路剪枝来加快搜索速度。在QT下开发,有友好的界面显示,支持暂停、继续、保存、载入历史数据、打印等基本功能,欢迎下载。

wensxdut

qt c++应用程序进程崩溃后生成dmp文件,用于分析进程崩溃在哪一句代码,便于定位段错误,修改程序bug,不会自动拉起进程

qt c++应用程序进程崩溃后生成dmp文件,用于分析进程崩溃在哪一句代码,便于定位段错误,修改程序bug,不会自动拉起进程

战斗强

Qt加载百度离线地图

Qt4.8.6加载百度离线地图,实现了街道图和卫星图的切换,实现了地图中标签的移动,实现了获取地图坐标并在Qt界面显示。绝对原创,保证可用

御豪同学
评论 1
收藏 已收藏
分享
返回顶部