QMainWindows学习笔记

textEdit = new QPlainTextEdit; //富文本显示器
setCentralWidget(textEdit);// 

关闭窗体会触发void MainWindow::closeEvent(QCloseEvent *event){ }

QMenu  可以添加qaction 

void MainWindow::createMenus()

{
fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(newAct);
fileMenu->addAction(openAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);

}

void MainWindow::createActions()
{

newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
newAct->setShortcuts(QKeySequence::New);//NEW 是一个命令
newAct->setStatusTip(tr("Create a new file"));
connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));

}

 QKeySequence(QKeySequence::Print);

 QKeySequence(tr("Ctrl+P"));

 QKeySequence(tr("Ctrl+p"));

 QKeySequence(Qt::CTRL + Qt::Key_P);

你可能感兴趣的:(windows)