QT类帮助的使用

秉持着一不怕苦,二不怕烦的精神。我还是对在QT说明文档中对自己有用的套路进行一下分析;

Contents(在这里指目录,其实内容也没有多大的问题)下有7个大标题,分别的

Public Types(公共类型,在python里面type经常用到,用来监测变量的类型)

Properties(类型,在英文解释中这个是特性的意思),在Properties中的物理量都是在Public Functions(公共函数,在c++中Functions是可以定义函数的)中进行使用

Public Slots(公共槽函数,在英文中Slots意味缝隙,在这里可以解释为槽);

Reimplemented Protected Functions(重新实现受保护的功能)

Detailed Description(详细说明)对action的初始化进行详细的说明

Member Type Documentation(成员类型文档)

Property Documentation(类型的详细文档)

……

结构图:

在这里插入图片描述

程序初始化

    newAct = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("新建(&N)"), this);
    newAct->setShortcuts(QKeySequence::New);
    newAct->setToolTip("新建");                   //设置工具栏按钮的提示文本
    newAct->setStatusTip(tr("创建一个新文档"));     //设置状态栏提示文本
    connect(newAct, SIGNAL(triggered()), this, SLOT(fileNew()));

说明文档内的初始化:

      const QIcon openIcon = QIcon::fromTheme("document-open", QIcon(":/images/open.png"));
      QAction *openAct = new QAction(openIcon, tr("&Open..."), this);
      openAct->setShortcuts(QKeySequence::Open);
      openAct->setStatusTip(tr("Open an existing file"));
      connect(openAct, &QAction::triggered, this, &MainWindow::open);
      fileMenu->addAction(openAct);
      fileToolBar->addAction(openAct);

后面两个并不是没有他进行了集中的布置!将所有的合并到一起去了!

猜你喜欢

转载自blog.csdn.net/qq_41068712/article/details/89331659