QShortcut快捷键

关闭窗口的快捷键

QWidget *w = new QWidget();
QShortcut *shortCut = new QShortcut(Qt::CTRL + Qt::Key_Q, w);
connect(shortCut,  SIGNAL(activated()),  w,  SLOT(close()));
w->show();

你可能感兴趣的:(Qt,qt,开发工具)