QString source = ui->textEdit_code->toPlainText(); QClipboard *clipboard = QApplication::clipboard(); //获取系统剪贴板指针 QString originalText = clipboard->text(); //获取剪贴板上文本信息 clipboard->setText(source); //设置剪贴板内容</span>
Qt就是方便...