1 QShortcut *backwardShortcut = new QShortcut(QKeySequence::Copy, this); 2 connect(backwardShortcut, SIGNAL(activated()), this, SLOT(slot_action_screenshotTriggered()));
这是给截图操作添加了 ctrl + c 快捷键
放到剪贴板
void slot_action_screenshotTriggered(bool checked) { QString path = PathHelper::getFileBinPath("temp/"); QString strTime = QDateTime::currentDateTime().toString("yyyyMMddhhmmss.jpeg"); path += strTime; if (!path.isEmpty()) TDTool::getInstance()->captureScreen(path.toStdString()); QImage image; image.load(path); QClipboard* clip = QApplication::clipboard(); clip->setImage(image); }
标签:qt,clip,image,快捷键,添加,path,backwardShortcut From: https://www.cnblogs.com/warmlight/p/17420414.html