QCommandLineParser
来源:互联网 发布:网络职业有哪些 编辑:程序博客网 时间:2024/05/23 00:54
D:\Qt\Qt5.5.1\Examples\Qt-5.5\widgets\widgets\imageviewer\imageviewer.pro
int main(int argc, char *argv[]){ QApplication app(argc, argv); QGuiApplication::setApplicationDisplayName(ImageViewer::tr("setApplicationDisplayName")); QCommandLineParser commandLineParser; commandLineParser.addHelpOption(); commandLineParser.addPositionalArgument(ImageViewer::tr("[file]"), ImageViewer::tr("Image file to open.")); QStringList slArgs = QCoreApplication::arguments(); commandLineParser.process(slArgs); qDebug()<<"slArgs="<<slArgs; ImageViewer imageViewer; QStringList slPargs = commandLineParser.positionalArguments(); qDebug()<<"slPargs="<<slPargs; bool b1 = slPargs.isEmpty(); if (b1==false) { QString fileName=slPargs.front(); bool b2 = imageViewer.loadFile(fileName); qDebug()<<"fileName="<<fileName; if (b2==false) { return -1; } } imageViewer.show(); return app.exec();}
0 0
- QCommandLineParser
- 3.QT中QCommandLineParser和QCommandLineOption解析命令行参数
- 深度学习入门:Cross-dimensional Weighting for Aggregated Deep Convolutional Features
- net包
- 【转载】spring-data-jpa+hibernate 各种缓存的配置演示
- json和XML哪个更加实用
- 142011043 梁新帆 心得一
- QCommandLineParser
- paf导出,中文问题整理
- 下拉刷新控件
- 三维可视化仿真遇到虚拟现实技术
- java 发送邮件
- JFinal 独创的Db+Recond 模式 demo
- 打造最美HTML5 3D机房(第四季:大型园区、地球仪效果,及其他扩展)
- 142011043 梁新帆 心得二
- 运营人员必须掌握的APP基础数据分析体系